Closed eruizc-dev closed 3 years ago
Thank you for for the request but I don't think this is expected (default) behaviour for the users of this plugin.
This plugin uses the native cd command, if this doesn't trigger project specific source file with set exrc
, we should not invoke it as an side effect.
As I understand the documentation (4.c.), a directory specific source file is only triggered on startup, not on file/directory change. I think this is due to possible unexpected behaviour when stacking multiple source files.
Though I don't think this plugin should implement this, it can be added easily with the last update by extending the default behaviour in your vim/lua init:
require("telescope._extensions.zoxide.config").setup({
mappings = {
default = {
after_action = function(selection)
print("Directory changed to " .. selection.path)
-- TODO source file if found
end
},
}
})
I feel I should also note that set exrc
is not recommended and even on the deprecated list of Neovim:
'exrc' 'ex' Security risk: downloaded files could include a malicious .nvimrc or .exrc file. See 'secure'. Recommended alternative: define an autocommand in your |vimrc| to set options for a matching directory.
Thank you for the complete answer! I was aware it was flagged as insecure but didn't know it was deprecated...
I will do as you say
TLDR
It would be awesome to source
.exrc
file after changing cwd with telescope-zoxide if found. No need to unload the previous one since most configurations will be either overridden or ignored.In depth:
I've been using this plugin for quite a while and it's awesome for quickly switching between projects! The issue I'm facing is that it won't load specific project configurations when I switch projects. Or more specifically: doesn't source
.exrc
file.The
.exrc
file is a vimscript file that is sourced when you have the optionset exrc
and you open vim/neovim in a directory containing a file of that name. It's very useful for configuring plugins depending on project-specific requirements such as vim-test. Here's an example.exrc
file I have: