Last active
March 13, 2023 20:08
-
-
Save mentalisttraceur/683a491dc6b6c893cb897795c7c492b6 to your computer and use it in GitHub Desktop.
zsh vi-like search
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _history-search-backward() | |
{ | |
zle .history-incremental-pattern-search-backward $BUFFER | |
} | |
function _history-search-forward() | |
{ | |
zle .history-incremental-pattern-search-forward $BUFFER | |
} | |
zle -N history-incremental-pattern-search-backward _history-search-backward | |
zle -N history-incremental-pattern-search-backward _history-search-forward | |
bindkey -M vicmd "?" .history-incremental-pattern-search-backward | |
bindkey -M vicmd "/" .history-incremental-pattern-search-forward | |
bindkey -M vicmd "N" history-incremental-pattern-search-backward | |
bindkey -M vicmd "n" history-incremental-pattern-search-forward |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
.zsh-vi-search
makesvi
-mode search commands work much more like they do invi
:n
andN
will continue the search forwards and backwards respectively, and/
and?
have theirvi
-like directions of forwards and backwards, instead of the reversed ones thatvi
-mode inzsh
defaults to.