-
The airblade/vim-rooter plugin is an essential part of my Neovim workflow. It automatically changes current directory (:h current-directory) for every buffer to a more natural one (like to path of its Git repository). For me this has the following benefits:
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
-
mini.nvim
Library of 40+ independent Lua modules improving overall Neovim (version 0.8 and higher) experience with minimal effort
Initially I planned to make a separate 'mini.root' module, but realized that it would mostly be a reimplementation of vim.fs. So instead I decided to add setup_auto_root() function to mini.misc. If you want a more tested and documented solution, check it out and tell me what you think. Thanks!
-
Firstly, I respect your sharing here, but I still discourage people(especially newcomers) from using this kind of plugin/script to auto-changing "current directory". (So yes, I myself discourage people from using my own root plugin NeoRoot.lua anymore, and I've decided to execute my plan to abandon it recently.)
-
There are indeed three levels of Vim's "current directory", I made a summary during my development of the not well-known multi-tab project session automation plugin: https://github.com/nyngwang/suave.lua/issues/1. In short: it is not that simple.