How do I run a full-buffer substitution without disturbing marks, jumplist, or search history?
:lockmarks keepjumps keeppatterns %s/foo/bar/ge
Large substitutions are efficient, but they often leave side effects: your last search changes, your jumplist gets noisy, and marks can shift in ways that break
category:
command-line
tags:
#command-line
#editing
#substitution
#navigation
How do I search for yanked text literally in Vim without escaping regex characters?
When your yanked text includes regex symbols like .
category:
search
tags:
#search
#registers
#command-line
#regex
How do I make Vim transparently edit .gz files using built-in tooling?
Compressed logs and artifacts often appear in debugging workflows, and repeatedly shelling out to decompress and recompress wastes time.
category:
plugins
tags:
#plugins
#files
#command-line
#workflow
How do I copy a named register into the system clipboard without yanking again?
If you already have carefully collected text in a named register, re-yanking just to reach the system clipboard is noisy and error-prone.
category:
registers
tags:
#registers
#clipboard
#command-line
#workflow
How do I launch GDB inside Vim using the built-in termdebug plugin without preloading it?
:packadd termdebug | Termdebug ./a.out
If you only debug occasionally, loading termdebug on demand keeps startup lean while still giving you an in-editor GDB workflow.
category:
plugins
tags:
#plugins
#debugging
#command-line
#workflow
How do I sort only a visual selection using a fixed virtual column as the key?
When lines contain aligned columns, plain :sort often gives the wrong order because it compares from column 1.
category:
visual-mode
tags:
#visual-mode
#sorting
#text-processing
#command-line
How do I run an interactive replacement across quickfix entries and only save changed files?
:cdo keeppatterns s/\<foo\>/bar/gec | update
When quickfix already contains precise targets, :cdo gives you a safer multi-file replace loop than broad project substitutions.
category:
command-line
tags:
#command-line
#quickfix
#substitute
#refactoring
How do I run a literal project-wide vimgrep for the word under my cursor?
:vimgrep /\V<C-r><C-w>/gj **/*
When you need a project-wide search for the exact word under your cursor, this pattern avoids regex surprises and immediately populates quickfix.
category:
search
tags:
#search
#quickfix
#command-line
#project-workflow
How do I run a Normal-mode command through :execute in Vim?
:execute "normal! gg=G"<CR>
:execute lets you build and run Ex commands dynamically, which is critical when a command depends on variables, conditionals, or string composition.
category:
command-line
tags:
#command-line
#ex-commands
#normal-mode
#automation
How do I list only search-pattern history entries in Vim?
Power users tend to run long, composable searches during refactors, but the default / and ? history navigation can be noisy when command history and search hist
category:
command-line
tags:
#command-line
#search
#history
#regex
How do I execute Ex commands stored in a register instead of replaying it as normal-mode keys?
Most macro workflows focus on @q, which replays register q as normal-mode keystrokes.
category:
macros
tags:
#macros
#command-line
#automation
#registers
How do I stop Vim sessions from changing my working directory when restored?
:set sessionoptions-=curdir
When you restore a session with :source Session.
category:
config
tags:
#config
#sessions
#working-directory
#command-line
How do I quickly filter a quickfix list using Vim's built-in cfilter plugin?
:packadd cfilter | Cfilter /pattern/
Large quickfix lists are hard to work with when you only care about one subset of matches.
category:
plugins
tags:
#plugins
#command-line
#search
#buffers
How do I force magic regex mode for one substitute command in Vim?
If you prefer very-magic regex syntax but don't want to change global settings, :smagic is a targeted solution.
category:
command-line
tags:
#command-line
#search
#ex-commands
#regex
How do I execute a command without changing '[ and '] marks in Vim?
Many batch edits in Vim update special marks like '[ and '], which can disrupt follow-up motions or tooling that depends on those positions.
category:
navigation
tags:
#navigation
#marks
#command-line
#refactoring
#editing
How do I enable :Cfilter and :Lfilter commands without a plugin manager?
Vim ships with useful optional runtime plugins that many users never load.
category:
plugins
tags:
#plugins
#quickfix
#location-list
#search
#command-line
How do I store the current file path in a named Vim register?
Named registers are not only for yanked text.
category:
registers
tags:
#registers
#command-line
#filename-modifiers
#editing
How do I insert a shell-escaped current file path in a Vim command-line?
When you build shell commands from Vim, file paths with spaces or special characters can break the command unless properly escaped.
category:
command-line
tags:
#command-line
#filename-modifiers
#shell
#expansion
How do I toggle whether / and ? searches wrap around the file?
wrapscan controls what happens when a / or ? search reaches the end (or beginning) of the file.
category:
search
tags:
#search
#options
#command-line
#navigation
How do I remove duplicate entries from the Vim arglist after adding files multiple times?
If you build an arglist incrementally (:args, :argadd, glob expansions), duplicates can sneak in and make :argdo workflows slower or confusing.
category:
command-line
tags:
#command-line
#arglist
#batch-editing
#workflow