For example, I've mapped inoremap ( ()
, and if I do iabbrev if if(then
it will expand to if(then)
instead of if()then
(the inoremap
is executed after the iabbrev
). Is it possible to make iabbrev
ignore my custom keymappings so I can make iabbrev if if()then
correctly expand to if()then
?
Add a comment
|
inoreabbrev
(insert-mode non-recursive abbreviation) is the command that will ignore custom mappings when executing the abbreviations.
To remove abbreviations without leaving vim use iunabbrev [lhs]
. Now inoreabbrev if if()then
should work correctly.
-
1Thank you! It totally works. And also do you happen to know if there's any way to ignore custom mappings when editing macros (like
let @q = 'gg'
)? – tga Aug 26 '18 at 14:20 -
let @q = 'gg'
just sets the contents of the q-register, so it depends how you run the macro. I thought:normal! @q
would work but apparently not, never tried it, so temporary fix could be:normal! <C-r>q
to directly insert the contents of the q-register used for the macro and run ignoring remappings. – Lucas Payne Aug 28 '18 at 3:45