Prevent automatic change of cwd when navigating files in a mono repo #2238
-
Hey everyone, I decided to ditch my own Neovim config because it was too much of a hassle to keep up with the constant changes in the plugin ecosystem and decided to give LunarVim a shot. So far I'm really happy with it but there is one thing that is really annoying me and I can't figure out which option is responsible for it. In my current project I'm working on a JS project powered by lerna, which allows us to make use of a "mono repo" setup with multiple JS apps and libraries inside a single git repo. The simplified repo structure is something like this:
I open LunarVim at the root of the repo, but whenever I navigate to a file inside one of the package folders (either by Nvim-Tree or Telescope file picker) it will change the working directory to the root of the package folder, e.g. if I open I tried to set the various
but to no avail. I checked LunarVims default Telescope config here but I don't see anything related to cwd there. I'd appreciate any hints, it's the only thing holding me back from being productive with lunarvim. Thanks a lot :) |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 17 replies
-
Finally found the place responsible for changing the cwd. It's on this line: LunarVim/lua/lvim/core/nvimtree.lua Line 120 in ff9ae8f Basically if |
Beta Was this translation helpful? Give feedback.
-
You can also configure how the CWD is decided. So for example, you can say that projects are first defined by the presence of lerna.json, then the project will be based on the presence of that file first, and fallback to git or package.json after that |
Beta Was this translation helpful? Give feedback.
-
Is there an "official" way of handling different roots? |
Beta Was this translation helpful? Give feedback.
Finally found the place responsible for changing the cwd. It's on this line:
LunarVim/lua/lvim/core/nvimtree.lua
Line 120 in ff9ae8f
Basically if
lvim.builtin.project.active
istrue
(which is the default) it will set the nvimtree optionupdate_cwd
also to true, effectively overriding my own config. So disabling this project feature did solve my issue, although now I can't use this feature anymore, which is unfortunate but I can live without it for now.