Celeb Glow
updates | March 29, 2026

How can I disable Vim "jump to last position" feature in Ubuntu 17.04?

I just upgraded to Ubuntu 17.04 and saw that Vim now jump to last position where cursor was when you reopen the same file. Previously, this feature was an "opt-in" feature in /etc/vim/vimrc with an auto-cmd. With 17.04, it's enabled by default but the block in /etc/vim/vimrc is still commented, so how can I disable this feature properly?

" Uncomment the following to have Vim jump to the last position when
" reopening a file
"if has("autocmd")
" au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
"endif
2

2 Answers

Just found the solution thanks to irc://

It's in fact an autocmd defined at /usr/share/vim/vim80/defaults.vim that I did not clearly show at :verbose autocmd because it's a bit obscur in the way it's doing it. You can simply comment this block to disable this feature:

" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
"autocmd BufReadPost *
" \ if line("'\"") >= 1 && line("'\"") <= line("$") |
" \ exe "normal! g`\"" |
" \ endif

There is also a buch of new option enabled by default that you can find here.

Thanks anyway!

I am running Ubuntu 17.10, and I managed to override the behavior in my ~/.vimrc file like this:

:augroup vimStartup | au! | augroup END

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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