When I close a file in vim and reopen it, the file opens at the start of the file. Is there anyway to make the file open at the last place the I viewed?
Put this in your
if has("autocmd") " When editing a file, always jump to the last cursor position autocmd BufReadPost * \ if line("'\"") > 0 && line ("'\"") X= line("$") | \ exe "normal g'\"" | \ endif endif
Just change the big X with
If I put
I just noticed that my cursor has started to have this behavior. I went through my vimrc (commenting out line by line) and found that this code will also work:
(Quotes finished to make it easier to read)
The main purpose of this block is to make any folds created appear again when a file is opened but apparently it also saves/loads the cursor position.