How do I run commands without polluting the jump list?
:keepjumps
When writing scripts or running commands that move the cursor (like :g, :s, or :normal), Vim normally adds each cursor position to the jump list.
2277 results for "@a"
:keepjumps
When writing scripts or running commands that move the cursor (like :g, :s, or :normal), Vim normally adds each cursor position to the jump list.
'0
Pressing '0 in normal mode jumps to the exact cursor position in the most recently edited file, even after closing and reopening Vim.
nzz
Typing nzz chains two normal-mode commands: n jumps to the next match of the last search, and zz immediately redraws the screen so the cursor line is vertically
:drop {file}
When the same file is already open elsewhere, using :edit can create extra navigation friction because you stay in the current window and may lose layout contex
buffers-windows #buffers-windows #windows #buffers #workflow
:let $VAR = "value"
Vim lets you read and write environment variables using the $VARIABLE syntax in Vimscript.
:syntime on
When Vim feels sluggish while editing files with complex syntax highlighting, :syntime lets you profile exactly which syntax rules are consuming the most time.
gU{motion} / gu{motion} / g~{motion}
Vim has three case operators that work with any motion or text object: gU for uppercase, gu for lowercase, and g~ for toggle case.
editing #editing #case #operators #text-objects #normal-mode
<C-t> / <C-d>
While in Insert mode, you can adjust indentation without switching back to Normal mode.
:set formatprg={program}
Vim's gq operator normally reflows text to fit textwidth, but by setting formatprg you can delegate formatting to any external tool — a language formatter, a
<C-y>
The command scrolls the window up one line at a time while keeping the cursor position fixed.
gn
The gn motion searches forward for the next match of the last search pattern and visually selects it.
search #navigation #search #motions #normal-mode #repeat #editing
V%
Pressing V% enters visual line mode on the current line and immediately extends the selection to the line containing the matching bracket or brace.
]m
The ]m command jumps to the start of the next method in Java-style code.
Plug 'tpope/vim-repeat'
vim-repeat by Tim Pope extends the .
:compiler gcc | :make
Vim ships with built-in compiler plugins that configure makeprg and errorformat for popular tools.
gv
The gv command reselects the exact same area that was last selected in visual mode.
:set cursorlineopt=number
When cursorline is enabled, Vim highlights the entire line the cursor is on.
g]
g] is the disambiguation-aware alternative to .
:set diffopt+=linematch:60
Neovim's linematch diffopt enables intra-line diff highlighting — instead of marking an entire changed line, Neovim highlights only the specific characters th
`[ and `]
The ` [ ` and ] ` marks automatically track the boundaries of the last changed or yanked text.