Alternate vim search replace syntax

Mar 11, 2024

I recently came across an alternate syntax for n/vim’s search and replace syntax of s/meow/woof/g which is s#meow#woof#g - found on this post. Basically replacing the / with #. Never seen that before in all the years of using vim, so just thought I’d share!

I’ve lately been on somewhat of an ergonomic-esque modifying kick where I’m trying to minimize hand motion when typing. This was after I noticed how much my right hand was moving to hit backspace or even return. I ended up remapping Tab to Backspace and cmd-j to return. I’ll probably do a full blog post on that after my mappings have settled down, but I’m liking them a lot so far. Definitely less wrist wear. This search and replace syntax seems to work in that vein since it seems like # is more accessible than /.

But like with most things we’ll give it some time and see how it works out. God bless!


← Back ← Go to all posts