Category Archives: Vim

Vim Tricks

To replace a block of text into String in vim, try the following commands:

:%s/\n/\n” +\r”/gc

To replace specific string into another in lots of files, e.g. replace *.java’s package name “net.sf.j2s.” into another name “org.java2script.”, follow the instructions:

  1. Select all the *.java in Explorer, and open them with single vim
  2. :map <F9> :%s/net\.sf\.j2s\./org\.java2script\./g<CR>:w<CR>:n<CR>
  3. Press <F9> many times as the count of *.java files

This tricks can also be used in similar tasks.

Posted in Tricks, Vim | Comments Off on Vim Tricks