At one point in a vim script function I'm writing, the system will be
in visual mode and I want it to go back out of visual mode to normal
mode.
I know it doesn't really work to use something like 'normal! v'
because if the visual mode it stared in was 'V' then that command will
just change it to a character-based selection rather than going back
to normal mode.
If I use
normal! <ESC>
that's treated as just typing '<' 'E' 'S' 'C' '>'
so I thought I could use this:
normal! ^[
(which I've entered by typing 'normal ' and then pressing CTRL-Q
then <ESC>. I'm doing this on a windows machine, so on other
systems you'd be typing CTRL-V instead of CTRL-Q).
and I /thought/ this was working the other day, but now when I try
using it, it keeps giving me this error:
E471: Argument required: normal!
I also tried using
normal! ^C
(i.e using CTRL-Q CTRL-C)
but when I copy the text of the function and do @" it says there's a
missing endfunction... so I'm guessing that the ^C is being
interpreted as if I had actually pressed CTRL-C in the middle of
typing in the function on the ex-line...
so I'm wondering, what (preferably non-hack-like) means can I use in a
function to get out of visual
mode and return to normal mode? I figure there must be some means of
escaping or specifying a <ESC> key-press that I don't know about.
Thanks,
James.
--
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
To unsubscribe from this group, send email to vim_use+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
No comments:
Post a Comment