How do I jump between folds in Vim without opening them?
zj and zk
How it works When working with folded code in Vim, you often want to skip from one fold to another without unfolding anything.
1024 results for "i" a""
zj and zk
How it works When working with folded code in Vim, you often want to skip from one fold to another without unfolding anything.
". / "% / ": / "# registers
Vim has four read-only special registers that automatically contain useful contextual information.
registers #registers #special-registers #workflow #productivity
/\(function\s\+\)\zs\w\+
Vim's \zs and \ze atoms let you control which part of a matched pattern gets highlighted and operated on.
:Lazy
lazy.
(
The ( motion moves the cursor backward to the start of the current or previous sentence.
\u and \l in :s replacement
Vim's substitute command supports special case modifiers in the replacement string that let you change the case of captured text on the fly.
:set hlsearch
The hlsearch option highlights all matches of the current search pattern throughout the file, making it easy to see where matches occur.
<Leader>hs / <Leader>hu
The vim-gitgutter plugin shows Git diff markers in the sign column and provides powerful commands to stage, undo, and preview individual hunks directly from Vim
gd
The gd command jumps to the local definition of the word under the cursor.
:colder / :cnewer
Vim remembers up to 10 previous quickfix lists.
/{pattern}
The / command initiates a forward search in the file.
:set nobackup noswapfile
Disabling backup and swap files prevents Vim from creating extra files alongside your source code.
<C-w>z or :pclose
The preview window shows file contents temporarily without switching your editing context.
buffers-windows #buffers-windows #quickfix #preview #navigation
"+y
The "+y command yanks (copies) text into the system clipboard register, making it available to paste in other applications outside of Vim.
\v
Vim's default regex mode ("magic") requires backslashes before many special characters: \(, \ , \+, \{.
:%!python3 -m json.tool
The :%! command pipes the entire buffer through an external command and replaces it with the output.
command-line #command-line #shell #formatting #json #workflow
p
The p command pastes (puts) the contents of the default register after the cursor.
:set statusline=%f\ %m%r%h%w\ %=%l/%L\ %p%%
Vim's statusline option accepts printf-style format codes that display file info, position, mode, and any custom expression.
{
The { motion moves the cursor backward to the previous blank line, jumping to the beginning of the current or previous paragraph.
:%s/\V literal.text/replacement/g
The \V (very nomagic) flag treats all characters as literal except for \.