How do I jump to the top of a file without creating a new jumplist entry?
:keepjumps normal! gg
Sometimes you need to make a quick structural move (for example, jump to top, inspect context, then return) without polluting jump navigation history.
Search Vim Tricks
Searching...:keepjumps normal! gg
Sometimes you need to make a quick structural move (for example, jump to top, inspect context, then return) without polluting jump navigation history.
:<C-f>
Long Ex commands are easy to mistype when you edit inline on a single command line.
:lvimgrep /{pattern}/j ## | lopen
When you need to run focused searches across a curated set of files, the argument list is a strong scope boundary.
"=system('git rev-parse --short HEAD')->trim()<CR>p
If you frequently write commit references in notes, code comments, or release docs, you can avoid shell context switches and paste the hash straight from Vim.
:%s/\d\+/\=printf('%04d', submatch(0))/g
When you need fixed-width numeric fields, manually editing each number is slow and error-prone.
:packadd termdebug | Termdebug
For quick debugging without leaving Vim, the built-in termdebug plugin wires a GDB session directly into your editing workflow.
:setlocal winfixwidth
When you use a sidebar-style split for file trees, docs, or logs, automatic window equalization can constantly resize it.
:set jumpoptions=stack,view
By default, jump navigation can feel lossy in long files: you jump back, but folds, topline, and viewport context do not always match what you were looking at b
nzzzv
When you are stepping through many matches, plain n often lands with poor context and can hide the match inside a closed fold.
:cexpr system('rg --vimgrep "TODO"')
When you already know you want an external search tool, :cexpr lets you import results directly into quickfix without opening a terminal buffer or shelling out
:s/\v\d+/\=printf('%04d', submatch(0))/g
Substitution expressions let Vim compute each replacement dynamically, which is ideal when plain capture groups are too limited.
:set switchbuf=useopen,usetab,newtab
When jump commands open files (:tag, quickfix navigation, location list jumps), Vim may split your layout in ways that break flow.
:let @a .= getline('.') . "\n"
Named registers are usually filled with yanks and deletes, but they are also plain variables you can edit with Vimscript.
:lvimgrep /pattern/j %
When you want a searchable list of matches without leaving your current editing context, :lvimgrep is a strong alternative to regular / navigation.
:'<,'>s/\%V./\U&/g
When you need to transform text in-place without touching surrounding content, \%V is one of Vim's most precise tools.
:botright copen 8 | wincmd p
Quickfix is powerful, but opening it can disrupt window layout and yank focus away from your current editing context.
:set grepprg=rg\ --vimgrep\ --smart-case\ --hidden\ --glob\ !.git
Vim's :grep becomes much more useful when grepprg is tuned for ripgrep and quickfix-compatible output.
:%s/\V<C-r>//gc
When your last search pattern contains punctuation, slashes, or regex atoms, retyping it inside :substitute is error-prone.
:Lexplore %:p:h
When you are editing deep in a project, opening netrw from the working directory often puts you in the wrong place.
:'<,'>s/^/\=line('.')-line("'<")+1 . '. '/
When you need quick numbered steps, logs, or checklist entries, this pattern adds numbers only to the lines you selected, not the whole buffer.