Shortcut to focus cwd after nagivating away
Describe the solution you'd like
If you navigate away from the current working directory using something like -, it would be nice to have a shortcut that roots the tree back to the cwd
This is also useful if you've change the cwd via :cd ... and would like the tree to focus the new directory
Describe alternatives you've considered Couldn't find any issues describing this, and I didn't see anything in the help menu
I used use a custom action cd_dot for this. I stopped after we added restrict_above_cwd.
We could add an action:
{
key = ".",
action = "cd_cwd",
desc = "change tree root to vim's cwd",
},
@kyazdani42 ?
Doesnt:
*nvim-tree.update_cwd*
Changes the tree root directory on `DirChanged` and refreshes the tree.
Type: `boolean`, Default: `false`
Already do that ?
update_cwd changes the root nicely when you cd.
I think the user would like a way to change the root to cwd without having to explicitly change.
I guess I could theoretically do :cd $PWD? But maybe the DirChanged doesn't fire on that cause technically the directory is still the same...
But maybe the DirChanged doesn't fire
The only way to know would be to test ;)
Have you tried the action I specified above? It will go to vim.fn.getcwd(-1)
Closing due to inactivity.