1

I have this issue. Let's suppose I have the following directory tree:

diffchar/ ├── README.md ├── autoload │ └── diffchar.vim ├── demo.gif ├── doc │ ├── diffchar.txt │ └── tags ├── example1.png ├── example2.png └── plugin └── diffchar.vim 

If I open diffchar.vim under autoload, the working directory will be set to /path/to/diffchar/autoload. I explicitly specify :cd /path/to/diffchar, but if I open diffchar.txt, the working directory will be set to /path/to/diffchar/doc.

Any idea how to set the working directory to a fix path and that it does not change when I open files under different directories?

1
  • Food for your thought: what you want is the default behaviour, that you explicitly altered by setting a specific option. Commented Apr 26, 2022 at 6:28

1 Answer 1

4

You probably have autochdir (see here) set to on. Check with this vim command

:set autochdir? 

If the output just says autochdir and not noautochdir, then you have it set. Turn it off by doing:

:set autochdir ! 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.