- Gary Johnson wrote:
>Does your plugin use the CursorHold or CursorMoved autocommand?Yes, I use CursorMoved autocommand and winsaveview() to
>Does your plugin move the cursor after the user has moved it, then
>restore the user's cursor position?
>Normally, vim remembers that your cursor was in column 17 (over the
>'O') when you moved it to the empty line and moves the cursor back
>to column 17 when you move it again to the next line having 17 or
>more columns. If, when the cursor is at the first column of that
>blank line, your plugin executes a command that remembers the cursor
>position, moves the cursor someplace else, then restores the cursor
>position, vim thinks the user has deliberately moved the cursor to
>column 1 and uses that "desired column number" when the user
>subsequently moves the cursor to the next line. This leaves the
>cursor in column 1 when you think it should have moved back to
>I think this problem can be solved by using the winsaveview()
>function to save the cursor and view information before moving the
>cursor, then using the winrestview() function to restore the cursor
>and view. These functions are new with vim 7.0 and I haven't tried
save the view information.
I have tried the plugin on vim with the newest patches and with
options -u NONE -N, then it looked to be working correctly.
Maybe some plugin interfered it?
Anyway thank you for advice, Gary.