Highlight all occurrence of a selected word?

后端 未结 15 1679
难免孤独
难免孤独 2020-12-12 10:05

How can I highlight all occurrence of a selected word in GVim, like in Notepad++?

15条回答
  •  無奈伤痛
    2020-12-12 10:33

    Search based solutions (*, /...) move cursor, which may be unfortunate.

    An alternative is to use enhanced mark.vim plugin, then complete your .vimrc to let double-click trigger highlighting (I don't know how a keyboard selection may trigger a command) :

    "Use Mark plugin to highlight selected word  
    map <2-leftmouse> \m   
    

    It allows multiple highlightings, persistence, etc.

    To remove highlighting, either :

    • Double click again
    • :Mark (switch off until next selection)
    • :MarkClear

提交回复
热议问题