命令:1,$s/word1/word2/gc 解释:从第一列到最后一列寻找 word1 字符串,并将该字符串取代为 word2 !且在取代前显示提示字符给用户确认 (confirm) 是否需要取代! 这是会出现选项,选项解释如下: Vim:replace with foobar (y/n/a/q/l/ ^E /^Y)?<—这里是解析来源 y:to substitute this match(替换光标所在的匹配项) n:to skip this match(跳过当前匹配项) a:to substitute this and all remaining matches(替换光标所在并替换所有剩余匹配项) q:to quit the command(退出这个命令) l:to substitute this match and quit (think of “last”)(匹配光标所在的匹配项并退出) ^E:to scroll the screen up by holding the Ctrl key and pressing E ^Y:to scroll the screen down by holding the Ctrl key and pressing Y However, the last two choices are only available, if your Vim is a normal, big or huge built or the insert_expand feature was enabled at compile time.