简体   繁体   中英

Error while using iab in vimrc

I need to convert

for(int to for (int

automatically in my vim editor.

So I have written following statement in my 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:

  • full-id The abbreviation contains only of 'iskeyword' characters.
  • end-id The abbreviation ends with a 'iskeyword' character but all other characters are not keyword characters
  • non-id The abbreviation ends with a non-keyword character, the other characters may be of any type (excluding white-space).

(from the help :h abbreviations , there are examples for each type in the help).

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.

See the help :h 'iskeyword' for an explanation what the keyword setting is for.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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