DEV Community

Discussion on: Search for word boundaries in Vim & VSCode Vim

Collapse
 
pbnj profile image
Peter Benjamin (they/them) • Edited

Nice.

See :help # and :help * for additional related features.

For example:

  • Place the cursor on a word and press #, vim will perform the same bounded word search going backward. Equivalent to ?\<word\>.
  • Place the cursor on a word and press *, vim will perform the same bounded word search going forward. Equivalent to /\<word\>.

This can be combined with other ways of searching in vim. For example: :vimgrep /\<word\>/ % will perform bounded search for all instances of word and load the results in :help quickfix-window. From there, you can navigate through the results with :copen, :cnext, :cprev, to open the list, go to next result, or go to previous result respectively.

Collapse
 
jonasmerlin profile image
Jonas Schumacher

These are great tips, thanks!

Collapse
 
jonasmerlin profile image
Jonas Schumacher

I added a reference to your comment to the end of the post.