Total Posts

0

Total Commits

0

(v1: 0, v2: 0)
Total Deployments

0

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

Built by Remco Stoeten with a little ❤️

Welcome to Snippets
Find and replace all occurrences in Neovim
Keybindings remap
Replace all without overwriting current clipboard
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.

Disable Sudo Password Prompts on macOS

Previous Page

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 2, 2025
3 min read
510 words