vi,在command line 模式 :%s/$/ abc/ abc为要添加的字符串 :%s/$/ abc/gc 逐行添加,c表示确认是否添加 更详细可见 http://vim.wikia.com/wiki/Search_and_replace The :substitute command searches for a text pattern, and replaces it with a text string. There are many options, but these are what you probably want: :%s/foo/bar/g Find each occurrence of 'foo', and replace it with 'bar'. :%s/foo/bar/gc Change each 'foo' to 'bar', but ask for confirmation first. :%s/\<foo\>/bar/gc Change only whole words exactly matching 'foo' to 'bar'; ask for confirmation. :%s/foo/bar/gci Change each 'foo' (case insensitive) to 'bar'; ask for confirmation. This may be wanted after using :set noignorecase to make searches case sensitive (the default). :%s/foo/bar/gcI Change each 'foo' (case sensitive) to 'bar'; ask for confirmation. This may be wanted after using :set ignorecase to make searches case insensitive. The g flag means global – each occurrence in the line is changed, rather than just the first. |