Skip to content

Instantly share code, notes, and snippets.

@prafulliu
Created January 4, 2012 09:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save prafulliu/1559380 to your computer and use it in GitHub Desktop.
Save prafulliu/1559380 to your computer and use it in GitHub Desktop.
vim批量替换
http://hi.baidu.com/zhmsong/blog/item/7cb17eeaddca8adad539c977.html
:s/XXX/YYY/g
其中XXX是需要替换的字符串,YYY是替换后的字符串
以上这句只对当前行进行替换,如果需要进行全局替换,则要:
%s/XXX/YYY/g
如果需要对指定部分进行替换,可以用V进入visual模式,再进行
:s/XXX/YYY/g
或者可以指定行数对指定范围进行替换:
:100, 102s/XXX/YYY/g
@notfresh
Copy link

notfresh commented May 1, 2018

感谢

@nanmuyao
Copy link

nanmuyao commented Jul 5, 2018

ganxie

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment