How do I make Vim match only part of a larger regex using \zs and \ze?
/\vfoo\zsbar\zebaz
When you need to target only a slice of a larger pattern, \zs and \ze are usually cleaner than building lookarounds.
2125 results for "i( a("
/\vfoo\zsbar\zebaz
When you need to target only a slice of a larger pattern, \zs and \ze are usually cleaner than building lookarounds.
"Ay{motion}
Using an uppercase register letter with any operator appends to the register instead of replacing it.
:set laststatus=3
Neovim 0.
:cexpr system('command')
The :cexpr command parses any expression into the quickfix list using the current errorformat.
:botright split
When you split a window with :split or :vsplit, Vim subdivides only the current window.
buffers-windows #buffers #windows #ex-commands #command-line
<C-x><C-t>
Vim's insert-mode completion includes a thesaurus mode triggered by .
das
Vim defines a sentence as text ending with .
editing #editing #text-objects #delete #normal-mode #motions
:set iskeyword+={char}
iskeyword defines which characters are considered word characters in Vim.
ysst
vim-surround's ysst sequence lets you wrap a text object with an arbitrary HTML or XML tag and prompts you to type the tag name.
:w !cmd
The :w !cmd command sends the buffer's contents as standard input to an external command without modifying the buffer.
:call setreg('q', keys, 'c')
The setreg() function writes any string directly into a named register, letting you construct macro keystrokes from Vimscript expressions rather than live recor
:g/start/,/end/d
The :g (global) command can operate on ranges, not just single lines.
/pattern\C
Appending \C anywhere in a search pattern forces the entire search to be case-sensitive, regardless of whether ignorecase or smartcase is set.
search #search #case-sensitive #ignorecase #smartcase #normal-mode
:windo setlocal colorcolumn=+1
When a setting is window-local, changing it once does not affect your other splits.
:execute 'vimgrep /' . @/ . '/gj **/*'
If you already refined a search interactively with / or ?, retyping that pattern for project-wide grep is repetitive and error-prone.
:let @q = 'commands'
Macros in Vim are just text stored in named registers.
va"
Vim's text objects let you select structured regions of text with two-keystroke shortcuts.
:[range]join
The :[range]join Ex command lets you join lines by specifying an explicit line range — without having to navigate there or use visual selection.
:set path+=** | :find
By adding to Vim's path option and using :find, you can search for any file recursively through your project tree with tab completion — no plugins required.
:keeppatterns %s/old/new/g
The :keeppatterns modifier runs any Ex command without modifying Vim's last search pattern (stored in @/).
command-line #search #ex-commands #command-line #substitute #registers