Closed
Description
Description
After I open a document and Trouble in sparated windows, Nvim fails if I open another file through nvim-tree in a new tabpage. It seems that newly opened file takes up window id of Trouble window, which leads to failure of Trouble.
However, if I change the order of Trouble and nvim-tree, i.e. toggling on nvim-tree first and then Trouble, it works properly.
Neovim version
NVIM v0.7.0
Build type: Release
LuaJIT 2.1.0-beta3
Operating system and version
macOS 12.3.1
nvim-tree version
Minimal config
-- nvim-tree.lua
local status, nvim_tree = pcall(require, "nvim-tree")
if not status then
vim.notify("nvim-tree not found!")
return
end
nvim_tree.setup({
open_on_tab = false,
git = {
enable = false,
},
update_cwd = true,
update_focused_file = {
enable = true,
update_cwd = true,
},
filters = {
dotfiles = true,
custom = {
"node_modules",
"__pycache__",
"Applications",
"Library",
"Music",
"Movies",
"Pictures",
"Public",
},
},
view = {
width = 36,
side = "left",
hide_root_folder = false,
mappings = {
custom_only = false,
},
number = false,
relativenumber = false,
signcolumn = "yes",
},
actions = {
open_file = {
resize_window = true,
quit_on_open = false,
},
},
system_open = {
-- mac
cmd = "open",
},
})
-- trouble.lua
local status, trouble = pcall(require, "trouble")
if not status then
vim.notify("trouble not found!")
return
end
trouble.setup({
position = "bottom", -- position of the list can be: bottom, top, left, right
height = 10, -- height of the trouble list when position is top or bottom
width = 50, -- width of the list when position is left or right
icons = true, -- use devicons for filenames
mode = "document_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist"
fold_open = "", -- icon used for open folds
fold_closed = "", -- icon used for closed folds
group = true, -- group results by file
padding = true, -- add an extra new line on top of the list
action_keys = require("keymaps").trouble.mappings,
indent_lines = true, -- add an indent guide below the fold icons
auto_open = false, -- automatically open the list when you have diagnostics
auto_close = false, -- automatically close the list when you have no diagnostics
auto_preview = true, -- automatically preview the location of the diagnostic. <esc> to close preview and go back to last window
auto_fold = false, -- automatically fold a file trouble list at creation
auto_jump = {"lsp_definitions"}, -- for the given modes, automatically jump if there is only a single result
signs = {
error = "",
warning = "",
hint = "",
information = "",
other = ""
},
use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client
})
Steps to reproduce
- nvim a.lua
- Cmd mode
:TroubleToggle
- Cmd mode
:NvimTreeToggle
- select a file in tree
- open the file in new tabpage
Expected behavior
No response
Actual behavior
No response