It tells zsh to search backward and forward in the history for any line starting with the same string as what is currently entered when you press the up and down arrow... Helps saves a lot of time compared to always just using Ctrl-r.
I think there's an equivalent for bash, but I don't know it...
I know that people like to use ctrl-R to search backwards through history, but I am very zealous about using the up-arrow to search through your history instead (in your .bashrc):
Now up and down arrows will search your history with whatever you already have typed at the prompt. Re-running a command often? Probably just have to type its first letter and hit up arrow once or twice.
Tip: Bash reverse search, because manually scrolling through your history is a nuisance.
How (OS X): CTRL+R, start typing a word from your command history. Press CTRL+R to cycle through matches, ENTER to execute, TAB to edit. If you want to add forward search to bash, you can re-map your key bindings in your bash profile with the following (maps to CTRL+T): bind "\C-t":forward-search-history
Also I found the following settings to be very useful:
# List the possible completions when Tab is pressed
set show-all-if-ambiguous on
#tab complete without needing to get the case right
set completion-ignore-case on
One of my most life-changing bash configurations is having history-search-backward / history-search-forward bound to the up and down arrows.
Put the following in your ~/.inputrc
"\e[A": history-search-backward
"\e[B": history-search-forward
"\e[C": forward-char
"\e[D": backward-char
set show-all-if-ambiguous on
set completion-ignore-case on
Now if you type, say:
cat <UP ARROW>
You will cycle through commands in your history that start with the prefix "cat ".
I prefer to map it to esc-p which coincides with the setting in tcsh. Like that:
"\M-p": history-search-backward
So you basically type something and then press esc p to have the shell complete it.
reply