Thursday, February 24, 2011

Thursday

Today I learn a command for vim which is how to substitute a word for another word.

g/old_word/s//new_word/g

when you are editing a file and you have several words and they are the same and you don't want to change one by one this command is helpful. The (g) in the command above is (global) and the (s) is for (substitute) and the other (g) is to tell that you want to change that word all over the file you are editing.

1 comment:

  1. Nice post! That is indeed a useful command to know in vim.

    ReplyDelete