AstroNvim / AstroNvim

AstroNvim is an aesthetic and feature-rich neovim config that is extensible and easy to use with a great set of plugins
https://AstroNvim.com
GNU General Public License v3.0
12.73k stars 927 forks source link

When using the nvim open path or opening a project located in a different directory, the neo-tree is not updated. #2006

Closed F7kyyy closed 1 year ago

F7kyyy commented 1 year ago

Checklist

Operating system/version

Arch on WSL

Terminal/GUI

Windows terminal

AstroNvim Health

1 2 3 astronvim: require("astronvim.health").check() 4 5 AstroNvim 6 - AstroNvim Version: v3.23.1 7 - Neovim Version: v0.9.1 8 - OK Using stable Neovim >= 0.8.0 9 - OK git is installed: Used for core functionality such as updater and plugin management 10 - OK xdg-open is installed: Used for gx mapping for opening files with system opener (Optional) 11 - OK lazygit is installed: Used for mappings to pull up git TUI (Optional) 12 - OK node is installed: Used for mappings to pull up node REPL (Optional) 13 - OK gdu is installed: Used for mappings to pull up disk usage analyzer (Optional) 14 - OK btm is installed: Used for mappings to pull up system monitor (Optional) 15 - OK python is installed: Used for mappings to pull up python REPL (Optional)

Describe the bug

When using nvim your/folder/path to open your project and select one file to open, then reopen the neo-tree, it still shows the location where you used nvim.

Steps to Reproduce

nvim ~/.config/nvim in terminal; select one file to open; use <leader>+e to reopen neo-tree; the root directory of the neo-tree doesn't update;

Expected behavior

When opening a file, the root directory of the neo-tree could be updated.

Screenshots

nvim1

Additional Context

No response

mehalter commented 1 year ago

The root of neo-tree follows the current working directory of Neovim. This does not change when you change files, you can check it with :pwd. There are a few approaches you could take at changing this behavior:

  1. Change neo-tree behavior by looking at their documentation: https://github.com/nvim-neo-tree/neo-tree.nvim
  2. Use autochdir: https://vim.fandom.com/wiki/Set_working_directory_to_the_current_file
  3. Configure a plugin to do root detection, typically called a "rooter". Something like: https://github.com/ahmedkhalf/project.nvim
F7kyyy commented 1 year ago

Thanks,I will try it.