如何将下划线视为空格?


15

vim是否可以将下划线视为空格或连字符,所以当我使用sequence 时,当光标位于开头时dw,它不会删除整个句子some_long_text_with_underscores吗?

Answers:


22

dw删除一个单词,由该iskeyword设置定义单词的构成。来自:h word

                                                        word
A word consists of a sequence of letters, digits and underscores, or a
sequence of other non-blank characters, separated with white space (spaces,
tabs, <EOL>).  This can be changed with the 'iskeyword' option.  An empty line
is also considered to be a word.

要删除_iskeyword,做:

set iskeyword-=_

1
事实证明,这是一把双刃剑,因为vim开始将长函数名视为单独的单词。例如,一个名为,, download_and_print()“的python函数将带有,,”和-颜色,因为这是一个语言关键字。在函数调用之间也无法使用* /#进行导航。我知道这不是问题的一部分,但想提一下
。– jligeza

@zmarszczony我的功能突出显示可以正常工作,但是*/ #消失了。
muru 2015年
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.