vim命令备忘
yx_wh
posted @ 2014年1月14日 14:10
in 未分类
, 791 阅读
先在shell中 gvim *.txt再
:silent! argdo! set fileencoding=utf-8 | update
但是反过来都转cp936,可能就不行。
在未删奇数行的前提下批量替换偶数行的内容。
execute "normal G"
let total_line=line(".")
"get the last line number
execute "normal gg"
for a in range(total_line/2)
normal j
"s/、/,/ge
s/みっちゃん/小美/ge
s/みっちゃん/小美/ge
s/美絵ちゃん/小美绘/ge
s/美絵/美绘/ge
s/\(.*\)」/\1/ge
s/\(「.*\)/\1」/ge
"first delete the last 」 if there exists one, then add 」 at the end if there is a 「 at first.
"this is OK for most lines except those like this
"「XXXXX
"XXXXX
"XXXXXX」
normal j
endfor
"back to the 1st line and replace even lines(which contain chinese)