Thursday, January 17, 2019

Re: Help! how to switch between visual mode and insert mode ?

在 2019年1月17日星期四 UTC+8下午11:51:45,Tony Mechelynck写道:
> On Thu, Jan 17, 2019 at 4:10 PM 王子陌 <wangzimo67james@gmail.com> wrote:
> >
> > Help! I want to get to visual mode when I'm in insert mode, the problem is:
> >
> > if there's a line:
> >
> > abcdefg
> >
> > When the cursor is at the end of the line and I use <ESC> to switch to normal mode and use v to visual mode, the cursor goes left, which made me unable to map a command that is universe.
> >
> > Help!
>
> AFAIK, <Esc> in Insert mode always moves the cursor left by one
> column, unless you're already at the left margin. However:
> 1. If 'virtualedit' is set to "onemore" you can move the cursor to one
> column past the last character without leaving Normal mode;
> 2. Or, regardless of how 'virtualedit' is set, if you're on the last
> character of the line in Normal mode, vlol will put you in Visual
> mode, with only the end-of-line (which is "one past" the last
> character on the line) selected, as follows:
> v go to characterwise visual
> l move right by one column
> o move cursor to the other end of the visual area
> l move right by one column
>
> Best regards,
> Tony.

Thank you so much! 'set virtualedit=onemore' worked perfectly!
For the second solution, it's great but will conflict when setting 'map', so I didn't use it in my settings.

Best regards,
王子陌
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment