How do I search for text in Vim?
/pattern
The /pattern command searches forward through the file for the given pattern.
181 results for "n N"
/pattern
The /pattern command searches forward through the file for the given pattern.
?{pattern}
The ? command searches backward from the cursor position.
:term then <C-w>N for normal mode
Vim 8+ and Neovim have a built-in terminal emulator that runs inside a buffer.
command-line #command-line #terminal #workflow #productivity
/{pattern}
The / command initiates a forward search in the file.
{N}|
The command (pipe character) moves the cursor to a specific column number on the current line.
:keeppattern %s/pattern/replacement/g
When you run a :substitute command, Vim updates the search register (@/) with the substitute pattern, which changes your hlsearch highlighting and affects n/N n
/pattern\{-}
The \{-} quantifier in Vim regex matches as few characters as possible, unlike which matches as many as possible (greedy).
:%s/pattern//gn
The n flag on the substitute command makes it report the match count without actually performing any replacement.
:{start},{end} command
Ex commands accept range specifiers that control which lines are affected.
:let @a = @a . @b
You can manipulate register contents directly using the :let command with the @{reg} syntax.
:cnext and :cprev
The quickfix list holds a set of file positions, typically from compiler errors, grep results, or other tools.
:%s/old/new/gc
Adding the c flag to a substitute command makes Vim pause at every match and ask you whether to replace it.
:'<,'>sort
The :'sort command sorts the currently selected lines in visual mode alphabetically.
:verbose map <key> or :verbose set option?
The :verbose prefix shows where a mapping, setting, command, or function was defined — which file and line number.
command-line #command-line #debugging #config #mappings #workflow
qavip:sort\n}jq
Record a macro that visually selects the inner paragraph, sorts its lines, then moves to the next paragraph.
:sort /regex/
The :sort /pattern/ command sorts lines by the text that appears after the first match of a pattern, not from the start of each line.
:s/pattern/replace/flags
The substitute command supports several flags that modify its behavior.
set statusline=%{MyCustomFunc()}
How it works Vim's statusline supports the %{expr} syntax which evaluates a Vimscript expression and displays the result.
:set pumheight=10
By default, Vim's completion popup menu (the PUM — Pop-Up Menu) can expand to fill the entire screen if there are many candidates.
qa{jI## Section \n<Esc>}q
Record a macro that goes to the start of each paragraph and inserts a section header.