Ubuntu Remember Last Visited Line In Vim

By default Ubuntu operating system won’t remember the last visited line in vim. You need to do a small change to remember last visited line as follow

  • Open fine to edit with sudo vim /etc/vim/vimrc
  • Go to the line number 26 where or search for “Uncomment the following to have Vim jump to the last position when reopening a file”
  • Below that line remove quote(“) for following (at starting of line) if condition that will enable vim to remember last visited line. After removing quotes the if condition looks as shown below

   if has(“autocmd”) 
     au BufReadPost * if line(“‘\””) > 1 && line(“‘\””) <= line(“$”) | exe “normal! g’\”” | endif 



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s