简体   繁体   English

在Vimrc中使用Iab时出错

[英]Error while using iab in vimrc

I need to convert 我需要转换

for(int to for (int for(int至for (int

automatically in my vim editor. 自动在我的vim编辑器中。

So I have written following statement in my vimrc 所以我在vimrc中写了以下声明

iab for(int    for (int

but its giving following error 但它给以下错误

line  158:
E474: Invalid argument

What is the reason for this error ?? 此错误的原因是什么?

Also How can I write a general statement which will convert 另外我怎么写一个将转换的一般声明

 for(int to for (int
 for(;; to for (;;  etc...

There are 3 types of abbreviations: 缩写有3种:

  • full-id The abbreviation contains only of 'iskeyword' characters. full-id缩写仅包含'iskeyword'字符。
  • end-id The abbreviation ends with a 'iskeyword' character but all other characters are not keyword characters end-id缩写以'iskeyword'字符结尾,但所有其他字符都不是关键字字符
  • non-id The abbreviation ends with a non-keyword character, the other characters may be of any type (excluding white-space). non-id缩写词以非关键字字符结尾,其他字符可以是任何类型(空格除外)。

(from the help :h abbreviations , there are examples for each type in the help). (通过help :h abbreviations ,帮助中有每种类型的示例)。

Neither of those types is for(int . So this can't be used as an abbreviation. You could theoretically tweak the iskeyword setting to make it valid, but that will most likely have other non-intended consequences that will do more harm than good. 这些类型都不是for(int 。因此,不能将其用作缩写。理论上,您可以调整iskeyword设置以使其有效,但这很可能会带来其他非预期的后果,弊大于利。

See the help :h 'iskeyword' for an explanation what the keyword setting is for. 请参阅帮助:h 'iskeyword'以获取关键字设置的解释。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM