I saw something strange happen today.
I was in directory /some/path/
and opened a file with vim file.html
.
I then did :pwd in vim and it gave me /some/other/path
. What could cause this to happen?
EDIT: :verbose set autochdir?
outputs noautochdir
EDIT2: putting set autochdir
in ~/.vimrc
doesn't solve it.
I tried this:
cd /dir1/
vim dir2/newfile
:pwd
->/dir1/
cd /dir1/dir2/
vim newfile
:pwd
->/dir1/dir2/
This is the behavious I expect (:pwd
returning the directory in which I launched vim) so I don't understand why for one particular file it doesn't work like that.
I figured it must be somehow caused by It is definitely caused by these lines in ~/.vimrc
:
autocmd BufWinLeave * mkview
autocmd BufWinEnter * silent loadview
I deleted my ~/.vimrc
and :pwd
returned the correct directory.
After I restored it, the situation reverted to the original problem. I still don't understand how it happenned, I can't recreate the issue.