Skip to content

Instantly share code, notes, and snippets.

@libo1106
Forked from prafulliu/vim批量替换
Last active August 29, 2015 14:19
Show Gist options
  • Save libo1106/a9d2fa56e3a41950bd68 to your computer and use it in GitHub Desktop.
Save libo1106/a9d2fa56e3a41950bd68 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment