我在一个文件中搜索“nurple”。我找到了,太好了。但现在,“nurple”的每一次出现都被渲染成黄上黑的病态。直到永远。
永远,也就是说,直到我搜索一些我知道不会找到的东西,比如“asdhfalsdflajdflakjdf”,这样它就会清除之前的搜索突出显示。
当我搜索完的时候,我就不能按一个神奇的键把高光部分去掉吗?
我在一个文件中搜索“nurple”。我找到了,太好了。但现在,“nurple”的每一次出现都被渲染成黄上黑的病态。直到永远。
永远,也就是说,直到我搜索一些我知道不会找到的东西,比如“asdhfalsdflajdflakjdf”,这样它就会清除之前的搜索突出显示。
当我搜索完的时候,我就不能按一个神奇的键把高光部分去掉吗?
当前回答
我认为最好的答案是有一个领导捷径:
<leader>c :nohl<CR>
现在,当你的文档被高亮显示的术语弄得乱七八糟时,你只需点击+ C(我把前导映射为一个逗号)。它工作得很完美。
其他回答
:noh (nohighlight的缩写)将暂时清除搜索高亮显示。下一个搜索仍然会突出显示。
把这个放进你的。vimrc
" <Ctrl-l> redraws the screen and removes any search highlighting.
nnoremap <silent> <C-l> :nohl<CR><C-l>
/lkjasdf对我来说总是比:noh快。
*:noh* *:nohlsearch* :noh[lsearch] Stop the highlighting for the 'hlsearch' option. It is automatically turned back on when using a search command, or setting the 'hlsearch' option. This command doesn't work in an autocommand, because the highlighting state is saved and restored when executing autocommands |autocmd-searchpat|. Same thing for when invoking a user function.
我发现它就在:help #下面,我一直在点击它,它突出显示当前页面上的所有单词,就像当前页面一样。
我经常搜索,我发现映射下划线键来删除搜索高亮显示很有用:
nnoremap <silent> _ :nohl<CR>