h1

Case sensitive find and replace in VIM

February 10, 2011

Had trouble finding this for some reason. Normal find and replace in my vim is case insenstive though must totorials I found claim it to be sensetive by default. The following will replace all case instances of book (i.e. Book and BOOK will be replaced by session as well):

:%s/book/session/g

If I only want to replace book, I need to use a capital I option like this:

:%s/book/session/gI

Another useful option is c, which asks you to confirm every instance it finds before replacing it.

:%s/book/session/gcI

Advertisements

One comment

  1. thanks for this



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: