How to display all results of a search in vim

前端 未结 3 1543
面向向阳花
面向向阳花 2021-01-13 13:33

When searching string with notepad++, new window opens and shows find results. I want to use this feature in vim. After googling I found out some suggestions:



        
3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-13 14:23

    Those two commands can be shortened and chained: :vim foo %|co. You can pull the word under the cursor like this: :vim %|co.

    Here is a quick normal mode mapping that you can use to list all the occurrences of the word under your cursor in the quickfix window:

    nnoremap  :vimgrep //j %  cwindow
    

    You can also use :il[ist] foo to display a list of all the occurrences of foo or [I to display the same list for the word under your cursor.

    When the list is displayed, use :{line number} to jump to the corresponding line.

提交回复
热议问题