Get rid of Vim's highlight after searching text

前端 未结 8 2105
梦如初夏
梦如初夏 2020-12-02 08:37

In VIM, after finding text with \"/\" command, that text remains highlighted.

What is the command to remove that? I don\'t want to remove highlighting capability at

8条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-02 09:10

    In addition to “clear the search register”, you can even reset the search register to its previous value:

    command! -nargs=* -range S
    \ let atslash=@/|exe ':'..','..'s'.|let @/=atslash
    

    However:
    - this does not reset the previous status of :hls. I do not believe this to be possible in general.
    - this defines a new command, :S, to use in place of :s. You can use a cabbrev to map one to the other, but this will break when you add a range to the substitute command.

提交回复
热议问题