How do I use normal regex syntax in Vim search without escaping everything?
/\v
Vim's default regex syntax requires backslashes before most special characters like +, (, ), {, and , which is the opposite of what most developers expect from
414 results for "G"
/\v
Vim's default regex syntax requires backslashes before most special characters like +, (, ), {, and , which is the opposite of what most developers expect from
:oldfiles
:oldfiles displays a numbered list of every file Vim has recorded in its viminfo (or shada in Neovim) file.
gj
The gj command moves the cursor down by one display line rather than one physical line.
:argdo %s/old/new/g | update
The :argdo command runs an Ex command on every file in the argument list (the files you opened Vim with, or added via :argadd).
/\zs and \ze
The \zs and \ze atoms let you define where the actual match starts and ends within a larger pattern.
\d \w \s \a \l \u
How it works Vim provides shorthand character classes that save you from writing out full bracket expressions.
!{motion}{program}
The ! operator in normal mode lets you pipe a range of text through any external program and replace it with the output.
qa/pattern<CR>dd@aq
By starting a macro with a search command, the macro becomes conditional — it jumps to the next match before acting, and terminates when no more matches are f
gj / gk
When a long line wraps across multiple screen rows, the regular j and k motions skip the entire logical line.
:echo strtrans(@q)
When a macro behaves unexpectedly, :echo strtrans(@q) reveals exactly what is stored in register q—including invisible control characters—as human-readable
/\cfoo
Vim's \c and \C flags let you force a search to be case-insensitive or case-sensitive on a per-search basis, regardless of your ignorecase and smartcase setting
: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
cs'"
The vim-surround plugin (by Tim Pope) adds three powerful operators for working with surrounding delimiters — quotes, brackets, parentheses, and HTML tags.
#
The # command searches backward for the exact word under the cursor, jumping to the previous occurrence.
:'<,'>normal A;
The :normal command executes normal-mode keystrokes on every line in a range.
command-line #command-line #ex-commands #editing #normal-mode #batch-editing
!sort
Vim can pipe a visual selection through any shell command and replace the selection with the command's output.
visual-mode #visual-mode #ex-commands #external-commands #filtering
/pattern\zs.*\ze/
Vim's \zs (start of match) and \ze (end of match) atoms let you define a search pattern but only highlight or operate on a portion of it.
:cdo
:cdo {cmd} executes {cmd} on each entry in the quickfix list — one by one, jumping to each location in turn.
command-line #ex-commands #quickfix #search #editing #buffers
:s/pattern/\=expr/
Prefixing the replacement field of :s with \= makes Vim evaluate the rest as a Vimscript expression and use the result as the replacement string.
<C-r>/
Vim stores your last search pattern in the / register.