mba*_*768 225 vim search highlight
我在文件中搜索"nurple".我找到了,很棒.但是现在,每次出现的"nurple"都会以黄色的病态黑色呈现.永远.
永远,也就是说,直到我搜索我知道的东西都找不到,例如"asdhfalsdflajdflakjdf",这样就可以清除之前的搜索突出显示.
当我完成搜索时,我不能只是用一把魔法钥匙来杀死高光吗?
Lee*_*e H 335
:noh (nohighlight的缩写)将成功.
Luc*_* S. 171
把它放在.vimrc中
" <Ctrl-l> redraws the screen and removes any search highlighting.
nnoremap <silent> <C-l> :nohl<CR><C-l>
Run Code Online (Sandbox Code Playgroud)
小智 79
/lkjasdf一直比:noh我快.
And*_*ter 26
" Make double-<Esc> clear search highlights
nnoremap <silent> <Esc><Esc> <Esc>:nohlsearch<CR><Esc>
Run Code Online (Sandbox Code Playgroud)
Zso*_*kai 19
然后我更喜欢这个:
map <F12> :set hls!<CR>
imap <F12> <ESC>:set hls!<CR>a
vmap <F12> <ESC>:set hls!<CR>gv
Run Code Online (Sandbox Code Playgroud)
为什么?因为它切换开关:如果高亮显示,则按下F12将其关闭.反之亦然.HTH.
*: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 #,我一直在打,并突出显示当前页面上的所有单词,就像当前页面上的单词一样.
我认为最好的答案是有一个领导捷径:
<leader>c :nohl<CR>
Run Code Online (Sandbox Code Playgroud)
现在,每当您的文档中充满了突出显示的术语时,您只需按,+ C(我将我的领导者映射到逗号)。它工作完美。