Unwanted highlighting of pattern in VIM

This question already has an answer here:

  • Vim clear last search highlighting 29 answers

  • 要清除文字与上次搜索模式类型相匹配的高亮区:nohls


    It is probably the last thing you searched for. vim remembers it across restarts.

    I keep this handy mapping in my ~/.vimrc :

    nnoremap  :let @/ = ""<CR>
    

    Then, I can use type while in COMMAND mode in vim , and it clears the last search term.

    I used to earlier use this:

    nnoremap  :set hlsearch!<CR>
    

    This basically toggles search highlighting on/off when you hit , but keeps the last search term in the @/ register.


    For a permanent solution you can use something like ArjunShankar suggested. For a "fix just this time" I found this. The reason I couldn't find this initially was I didn't realize that when something is highlighted in VIM, it can be related to your last search.

    :let @/ = ""
    

    This was found via this thread: Vim clear last search highlighting

    链接地址: http://www.djcxy.com/p/49370.html

    上一篇: 搜索文本后摆脱Vim的亮点

    下一篇: VIM中模式的不需要的突出显示