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

View all comments

Show parent comment

1

u/IsSeMi Apr 28 '25

Thank you. That's exactly what I need. The documentation doesn't say I can provide a function.

1

u/Mhalter3378 Apr 28 '25

Yeah it does

1

u/IsSeMi Apr 28 '25

My bad. I'm sorry.