Hello,

I just noticed something I thought I had seen before but wasn't sure; I
have the following mappings in my _vimrc:

nmap <f2> :update<cr>
imap <f2> <c-o><f2>

This allows me to hit <f2> to save the current buffer if it has been
modified (I think it's from the Borland Pascal days) and leaves me in
the mode where I was when I hit the key.  (I have a visual mode version,
for the curious, which does <esc><f2>gv -- updates and returns my visual
selection -- but that one works fine so wasn't part of my discussion
here.)

The inconsistency I have noticed is when I am at the end of a line,
typing away (making the line longer).  If, while in insert mode, I hit
<f2>, it performs the update, but leaves the cursor just before the last
character on the line (one character to the left of where I actually
was).  If, instead, I map <f2> like this:

imap <f2> <esc><f2>gi

The problem goes away.  My question is, why is <esc><aSingleCommand>gi
different from <c-o><aSingleCommand>?

Thank you!

-- 
Salman

Reply via email to