I want to configure vim to open a file at the same place I left off at.
views:
416answers:
3
+9
A:
From ubuntu's /etc/vim/vimrc file, this example is commented out:
" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g'\"" | endif
endif
If this doesn't work, a common problem is not havng ownership of your ~/.viminfo file. If this is the case, then run:
sudo chown user:group ~/.viminfo
where user is your username and group is often the same as your username.
marcog
2009-04-21 21:03:50
The autocmd comes straight out of the vim doc. See :help last-position-jump
2009-04-23 08:08:14
+2
A:
:h views-sessions
You can place this in your .vimrc :
au BufWinLeave * mkview
au BufWinEnter * silent loadview
the views will be placed in $HOME/.vim/view. You probably need to create these directories.
Oli
2009-04-22 06:21:00
A:
If you don't mind trading automation for simplicity, just press the keystroke '" (apostrophe, followed by double quotes) on opening a file, you'll jump to where you were. This is essentially what @marcog's answer is doing.
sykora
2009-04-22 06:37:56