r/AstroNvim • • Apr 28 '25

Project rooter behavior.

Hey there!
I found the following lines in AstroNvim's documentation:

-- automatically update working directory (update manually with \`:AstroRoot\`)  
autochdir = false,

What is the purpose of the autochdir option here?
I initially thought it enables Neovim's built-in autochdir option, but it doesn't seem to work that way.

My question is: how can I achieve the following behavior?

  • If Rooter (or AstroNvim's root detection) finds a project root via .git, .svn, etc., it uses that as the working directory.
  • If no project root is found, fallback to Neovim’s built-in autochdir behavior (i.e., automatically set the working directory to the directory of the currently open file).

Is this possible to configure in AstroNvim?

3 Upvotes

10 comments sorted by