When I open a new file, [n]vim changes directory into home, regardless of the directory i am in.

I didn't wrote code for that behavior, so that must be a plugin. How can I figure out the origin of this? So that I can disable or tweak the plugin. There must be a way to find out what is causing vim to cd to home.


1 Answer 1


It might be caused by an autocommand. You can list them all with :autocmd or do some filtering by looking at likely candidates such as

:autocmd BufNew
:autocmd BufNewFile
:autocmd BufEnter
  • thanks. I found out that it was due to a autocmd which executed "mkview and loadview" on BufWinEnter/BufWinLeave. for some reason this caused to cd into home
    – user37373
    Commented Feb 17, 2023 at 22:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.