nvim-rooter.lua
nvim-rooter.lua copied to clipboard
feat: add option to change the scope of working directory change
https://github.com/airblade/vim-rooter?tab=readme-ov-file#miscellaneous
vim-rooter
supports g:rooter_cd_cmd
to select the command used for changing working directory (:cd
, :lcd
, :tcd
).
Likewise, I've added cd_scope
option to the setup()
.
local function change_dir(dir)
local cd_method = {
global = vim.api.nvim_set_current_dir,
window = vim.cmd.lcd,
tabpage = vim.cmd.tcd,
smart = vim.fn.chdir,
}
cd_method[_config.cd_scope](dir)
end
The updated change_dir()
function should speak for itself.