1

I noticed that whenever I quit Gvim, it will remember the line and position within the line that the cursor was on, unless the cursor was on line 1. If the cursor was on line 1, then it will not remember the position within line 1.

So if I have the cursor at the end of line 2 and I quit Gvim, then the next time I open the same file in Gvim, it will place the cursor at the end of line 2.

But if I have the cursor at the end of line 1 and I quit Gvim, then the next time I open the same file in Gvim, it will place the cursor at the beginning of line 1.

Is this a bug in Gvim?

I'm running Gvim 7.2 on Windows.

  • Are you using an autocmd to restore the cursor position? – akshay Mar 29 '15 at 11:07
4

You probably use the :autocmd from :help line():

:au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif

Just drop the first branch of the conditional (line("'\"") > 1 &&).

  • Yes, that is located in the vimrc_example.vim file. – pacoverflow Mar 29 '15 at 20:13
  • Note, there was a bug in loading buffers, that was just recently fixed. – Christian Brabandt Apr 1 '15 at 19:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.