natecraddock / workspaces.nvim

a simple plugin to manage workspace directories in neovim
MIT License
309 stars 15 forks source link

¿How to refresh nvimTree with the workspaces path? #3

Closed ghost closed 2 years ago

ghost commented 2 years ago

Exist some way to refresh the nvimTree when I change in workspaces?

natecraddock commented 2 years ago

Hey! There is a command :NvimTreeRefresh that will refresh the tree. You could add this as an open hook

hooks = {
  open = {
    "NvimTreeRefresh",
  },
}

Alternatively, nvim-tree has a setting update_cwd that changes the tree root automatically each time the DirChange event occurs.

require("nvim-tree").setup({
  update_cwd = true,
})

Let me know if that helps!

ghost commented 2 years ago

image When I switch between workspaces I get this error, but, If I disable the "NvimTreeRefresh" instead the telescope find_files, this works, thanks for your help, only I needed change that property for true, sorry for that, I am grateful.

natecraddock commented 2 years ago

Glad it works!

It's possible that you are lazy-loading nvim-tree and that's why the command didn't work.

ghost commented 2 years ago

Yes! I'm using lazy-loading, thanks for that!

ghost commented 2 years ago

Please add this for the wiki or readme, I think it might be useful to someone.