Vim 8.1: cursor position not saved.
Hi: I am within vim editing a file and the cursor is in a given position. Now I exit (:wq command). The next time I edit that file, that is when I invoke vim with the same file name, the cursor appears in line 1 column 1. This happens every time I run vim on a file already edited with vim. How can this be? I thought vim always saved the cursor position and, in fact, this was the case when I ran vim under Slackware.
|
The cursor position is saved in ~/.viminfo. Maybe it's not able to write to this file for some reason? Try checking the file permissions of ~/.viminfo. Maybe the new distro you're running vim under doesn't have the write permission set.
|
It's an autocommand...defined in the /defaults.vim script on the system wide vim directory (for me it's /usr/share/vim/vim81/defaults.vim )
If yours lacks this, this is the command you could just put in your vimrc. Code:
autocmd BufReadPost * Code:
" Only do this part when Vim was compiled with the +eval feature. But try it for yourself, if you want. |
My /usr/share/vim/vim81/defaults.vim has this block in it:
Code:
" Only do this part when compiled with support for autocommands. |
Code:
vim --version |
Quote:
Code:
(viminfo=) |
Quote:
|
that means it is enabled. So there should be an error somewhere
|
All times are GMT -5. The time now is 06:36 PM. |