Adds support for vi search directly in the zsh buffer.
With antigen, add the following line to your .zshrc
.
antigen bundle qleveque/zsh-vi-search
Download zsh-vi-search.zsh and source it in your .zshrc
.
In zsh vi mode (bindkey -v
) for both vicmd
and visual
modes:
- / Forward search
- ? Backward search
- * Forward search of the word under the cursor
- # Backward search of the word under the cursor
- n Repeat last search
- N Repeat last search in the opposite direction
ZSH_VI_SEARCH_GREP_PARAMETERS
(default(-i)
): the parameters of thegrep
command used to match search patterns.ZSH_VI_SEARCH_PREFIX
(default''
): automatically add this prefix to your search.ZSH_VI_SEARCH_NOHL
(default is unset): set it to any value to disable search highlighting.
# Example
ZSH_VI_SEARCH_GREP_PARAMETERS=(-i --fixed-strings)
ZSH_VI_SEARCH_PREFIX='\<'
In case search highlighting is enabled, this plugin should be loaded after zsh-syntax-highlighting.
This plugin was inspired by Soheil Rashidi's zsh-vi-search.zsh plugin.