Skip to content

change_root_to_node() does not work on files #2717

Open
@BenjaminHao

Description

@BenjaminHao

Description

According to the help file, change_root_to_node will change the tree's root to a folder node or the parent of a file node.
However, it only works when I put cursor on a folder. If the cursor is on a file, it does not set the tree's root to its current folder.

Neovim version

NVIM v0.9.5
Build type: RelWithDebInfo
LuaJIT 2.1.1703942320

Operating system and version

Windows 11

Windows variant

No response

nvim-tree version

master branch

Clean room replication

No need config
default keymap is <C-]>

Steps to reproduce

  1. nvim -nu /tmp/nvt-min.lua
  2. :NvimTreeOpen
  3. Press <-> to go up
  4. select any file
  5. Press <C-]> to change root to node

Expected behavior

root directory changes to the file's folder

Actual behavior

Nothing happens

Metadata

Metadata

Assignees

No one assigned

    Labels

    PR pleasenvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciatedbugSomething isn't workingreproducedIssue confirmed

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions