RS
Snippets
HomeSnippetsQuery BuilderDocumentation
Welcome to Snippets
Find and replace all occurrences in Neovim
Keybindings remap
Replace all without overwriting current clipboard
Total Posts

0

Total Commits

0

(v1: 0, v2: 0)
Total Deployments

0

Latest commit:Unable to fetch commit info
9/17/2025
Latest deployment:
pending
9/17/2025
v2
Started 9/17/2025

Built by Remco Stoeten with a little ❤️

Configs/Neovim

Find and replace all occurrences in Neovim

Find and Replace in Neovim

Enter text to find to generate commands

Basic command:

:%s/old_string/new_string/gc

Explanation

  • :%s - command to substitute in the entire file.
  • old_string - the text you want to find.
  • new_string - the text you want to replace with.
  • g - global flag to replace all occurrences in each line.
  • c - confirm flag to ask for confirmation before each replacement.

Without confirmation

You can omit the 'c' if you want to replace all without confirmation:

:%s/old_string/new_string/g

Visual selection

To replace only in a selected visual block, select text in visual mode and then use:

:'<,'>s/old_string/new_string/gc

Explanation of the vim breakdown

  • :'<,'> - this is the range of the command. In this case, it's the visual selection.
  • s - the substitute command.
  • old_string - the text you want to find.
  • new_string - the text you want to replace with.
  • g - global flag to replace all occurrences in each line within the selection.
  • c - confirm flag to ask for confirmation before each replacement.

Git Set Upstream

When working on a new repository and you want to create a new branch it'll prompt you to set the upstream branch.

Keybindings remap

Some rebinds I use to make me feel more at home in neovim.

On this page

Find and Replace in NeovimBasic command:ExplanationWithout confirmationVisual selectionExplanation of the vim breakdown
Sep 17, 2025
4 min read
631 words