Thursday, July 12, 2012

Re: doesn't work in inoremap

On Thursday, July 12, 2012 3:35:14 AM UTC-5, sinbad wrote:
> why doesn't the following mapping work.
>
> inoremap .ba <Esc><End>i;<ESC>o
>
> if i type (.ba), i am expecting it to become
>

You are triggering your mapping before typing the final ).

So the sequence Vim sees is:

( <- insert a parenthesis
.ba <- go to last character of line and insert a ; character before it, then start a new line
) <- insert another parenthesis

Incidentally, there is no need for the <ESC> before the <End>. <End> also works in insert mode.

> ();
> __cursor should reach here.
>
> but i get the following
>
> (;)
> __cursor comes here

I actually expect you'd get this:

;)
)__cursor here

This is what I get when I try your mapping as given.

What are you actually trying to accomplish with your mapping?

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment