3

I want to have fixed current directory equals to the directory where vim was opened.

Note I am using tabs and splits, so I want to have the same current directory in all tabs and splits. How can I do that?

1
  • 3
    The "autochdir" setting, if on, will cause vim to change the working directory "for you." This setting is off by default. If you are seeing vim change the directory thusly, you might try to see if something in your vimrc or some plugin has set autochdir without your knowing.
    – user72
    Commented Dec 6, 2016 at 17:02

1 Answer 1

1

To change the current directory with the file opened at start up you can add this to your vimrc:

 cd %:h

By default vim doesn't change the current directory when opening other files so your tabs and splits should not change.

Note that you might be interested by :h current-directory

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.