0
4

3 回答 3

1

我建议使用这个 PERL Regex 插件,因为它已经完成了你想要的。

https://github.com/othree/eregex.vim

于 2017-06-24T18:50:34.927 回答
1

Abbreviations ...

I understand you often use the same regex. You can use abreviations instead of a command to do a search.

ab re -\s*(

then type / + re + space and your long regex (here just "-\s*(" should expand).

... Not user defined command

User defined commands are not available in ed nor in vi nor in vim without the +eval compilation flag (:h user-commands and scroll one line up).

For a list of ex commands: http://www.csb.yale.edu/userguides/wordprocess/vi-summary.html

For a list of ed commands: http://pubs.opengroup.org/onlinepubs/7908799/xcu/ed.html

于 2017-08-09T13:22:26.053 回答
1

您的命令甚至无法在原始 Vim 中运行。我不知道 xVim,但可以尝试以下方法:

" With cursor moving to match.
command Foo /foo/

" Just updating the search pattern (but less likely to be portable to xVim).
command Foo let @/ = 'foo'

如果这些都不起作用;尝试定义映射。由于这只是翻译键,因此它最有可能被支持。

于 2017-06-22T14:55:14.873 回答