Reuse a complex search pattern
q/
Example
Normal mode. Most recent search: status=failed. Buffer contains status=pending.
Before
Search history: status=failed
Wanted match: status=pending
- q/ Search history opens · cursor on the final blank row
- k$ciwpending<Esc> Select the previous search and edit it · status=pending
- <CR> Jump to status=pending · buffer unchanged
After
Search run: status=pending
Cursor: at a matching location
Buffer text: unchanged
Details & Vim help
Open forward-search history in an editable window.
Refine a complex pattern without rebuilding it at the search prompt.
q? opens backward-search history. The search window is unavailable while recording a macro, and search options still affect the selected pattern.
Editing a search changes what you look for; it does not replace buffer text.
Try it in Vim
- Type q/ in Normal mode.
- Find a previous pattern and edit its line.
- Press <CR> to search with that line; close with :q<CR> to cancel.