首页 > 解决方案 > 如何在 vim 缩写中转义字符?

问题描述

我试图在我的 Vimrc 中使用这个缩写来进行降价编辑:
iabbrev ,,img ![<alt-text>](<img-link>)

我认为括号需要在这里转义,但我不确定如何在不包括缩写中的转义字符的情况下转义这些字符。
我应该怎么办?

标签: vimvim-plugin

解决方案


缩写有以下形式(见:h abbreviations):

There are three types of abbreviations:

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$"

,,img不能full-id像开头那样,。它不能end-id因为所有其他字符都必须是非关键字字符。也不可能non-id

我建议更改您的缩写。例如img,,


推荐阅读