3 ms·
I rarely use Ctrl+r to get command from history, because most of the time I know the starting characters of the command I need. So, I type those characters and
by asicsp 7y ago
I rarely use Ctrl+r to get command from history, because most of the time I know the starting characters of the command I need. So, I type those characters and use arrows keys to match from history. This is enabled via these settings in .inputrc
# use up and down arrow to match search history based on typed starting text
"\e[A": history-search-backward
"\e[B": history-search-forward
I also changed couple of setting wrt Tab autocompletion:
# when using Tab for completion, ignore case
set completion-ignore-case on
# single Tab press will complete if unique, display multiple completions otherwise
set show-all-if-ambiguous on
- codegladiator 7y agoYou can use ctrl+r for commands which are similar (say ssh to n number of servers, so the up/down would still take some amount of browsing the options) Just tag commands with a # at the end > $ complex command here # tagHere Later use the tag with ctrl+r I do this all the time > ssh 127.0.0.1 # master
- asicsp 7y agoyep, ctrl+r is better suited for such cases or whenever you have to match a command other than starting characters and I think there are some fuzzy matching options (like fzf) that can be added to ctrl+r
- tasuki 7y agoWhen I used bash, I had all of your settings on (had more, some others I can live without - these four I can't). I still have them in .inputrc for programs that use readline! I have since switched to zsh. Up/down to search history, in ~/.zshrc: [[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" history-beginning-search-backward [[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" history-beginning-search-forward Autocompletion in zsh is a different beast altogether :)