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.
:verbose set autochdir?to the question. – muru Mar 28 '17 at 10:23?– pocpoc47 Mar 28 '17 at 11:14mkviewstores a lot of stuff, not just folds. It mentions'sessionoptions'in the documentation andsessionoptionshas acurdiroption. This might be what's causing it, but I'm not sure. You could try takingcurdirout ofsessionoptionsand see if that helps. – Tumbler41 Mar 28 '17 at 15:04