zsh-users / zsh-history-substring-search

🐠 ZSH port of Fish history search (up arrow)
2.61k stars 155 forks source link

Consider setting up some default key bindings #107

Open lnicola opened 4 years ago

lnicola commented 4 years ago

I've skimmed some of the various issues here and I understand that there's no single way to set the keybindings up, but I think the ones included in the README are fine and shouldn't conflict with anything else.

Can we add this (or something similar) as a default?

bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down

# Bind up and down keys
zmodload -F zsh/terminfo +p:terminfo
if [[ -n ${terminfo[kcuu1]} && -n ${terminfo[kcud1]} ]]; then
  bindkey ${terminfo[kcuu1]} history-substring-search-up
  bindkey ${terminfo[kcud1]} history-substring-search-down
fi

bindkey '^P' history-substring-search-up
bindkey '^N' history-substring-search-down
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down

See for https://github.com/zimfw/zimfw/issues/364#issuecomment-572713657 for some context, although it's probably not needed.

sunaku commented 3 years ago

Okay, please submit a pull request for this. :+1:

ericbn commented 2 years ago

Created https://github.com/zsh-users/zsh-history-substring-search/pull/123