A small Vim plugin for cycling through the search history.
After performing a search with / or ?, use [/ and ]/ to step backwards
and forwards through previous search patterns. The current search register
(@/) is updated as you cycle, so n and N immediately use the selected
pattern.
Use your preferred plugin manager, or copy plugin/cycle_search.vim into
~/.vim/plugin/ (or ~/.config/nvim/plugin/ for Neovim).
With vim-plug:
Plug 'Serpent7776/vim-cycle-search'| Mapping | Action |
|---|---|
[/ |
Cycle to the previous search |
]/ |
Cycle to the next search |
The default mappings are only set if [/ and ]/ are not already mapped.
To define your own, map to the <Plug> targets:
nmap <silent> <leader>p <Plug>(CycleSearchPrev)
nmap <silent> <leader>n <Plug>(CycleSearchNext)To disable the default mappings entirely, set the following before the plugin loads:
let g:cycle_search_no_default_mappings = 1MIT