October 2015
Intermediate to advanced
356 pages
7h 54m
English
| Tip 82 | Preview the First Match Before Execution |
Vim’s search command is much more useful when the incremental search feature is enabled. Here are a couple of ways that this option can improve your workflow.
By default, Vim sits idle as we prepare our search pattern, only springing into action when we press <CR>. My favorite enhancement is enabled with the ‘incsearch’ setting (see 'incsearch'ⓘ). This tells Vim to show a preview of the first match based on what has been entered so far into the search field. Each time we enter another character, Vim instantly updates the preview. This table illustrates how it works:
| Keystrokes | Buffer Contents | ||
|---|---|---|---|
| {start} |
| ||
/car |
| ||
/carr |
|