Tip 81: Preview the First Match Before Execution
Return to the top: <<Practical Vim>>
- show a preview of the first match based on what has been entered so far into the search field by enabled with the 'incsearch' setting
References:
# If you open the file in vim, # then you can \"ayy@a the next line to execute the vim command: :h 'incsearch'
Check for the Existence of a Match
Autocomplete the Search Field Based on Preview Match
-
<C-r><C-w>
-
NOTE: If you prefix your search with the
\v
item, then<C-r><C-w>
will complete the entire word under the cursor (creating/\vcarrcarrot<CR>
rather than/\vcarrot<CR>
, for example) instead of the remainder of the word.