Playing with abbreviation in insert mode i noticed the following unexpected behaviour, when using gvim with vim-latex plugin:
Defining an abbreviation such as
:iab m <m>
or any similar "container" abbreviation such as
:iab m \(m\)
:iab m \m\
:iab m [m]
and so on, i get the expected behaviour when simply typing in insert mode
m<space>
However, if I type
m<shift><enter>
or
m<ctrl><enter>
the "container characters" are doubled, for example in the first two cases above I get
<<m>>
\(\(m\)\)
I don't find this kind of behaviour in the abbreviations section of the man page, nor in the relative vim.wikia page.
I'm using the vim version 7.4, and I can reproduce this both on Arch Linux and Windows 7.
Why does this happen? Can I prevent it? How?
Developers mailing list
I submitted the problem on the vim-latex mailing list. Here is the response I got:
Hi,
this seems to be a strange interaction with the IMAP-features of the latex-suite.
I tried
:iab a (m) :iab m [a]
Now,
a<space>
=>(m)
a<s-space>
=>([a])
Here, first
a
is expanded to(m)
and the innerm
is expanded to[a]
.If one uses
let Imap_FreezeImap=1
<space>
triggers no expansions, but<s-space>
works correctly.I have no clue how to fix this.
Best regards, Gerd
Other unexpected behaviours
Using inoreab
Following a suggestion in the comments I tried with
:inoreab n <n>
When I do this something else happens: typing
n<space>
produces
* <n>
with a * character coming from nowhere.
Typing instead
n<shift><space>
or n<enter>
or n<ctrl><enter>
I get the expected output <n>
.
Can you reproduce this?
Without set backspace=eol,indent,start
Even without using recursive abbreviations, there is a problem if
set keyboard=eol,start,indent
is not used.
Defining an abbreviation like
:iab alice bob
and using it typing
alice<space>
does not substitute alice
with bob
. Instead places bob
at the right of alice
, producing an output like
alice bob
Again, using <ctrl><space>
or <enter>
the substitution is made correctly.
:inoreab
?!