Skip to main content

Enable up-arrow history auto-complete

This how to enable up/down arrow auto-complete navigation instead of basic history navigation, without installing plugins.

Bash

nano ~/.inputrc

Paste in:

"\e[A": history-search-backward
"\e[B": history-search-forward

Run:

bind -f ~/.inputrc

Zsh

Put the following into your ~/.zshrc:

autoload -Uz up-line-or-beginning-search down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
bindkey '^[[A' up-line-or-beginning-search # Up arrow
bindkey '^[[B' down-line-or-beginning-search # Down arrow