3 ms·
to explain the up key: prompt> some-word[up key] will search for some-word in the history. this feature helps because in 90% of cases i can type some-wor
by em-bee 3y ago
to explain the up key:
prompt> some-word[up key]
will search for some-word in the history.
this feature helps because in 90% of cases i can type some-word and have autosuggestion show me the right command, so i just need to hit right arrow and enter to run it. but, if the suggestion is wrong, i can instead hit up arrow and search for a another history entry.
in zsh currently, i can get autosuggestions, but if the suggestions is wrong, i have to type ctrl-A and retype some-word in order to search the history. i want to be able to do that without retyping, the way it is done in fish.
elvish only has the uparrop feature which gets me there halfway, i can type something, and then hit uparrow to find a matching command. in most cases the first hit is the one i want, but if not i keep searching.
i prefer to also have the autosuggestion because often i don't remember that i have a similar command already, and the autosuggestion provides that hint.
together these are the two most useful features that i want from a shell.
- JNRowe 3y agoThat is the difference between the up-line-or-history and up-line-or-search functions that I linked above. The default Up binding is the -history function, whereas the -search function in unbound by default. There are pattern variants too, if you don't like the prefix only checks. If you also need to mimic the fish behaviour of C-r mid-command because your suggestion wasn't correct, then that does need a custom function to bind to C-r as you have to provide ${L,}BUFFER to populate the search pattern like fish does.
- em-bee 3y agoah, thank you. that actually helps a lot. i don't use zsh as much, but it's good to know that this feature is available. i don't use ctrl-R in fish yet, so i won't miss that.
- em-bee 3y agoooops, typo: ctrl-A above is supposed to be ctrl-R, in case anyone is confused