vim替换的问题
发表于 : 2012-09-29 10:26
替换的标准格式是
:[range]s[ubstitute]/{pattern}/{string}/[flags] [count]
下面的可以删除行尾的空白
You can use the ":substitute" command on the entire file to search and
remove all the trailing white space characters: >
:%s/\s\+$//
\s\+$对应上面的{pattern}
:%s/\s\+$/ 后面我们认为什么都没有,也就是说把空白替换为空
但最后一个/是什么意思?
从格式上来说后面应该跟一个flags
但是后面却什么都没有
而且
:%s/\s\+$// 和
:%s/\s\+$/
效果是一样的
:[range]s[ubstitute]/{pattern}/{string}/[flags] [count]
下面的可以删除行尾的空白
You can use the ":substitute" command on the entire file to search and
remove all the trailing white space characters: >
:%s/\s\+$//
\s\+$对应上面的{pattern}
:%s/\s\+$/ 后面我们认为什么都没有,也就是说把空白替换为空
但最后一个/是什么意思?
从格式上来说后面应该跟一个flags
但是后面却什么都没有
而且
:%s/\s\+$// 和
:%s/\s\+$/
效果是一样的