Today I Learned

hashrocket A Hashrocket project

Replace text in VIM and keep the case

If you use the vim plugin vim-abolish you can replace some text keeping the original case. You just need to use S instead of s in find/replace vim command.

In order to change foo to bar and keep the case use:

:%S/foo/bar/gi

This will apply the following changes:

FOO => BAR
foo => bar
Foo => Bar
See More #vim TILs
Every developer at Hashrocket is a Vim expert. Check out our development environment, Dotmatrix, and if you are in Chicago, come to the Vim Chicago Meetup hosted at our Chicago office.