Closed
Description
Description
With this change (45a93d9#diff-eeb21711fceb0abba1450bd1adcbecc4fd90cf8ce4d5d7a8233f886c1bebd41fR375), I found it doesn't work well on Windows for 2 cases:
- When I open a file from nvim-tree, the root of nvim-tree window changed to the directory of that file
- The buffer of this file can not be listed when I use telescope command
<cmd>lua require('telescope.builtin').buffers(require('telescope.themes').get_dropdown{previewer = false})<cr>
Neovim version
NVIM v0.10.2
Build type: Release
LuaJIT 2.1.1713484068
Operating system and version
Windows 11
Windows variant
Command Prompt
nvim-tree version
Clean room replication
I'm on windows so don't have /tmp/nvt-min.lua.
Pasting my config here:
local status_ok, nvim_tree = pcall(require, "nvim-tree")
if not status_ok then
return
end
local api_status_ok, nvim_tree_api = pcall(require, "nvim-tree.api")
if not api_status_ok then
return
end
local function customized_on_attach(bufnr)
local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
-- default mappings
nvim_tree_api.config.mappings.default_on_attach(bufnr)
-- custom mappings
vim.keymap.set('n', 'c', nvim_tree_api.tree.change_root_to_node, opts('CD'))
vim.keymap.set('n', 'l', nvim_tree_api.node.open.edit, opts('Open'))
vim.keymap.set('n', '<CR>', nvim_tree_api.node.open.edit, opts('Open'))
vim.keymap.set('n', 'o', nvim_tree_api.node.open.edit, opts('Open'))
vim.keymap.set('n', 'h', nvim_tree_api.node.navigate.parent_close, opts('Close Directory'))
vim.keymap.set('n', 'v', nvim_tree_api.node.open.vertical, opts('Open: Vertical Split'))
end
local keymap = vim.api.nvim_set_keymap
keymap("n", "<leader>e", ":NvimTreeToggle<CR>", { noremap = true, silent = true })
nvim_tree.setup {
update_focused_file = {
enable = true,
update_cwd = true,
},
actions = {
change_dir = {
enable = false,
}
},
renderer = {
root_folder_modifier = ":t",
icons = {
glyphs = {
default = "",
symlink = "",
folder = {
arrow_open = "",
arrow_closed = "",
default = "",
open = "",
empty = "",
empty_open = "",
symlink = "",
symlink_open = "",
},
git = {
unstaged = "",
staged = "S",
unmerged = "",
renamed = "➜",
untracked = "U",
deleted = "",
ignored = "◌",
},
},
},
},
diagnostics = {
enable = true,
show_on_dirs = true,
icons = {
hint = "",
info = "",
warning = "",
error = "",
},
},
view = {
width = 45,
side = "left",
},
on_attach = customized_on_attach,
}
Steps to reproduce
- cd C:\Users${username}\AppData\Local\nvim-data\site\pack\packer\start\nvim-tree.lua
- nvim .
- move to the file lua\nvim-tree\actions\root\change-dir.lua and open it
- look at the nvim-tree window, the root changes to lua\nvim-tree\actions\root
- and call the list buffer function in telescope, nothing shows up
Expected behavior
No response
Actual behavior
No response