Posts | About

Vim Search Must-Haves | 5 Things Everyone Should Know

vimcheat-sheetsvideo

Posted on 2024-07-26 by Matt.

Cheat Sheet

Neovim User Manual - Search Commands And Patterns

Search for word under cursor

*

Jump to next, prev search

n
N

Put word under cursor into search command (or other command)

:<C-r><C-w>

Substitue last search with something_else

s//something_else

incsearch or :h incsearch. Incrementally show where the pattern matches in the buffer

" vimscript
set incsearch
-- lua
vim.go.incsearch = true

hlsearch or :h hlsearch. Highlight all matches when there is a search pattern.

" vimscript
set hlsearch
-- lua
vim.go.hlsearch = true

Clear those highlighted searches when you are tired of looking at them

<C-l>

Cycle through previous searches

/ <C-p>
/ Up
/ <C-n>
/ Down

Open command-line window with search history

:/