Monday, December 28, 2009

Re: when to use or in mappings

> <Esc> or CTRL-[ End insert or Replace mode, go back to Normal mode.
> Finish abbreviation.
>
> CTRL-C Quit insert mode, go back to Normal mode.
> Do not check for abbreviations.
> Does not trigger the |InsertLeave| autocommand event.
>
> In mappings I have seen both used.
>
> Please elaborate the fine points of use.

Well, the help summarizes the differences fairly succinctly: do you
want abbreviations to be expanded or not? Do you want the InsertLeave
autocommand event to trigger. According to the help, it looks like
abbreviations can get expanded in mappings[1] but I didn't get them to
trigger in my testing:

:iab x hello
:nnoremap Q oa x b<esc>

and then using Q to insert the text, I just get a line with "a x b"
instead of "a hello b".

-tim

[1]
Abbreviations are never recursive. You can use
":ab f f-o-o" without any problem. But
abbreviations can be mapped.
-just above :help :abbreviate-local


--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments: