Skip to content

sync_root_with_cwd = true not working #1862

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
AlexvZyl opened this issue Dec 27, 2022 · 3 comments
Closed

sync_root_with_cwd = true not working #1862

AlexvZyl opened this issue Dec 27, 2022 · 3 comments
Labels
awaiting feedback bug Something isn't working

Comments

@AlexvZyl
Copy link

AlexvZyl commented Dec 27, 2022

Description

When I open a file and Neovim changes cwd, nvim-tree does not follow.

Neovim version

NVIM v0.9.0-dev-565+gd215dae0e0
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

Operating system and version

Linux archlinux 5.15.85-1-lts #1 SMP Thu, 22 Dec 2022 06:22:00 +0000 x86_64 GNU/Linux

nvim-tree version

9e4c395

Minimal config

vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1

require 'nvim-tree'.setup {
    sync_root_with_cwd = true
}

Steps to reproduce

  1. nvim ~
  2. :e ~/.config/nvim/lua/alex/init.lua
  3. :NvimTreeToggle

Expected behavior

Nvim-tree should open up to where Neovim cwd is.

Actual behavior

Nvim-tree opens up in the home directory (where neovim was started originally).

@AlexvZyl AlexvZyl added the bug Something isn't working label Dec 27, 2022
@alex-courtis
Copy link
Member

I'm not quite sure I understand:

:e ~/.config/nvim/lua/alex/init.lua won't change global or local cwd. You'd need to cd .config/nvim/lua for the tree to change directory.

@AlexvZyl
Copy link
Author

Apologies for the noise, this was completely my mistake.

@alex-courtis
Copy link
Member

No worries. You might like to try out :help update_focused_file for more automated changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting feedback bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants