How do I move my cursor into the preview window to interact with its contents?
<C-w>P
The preview window is a special auxiliary split — usually at the top — opened by commands like :ptag, :pedit, and omni-completion to display reference infor
Search Vim Tricks
Searching...<C-w>P
The preview window is a special auxiliary split — usually at the top — opened by commands like :ptag, :pedit, and omni-completion to display reference infor
:2match Todo /FIXME/
Vim provides three independent match slots — :match, :2match, and :3match — each of which highlights a pattern using a specified highlight group.
:noautocmd {command}
The :noautocmd prefix (abbreviated :noa) suppresses all autocommand events for the duration of the following command.
command-line #ex-commands #autocommands #performance #command-line #scripting
:set foldmethod=expr
Setting foldmethod=expr tells Vim to call the foldexpr expression for every line to compute its fold level.
{n}<C-w>>
All four window resize mappings accept an optional count prefix that multiplies the resize amount.
:set foldtext={expr}
The foldtext option controls what Vim displays for a closed fold.
<C-c>
exits insert mode immediately but silently skips two important side effects that (and its equivalent ) always trigger: abbreviation expansion and InsertLeave au
/pattern\c
Vim's \c and \C atoms let you override the global ignorecase and smartcase settings on a per-search basis.
vim.opt.option:append(value)
Neovim's vim.
[e and ]e
The [e and ]e mappings from Tim Pope's vim-unimpaired plugin exchange the current line (or a visual selection of lines) with the line above or below.
cs{from}{to}
The cs command from the vim-surround plugin lets you swap one type of surrounding delimiter for another in a single motion.
:set wildcharm=<Tab>
The wildcharm option designates a key that, when it appears inside a mapping, triggers wildmenu completion on the command line — just as if you had pressed in
:iabbrev {lhs} {rhs}
The :iabbrev command defines insert-mode abbreviations — short character sequences that automatically expand into longer text when you type a non-keyword char
zv
zv (view cursor) opens the minimum number of folds needed to make the current line visible — nothing more.
:let $VAR = "value"
Vim lets you read and write environment variables using the $VARIABLE syntax in Vimscript.
:g/pattern/+1d
Using :g/pattern/+1d you can delete the line that comes right after each line matching a pattern, in one pass.
:%s/\v(\w+)/\u\1/g
Vim's substitute command supports case-modifier escapes in the replacement string: \u uppercases the next character, \U uppercases all text until \E or end of r
: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.
:Gclog
Running :Gclog in vim-fugitive loads the git log for the current file into the quickfix list.
5:
Typing a count before : in normal mode automatically fills in a line range in the command line.
command-line #command-line #ex-commands #ranges #normal-mode