How do I write a search pattern that requires two conditions to match at the same position in Vim?
\&
Vim's \& operator is the AND combinator in a search pattern.
Search Vim Tricks
Searching...\&
Vim's \& operator is the AND combinator in a search pattern.
:e!
:e! forces Vim to reload the current file from disk, discarding every unsaved change in the buffer.
buffers-windows #buffers-windows #editing #undo-redo #ex-commands
:set nrformats
The nrformats option tells Vim how to interpret numbers when you press (increment) or (decrement).
:sview {file}
The :sview command opens a file in a horizontal split window with the buffer set to read-only.
buffers-windows #buffers-windows #windows #navigation #ex-commands
:set tags+=./tags;,tags
By default, Vim only looks for a tags file in the current directory.
autocmd BufNewFile *.py 0r ~/.vim/templates/python.py
When you create a new file in Vim (e.
:set define=^\\s*def
Vim's [d, ]d, [D, and ]D commands search for the "definition" of the keyword under the cursor.
:set commentstring=//\ %s
The commentstring option controls the template Vim uses to represent commented-out lines.
:tjump {name}
Vim's :tjump is the smarter sibling of :tag and :tselect.
:set statuscolumn=%s%=%l\
Neovim 0.
config #config #neovim #statusline #line-numbers #formatting
vim.diagnostic.goto_next()
Neovim's built-in vim.
vim.lsp.buf.format()
Neovim's built-in LSP client exposes vim.
\zs and \ze in a pattern
Vim's \zs ("match start") and \ze ("match end") atoms let you narrow the actual match region within a broader pattern context.
has('feature')
The has('feature') function returns 1 if the specified feature is available in the current Vim/Neovim instance, 0 otherwise.
\C in search pattern
Adding \C anywhere in a search pattern forces case-sensitive matching for that search, overriding the global ignorecase setting.
+ and -
The + and - motions jump to the first non-blank character of the next or previous line respectively — combining vertical movement and ^ into a single, count-a
gr{char}
The gr{char} command is Vim's virtual replace variant of r{char}.
:g/^/t.
The command :g/^/t.
<C-x><C-d>
in insert mode triggers defined identifier completion — it searches for identifiers that match the partial word before the cursor by scanning #define statemen
[<C-d>
Vim's [ command jumps to the first definition of the macro or identifier under the cursor, searching from the beginning of the current file and through any file