怎么定义word WORD symbol的分隔符?

事例

默认情况下,在example_fun|ction.prop()文本中,|为光标所在位置 viw选中function viW 选中example_function.prop() vio 选中example_function.prop

viw vio都符合我的预期,但是viW我希望是选中example_function.prop(不含标点括号)

尝试

我evil的文档里找到了evil-bigword,做了如下设置并不起效果

(setq evil-bigword "^][(){},.&| \t\r\n")

evil-bigword手册上的文档说明: The set of characters to be interpreted as WORD boundaries. This is enclosed with square brackets and used as a regular expression. By default, whitespace characters are considered WORD boundaries.

问题

如何令viW不选中][(){},.&|标点?

我没看到任何地方有用到这个 evil-bigword 变量。

真正起作用的是 forward-evil-WORD 函数,可以通过覆盖该函数来实现:

(defun my/forward-evil-WORD (&optional count)
  (evil-forward-nearest count
                        #'(lambda (&optional cnt)
                            (evil-forward-chars "^\n\r\t\f (" cnt)) ;; 加了一个 “(”
                        #'forward-evil-empty-line))

(advice-add 'forward-evil-WORD :override #'my/forward-evil-WORD)
2 个赞