使 Vim 在键入搜索时突出显示所有搜索结果,并在我执行其他任何操作时关闭突出显示
Make Vim highlight all search results while typing the search and turn off highlighting when I do anything else
我希望我的 Vim 在输入搜索时突出显示所有搜索结果,即不仅仅是下一个搜索结果(如 incsearch
),而是所有搜索结果(如hlsearch
但在我打字的同时)。我还想在执行搜索以外的任何其他操作后立即关闭搜索突出显示。这可能吗?
您可以尝试 vim-cool plugin, which was mentioned in a similar question:
Vim-cool disables search highlighting when you are done searching and
re-enables it when you search again.
Vim-cool re-enables search highlighting when the cursor is on a word
that matches the last search pattern.
Vim-cool is cool.
听起来你想要 haya14busa/incsearch.vim。它所做的最重要的事情是在您搜索时突出显示每个结果,您可以在这个 gif 中看到:
它还可以做其他事情。例如,它可以配置为在您完成搜索时关闭突出显示,它还可以为其他搜索相关功能提供有用的映射,例如
n
N
*
#
g*
g#
您可以通过 Neobundle/Vundle/vim-plug 安装它
NeoBundle 'haya14busa/incsearch.vim'
Plugin 'haya14busa/incsearch.vim'
Plug 'haya14busa/incsearch.vim'
或与病原体一起做:
git clone https://github.com/haya14busa/incsearch.vim ~/.vim/bundle/incsearch.vim
我希望我的 Vim 在输入搜索时突出显示所有搜索结果,即不仅仅是下一个搜索结果(如 incsearch
),而是所有搜索结果(如hlsearch
但在我打字的同时)。我还想在执行搜索以外的任何其他操作后立即关闭搜索突出显示。这可能吗?
您可以尝试 vim-cool plugin, which was mentioned in a similar question:
Vim-cool disables search highlighting when you are done searching and re-enables it when you search again.
Vim-cool re-enables search highlighting when the cursor is on a word that matches the last search pattern.
Vim-cool is cool.
听起来你想要 haya14busa/incsearch.vim。它所做的最重要的事情是在您搜索时突出显示每个结果,您可以在这个 gif 中看到:
它还可以做其他事情。例如,它可以配置为在您完成搜索时关闭突出显示,它还可以为其他搜索相关功能提供有用的映射,例如
n
N
*
#
g*
g#
您可以通过 Neobundle/Vundle/vim-plug 安装它
NeoBundle 'haya14busa/incsearch.vim'
Plugin 'haya14busa/incsearch.vim'
Plug 'haya14busa/incsearch.vim'
或与病原体一起做:
git clone https://github.com/haya14busa/incsearch.vim ~/.vim/bundle/incsearch.vim