2

我的问题很简单:有没有办法仅使用...中的命令来缩写由空格分隔的两个单词...是否可以转义空格字符?abvi

在 stackoverflow 中,我只找到了这个但所有答案都使用了替换命令。我也试过:

:ab word1<space>word2 replaceWord

但徒劳无功(产生错误)

4

2 回答 2

3

不幸的是,这是不可能的。

来自:help :abbreviate

Examples of strings that cannot be abbreviations: "a.b", "#def", "a b", "_$r"

那是因为只有三种类型的缩写(仍然来自:help):

full-id   The "full-id" type consists entirely of keyword characters (letters
      and characters from 'iskeyword' option).  This is the most common
      abbreviation.

      Examples: "foo", "g3", "-1"

end-id    The "end-id" type ends in a keyword character, but all the other
      characters are not keyword characters.

      Examples: "#i", "..f", "$/7"

non-id    The "non-id" type ends in a non-keyword character, the other
      characters may be of any type, excluding space and tab.  {this type
      is not supported by Vi}

      Examples: "def#", "4/7$"
于 2014-12-26T23:06:29.623 回答
3

其实是可以模仿的。

您必须定义一个缩写,word2以检查它之前的内容。我确实详细回答了有关以 '\' 开头的缩写的答案,它是相同的(除非您可能必须测试前一行的最后一个单词)。

于 2014-12-27T10:44:48.943 回答