Skip to content

CD don't set working dir for buffers #2320

@astephanh

Description

@astephanh

Description

Hi,

if i invoke change_root_to_node(), buffers still use the old working directory while the nvim-tree buffer itself has the new working directory.

My Quick Fix for this:

-- change_root_to_node will not change pwd for other buffers,
-- so i set it in this function
local api = require("nvim-tree.api")

vim.keymap.set("n", "<C-]>", function()
local node = api.tree.get_node_under_cursor()
api.tree.change_root_to_node()
vim.api.nvim_set_current_dir(node.absolute_path)
end, opts("CD"))

Neovim version

NVIM v0.9.1
Build type: Release
LuaJIT 2.1.0-beta3

Operating system and version

Linux 6.3.12-1-MANJARO

nvim-tree version

a708bd2

Clean room replication

just invoke the funktion, then use

:pwd 

in Nvim-tree Buffer vs in other buffers

Steps to reproduce

just invoke the funktion, then use

:pwd

in Nvim-tree Buffer vs in other buffers

Expected behavior

No response

Actual behavior

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions