问题描述
vi将破折号-
和空格
视为命令的分隔符,例如 dw
和 cw
。
vi treats dash -
and space
as word separators for commands such as dw
and cw
.
是否可以添加下划线 _
?
我经常想更改包含下划线的变量名称的一部分,例如更改 src_branch
到 dest_branch
。我最终计算了字符并使用了 s
(例如 3sdest
),但是使用<$ c会容易得多$ c> cw (如 cwdest
)。
I quite often want to change part of a variable name containing underscores, such as changing src_branch
to dest_branch
. I end up counting characters and using s
(like 3sdest
), but it would be much easier to use cw
(like cwdest
).
推荐答案
如果您使用的是vim,则可以通过设置 iskeyword
选项来更改它(:he iskeyword
)。如果这不是一个选择,则可以始终使用 ct _
代替计数。
In case you're using vim, you can change that by setting the iskeyword
option (:he iskeyword
). If that is not an option, you can always use ct_
instead of counting.
这篇关于在vi中自定义单词分隔符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!