134651Re: exec "normal i"
- Nov 22, 2012On 2012-11-21, oversky wrote:
> On Wednesday, November 21, 2012 4:48:56 PM UTC+8, Gary Johnson wrote:I think the usual solution to that problem is
> > You could move the cursor to the right before executing
> > :startinsert, like this:
> > normal l
> > startinsert
> Thanks, Gary.
> I found that when the cursor is at the end of a line,
> vim can't move the cursor right.
> So the result is still insert but not append.
> I am using ve=all as a temporary solution,
> Do you have more suggestion to make it work in ve= never.
However, if you are writing a script you have a lot more flexibility
in the solution since a script can contain relatively complex code.
A script can determine the current cursor position and whether the
cursor is at the beginning, end or elsewhere in the line, then
choose its behavior accordingly. So you could put something like
this in your script (untested):
if col(".") == col("$")-1
" Cursor is at the end of the line.
" Cursor is not at the end of the line.
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
- << Previous post in topic