Deepak
Deepak

Reputation: 1088

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...

Upvotes: 0

Views: 187

Answers (1)

Christian Brabandt
Christian Brabandt

Reputation: 8248

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.

Upvotes: 5

Related Questions