Remember last cursor position in VIM
Hi all,
I know this is not a vim forum, but I am tempted to ask the question because I have this problem only with debian. On my slackware system (at work), if I close a file and open it again after some time in vim, the cursor is at the same position where I left it the last time. But on my debian system (at home), when I open the file, every time the cursor is at the beginning. For a large code files it is really quite a lot of work to go to the last position where I changed something. Any ideas ? Anything I can add to my ~/.vimrc ? thanks and regards, Hardik PS: On slackware I have 7.0.109, i don't remember the VIM version on debian, but it is certainly higher or equal. |
The settings are in your ~/.vimrc file, so you could check the .vimrc file at work. Here is a fragment of mine:
Code:
augroup vimrcEx |
Hi,
Thanks for your reply. This did not help. One thing, my .vimrc on slackware doesn't contain such commands and including them in .vimrc on debian didn't change anything. I attach here the complete .vimrc. If my syntax is wrong, please correct it. thanks & regards Hardik Code:
if has("terminfo") |
Here is information on the .viminfo file. That is where the cursor and command history is saved. Your version of vim at home might have been built without .viminfo support.
http://vim.sourceforge.net/tips/tip.php?tip_id=80 Make sure that on debian, that vim isn't aliased like: vim='vim -i --' I can't imagine that it would be. Here is my entire .vimrc file. Also remember that vim and gvim are different and have different startup files. Code:
" An example for a vimrc file. |
Hi,
Thanks, jschiwal. I have .viminfo file created on my system, so I seem to have this support, I am not sure though. How to check if vim is compiled with viminfo or not ? Another strange thing is that, I can run the command: '" from inside of vim and it takes me to the correct position (previous one). I guess the scrptlet you sent me is not being executed. regards, Hardik |
All times are GMT -5. The time now is 08:38 AM. |