How do I run a :g or :s command without overwriting my current search pattern?
:keeppatterns {cmd}
Whenever Vim runs a command that involves searching — :g, :s, :v, or even moving the cursor with / — it overwrites the last search register (@/).
287 results for ":jumps"
:keeppatterns {cmd}
Whenever Vim runs a command that involves searching — :g, :s, :v, or even moving the cursor with / — it overwrites the last search register (@/).
nzzzv
When you are stepping through many matches, plain n often lands with poor context and can hide the match inside a closed fold.
:filter /{pattern}/ history cmd
When command history gets crowded, scanning :history cmd manually is slow.
v%
How it works The % motion jumps to the matching bracket, parenthesis, or brace.
:Man {name}
Neovim ships with a built-in :Man command (the man.
command-line #neovim #navigation #documentation #command-line
[/ and ]/
Vim provides two motions for navigating C-style block comments (/ .
:keeppattern s/old/new/g
When you run a :s or :g command, Vim updates the search register (@/) with the pattern you used.
:keepalt edit {file}<CR>
The alternate-file mark (#) powers fast toggles like and commands that depend on the previous file context.
command-line #command-line #buffers #workflow #navigation #advanced
G
The G command moves the cursor to the last line of the file.
[d
The [d command searches from the beginning of the file for the first line matching the define pattern for the word under the cursor, and displays it in the stat
w
The w command moves the cursor forward to the beginning of the next word.
: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.
>%
Vim's > operator (indent) works with any motion or text object — including %, which jumps to the bracket, parenthesis, or brace matching the one under the cur
editing #editing #indentation #text-objects #normal-mode #motions
:vimgrep /{pattern}/j **/*
For project-wide searches, :vimgrep is powerful but can feel disruptive if it jumps into files while populating quickfix.
:tab sbuffer
Sometimes you want a second workspace for the same file: one tab for broad navigation, another for focused edits or test-driven jumps.
buffers-windows #buffers-windows #tabs #workflow #navigation
:keeppattern %s/old/new/g
When you run a :s or :%s substitute command, Vim updates the search register (@/) with the substitution pattern.
command-line #ex-commands #search #editing #registers #substitute
:set splitkeep=screen
Controls how Neovim preserves the visual position of content when creating, closing, or resizing horizontal splits.
:cdo s/old/new/ | update
:cdo {cmd} executes a command at every entry in the quickfix list, visiting each location in turn.
:set nowrapscan
By default Vim's wrapscan option is enabled, which causes / and ? searches to wrap silently from the end of the file back to the beginning (and vice versa).