-----8<-----
# make bash autocomplete with up/down arrow
bind '"\e[A":history-search-backward'
bind '"\e[B":history-search-forward'
# make tab cycle through commands instead of listing
bind '"\t":menu-complete'
----->8----- bind '"\e[A":history-search-backward'
bind '"\e[B":history-search-forward'
# make tab cycle through commands instead of listing
bind '"\t":menu-complete'
Now by pressing arrow up/down bash will autocomplete based on your command line history, while pressing TAB will cycle through commands, directories and files names.
Very handy, if you ask me, but it is a love/hate thing. Some people will despise this behaviour others won't know how they could have lived without it.
*** Bonus ***
If you are part of the sudo group, add this lines too to .bashrc and you'll be able to autocomplete after typing sudo.
-----8<-----
# sudo autocompletion
if [ "$PS1" ]; thencomplete -cf sudo
fi
----->8-----
Happy autocompleting!
No comments:
Post a Comment