Conflict with nvim-tree
Chaitanyabsprip opened this issue · comments
Chaitanya Sharma commented
I am using this to specifically open my notes directory and nvim tree for everything else as this plugin allows me to open a floating window. However, with nvim tree enabled this plugin 1) gives the following error 2) opens nvim-tree
E5108: Error executing lua ...vim/site/pack/packer/opt/lir.nvim/lua/lir/float/init.lua:138: Vim(lua):E5108: Error executing lua ...vim/site/pack/packer/opt/nvim-tree.lua/lua/nvim-tree.lua:317:
Invalid buffer id: 74
stack traceback:
[C]: in function 'nvim_buf_delete'
...vim/site/pack/packer/opt/nvim-tree.lua/lua/nvim-tree.lua:317: in function 'open_on_directory'
[string ":lua"]:1: in main chunk
[C]: in function 'cmd'
...vim/site/pack/packer/opt/lir.nvim/lua/lir/float/init.lua:138: in function 'init'
...vim/site/pack/packer/opt/lir.nvim/lua/lir/float/init.lua:82: in function 'toggle'
[string ":lua"]:1: in main chunk
stack traceback:
[C]: in function 'cmd'
...vim/site/pack/packer/opt/lir.nvim/lua/lir/float/init.lua:138: in function 'init'
...vim/site/pack/packer/opt/lir.nvim/lua/lir/float/init.lua:82: in function 'toggle'
[string ":lua"]:1: in main chunk
tamago324 commented
Thanks for the report.
Can you give me a minimal vimrc and steps to reproduce?
LoydAndrew commented
Hello, I experience the same problem. I just have this settings for nvim_tree:
nvim_tree.setup({
tree_follow = true,
auto_close = true,
update_cwd = true,
tree_respect_buf_cwd = true,
filters = {
custom = {
".git",
"node_modules",
".cache",
"__pycache__",
".vscode",
".mypy_cache",
".idea",
},
},
diagnostics = {
enable = true,
icons = {
hint = "",
info = "",
warning = "",
error = "",
},
},
view = {
width = 50,
height = 50,
side = "left",
auto_resize = true,
},
follow_update_path = true,
update_focused_file = {
enable = false,
update_cwd = true,
ignore_list = {},
},
})
-- for lir
local actions = require("lir.actions")
local mark_actions = require("lir.mark.actions")
local clipboard_actions = require("lir.clipboard.actions")
require("lir").setup({
show_hidden_files = true,
devicons_enable = true,
mappings = {
["o"] = actions.edit,
["<Cr>"] = actions.edit,
["<C-s>"] = actions.split,
["<C-v>"] = actions.vsplit,
["<C-t>"] = actions.tabedit,
["u"] = actions.up,
["q"] = actions.quit,
["<Esc>"] = actions.quit,
["K"] = actions.mkdir,
["n"] = actions.newfile,
["r"] = actions.rename,
["@"] = actions.cd,
["Y"] = actions.yank_path,
["."] = actions.toggle_show_hidden,
["d"] = actions.delete,
["J"] = function()
mark_actions.toggle_mark()
vim.cmd("normal! j")
end,
["c"] = clipboard_actions.copy,
["x"] = clipboard_actions.cut,
["p"] = clipboard_actions.paste,
},
float = {
winblend = 0,
curdir_window = {
enable = true,
highlight_dirname = true,
},
-- -- You can define a function that returns a table to be passed as the third
-- -- argument of nvim_open_win().
-- win_opts = function()
-- local width = math.floor(vim.o.columns * 0.8)
-- local height = math.floor(vim.o.lines * 0.8)
-- return {
-- border = require("lir.float.helper").make_border_opts({
-- "+", "─", "+", "│", "+", "─", "+", "│",
-- }, "Normal"),
-- width = width,
-- height = height,
-- row = 1,
-- col = math.floor((vim.o.columns - width) / 2),
-- }
-- end,
},
hide_cursor = false,
on_init = function()
-- use visual mode
vim.api.nvim_buf_set_keymap(
0,
"x",
"J",
':<C-u>lua require"lir.mark.actions".toggle_mark("v")<CR>',
{ noremap = true, silent = true }
)
-- echo cwd
vim.api.nvim_echo({ { vim.fn.expand("%:p"), "Normal" } }, false, {})
end,
})
require("lir.git_status").setup({
show_ignored = false,
})
If I commented out nvim-tree from packer file lir becomes to work.
tamago324 commented
Set update_to_buf_dir.enable
to false
.
nvim_tree.setup({
update_to_buf_dir = {
enable = false
},
...
}