zhuang@linux:~/reading/practical-vim/13-search/$ less

Practical Vim / chapter 13

Search

$ grep tags 13-search.md

This post extracts some knowledge from Practical Vim Chapter 13 – Search.

Meet the Search Commands

markdown
| Command | Effect |
|---------|--------|
| `n` | Jump to next match, preserving direction and offset |
| `N` | Jump to previous match, preserving direction and offset |
| `/<CR>` | Jump forward to next match of same pattern |
| `?<CR>` | Jump backward to previous match of same pattern |
| `gn` | Enable character-wise Visual mode and select next search match |
| `gN` | Enable character-wise Visual mode and select previous search match |

:nohlsearch command can be used to mute the search highlighting temporarily.

ShortcutMeaning
<C-r><C-w>Insert the word under the cursor into the command line
<C-r><C-a>Insert the WORD under the cursor into the command line
*Search forward for the word under the cursor
#Search backward for the word under the cursor
g*Search forward for the text under the cursor as a substring (not restricted to whole words)
g#Search backward for the text under the cursor as a substring (not restricted to whole words)

zhuang@linux:~/reading/practical-vim/13-search/$ comments