Vim: search and highlight but do not jump

后端 未结 12 2163
一生所求
一生所求 2020-12-02 18:02

The super star (*) key in Vim will search for the word under the cursor and jump forward to the next match. The user can jump to the next matches with the n key.

12条回答
  •  没有蜡笔的小新
    2020-12-02 18:35

    I would map:

    nnoremap * *``
    

    Works exactly like you want, except that it adds a jump in the jump list. To prevent that you need:

    nnoremap * :keepjumps normal! mi*`i
    

提交回复
热议问题