• 6TM
  • My links
  • Tags
  • pics
  • RSS
  • Login
Filter untagged links

vim search and replace using current line as reference point - Stack Overflowhttps://stackoverflow.com/questions/18020381/vim-search-and-replace-using-current-line-as-reference-point

  • Vim
  • TIL
  • Tip
  • OPS
  • Vim
  • TIL
  • Tip
  • OPS

You can use . for the current position, and .+10 for 10 lines down:

:.,.+10s/foo/bar/g

Some other useful ranges:

% for the whole file. Example: :%s/foo/bar/g.
'<,'> for the lines of visually selected block. This might get you more than you want of the visual selection starts or ends in the middle of a line. The whole line is included.
'a,'b from mark a to mark b.
.,$ from the current line to the end of the file.
Permalink
August 23, 2026 at 11:42:08 AM GMT+2
QRCode
archive.org
Shaarli 96 shaares · Shaarli · The personal, minimalist, super fast, database-free, bookmarking service by the Shaarli community · Documentation · Theme : Stack · Font : DINish
Fold Fold all Expand Expand all Are you sure you want to delete this link? Are you sure you want to delete this tag? The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community