问题描述
在Vim中,s
和c
有什么区别?如果我用n个字母或单词代替,更改它们有什么区别吗?并且在任何情况下替代和变更都不同吗?
解决方法
如有疑问,请检查:help
:
:help s
*s*
["x]s Delete [count] characters [into register x] and start
insert (s stands for Substitute). Synonym for "cl"
(not |linewise|).
:help c
*c*
["x]c{motion} Delete {motion} text [into register x] and start
insert. When 'cpoptions' includes the 'E' flag and
there is no text to delete (e.g.,with "cTx" when the
cursor is just after an 'x'),an error occurs and
insert mode does not start (this is Vi compatible).
When 'cpoptions' does not include the 'E' flag,the
"c" command always starts insert mode,even if there
is no text to delete.
TL; DR::c
进行正常移动(如cw
来更改您所使用的单词),以确定在输入插入内容之前要删除多少文本。 s
用一个数字(例如10s
)来确定要输入插入内容之前要删除多少文本。话虽如此,您可以使用<num>s
对c
进行c<num>l
(帮助中提到s
实际上是cl
的同义词)。