Re:My favourite Zsh features
by peter12355 on Saturday November 15, 2014 @03:58PM
(#8612647)
You should check out https://github.com/tymm/directory-history then.
It makes your history matching sensitive to the directory you are in.
That means that commands will show up first which were typed in the directory you are in.
I don't want to miss this plugin and can't really understand why not everyone wants it. I guess I am a little biased though since I wrote that plugin ;)
I use C-r and C-s in bash, for incremental searching backwards and forwards. Takes less time to type these than reach across to the up and down arrow keys. Mind to stty stop undef to stop C-s from freezing your terminal, of course.
Zsh would probably be worth using, except for the fact that bash is almost everywhere, and I already know it very well. It's a tough one to call.
You can do it in bash too. I have this in my bashrc:
bind '"^[[1;5A": history-search-backward'
bind '"^[[1;5B": history-search-forward'
where ^[ is the escape character. This way, crtl-up goes to previous partial match (and up goes to last command as usual). I use it all the time.I have this to use the arrow keys without any modifier:
# Use up/down arrows to search on partially typed command
bind '"\e[A"':history-search-backward
bind '"\e[B"':history-search-forward
Just type the first letter(s) and use the up/down arrows to scroll through the filtered command history. Incredibly convenient.
I feel lost without it, more than the tab completion.