feat: allow window width resize
This commit is contained in:
@@ -17,6 +17,7 @@ M.Tree = {
|
|||||||
buf_name = 'LuaTree',
|
buf_name = 'LuaTree',
|
||||||
cwd = nil,
|
cwd = nil,
|
||||||
win_width = vim.g.lua_tree_width or 30,
|
win_width = vim.g.lua_tree_width or 30,
|
||||||
|
win_width_allow_resize = vim.g.lua_tree_width_allow_resize,
|
||||||
loaded = false,
|
loaded = false,
|
||||||
bufnr = nil,
|
bufnr = nil,
|
||||||
winnr = function()
|
winnr = function()
|
||||||
@@ -195,10 +196,12 @@ function M.open_file(mode, filename)
|
|||||||
end
|
end
|
||||||
api.nvim_command(string.format("%s %s", mode, filename))
|
api.nvim_command(string.format("%s %s", mode, filename))
|
||||||
end
|
end
|
||||||
|
if M.Tree.win_width_allow_resize ~= true then
|
||||||
local cur_win = api.nvim_get_current_win()
|
local cur_win = api.nvim_get_current_win()
|
||||||
M.win_focus()
|
M.win_focus()
|
||||||
api.nvim_command('vertical resize '..M.Tree.win_width)
|
api.nvim_command('vertical resize '..M.Tree.win_width)
|
||||||
M.win_focus(cur_win)
|
M.win_focus(cur_win)
|
||||||
|
end
|
||||||
if vim.g.lua_tree_quit_on_open then
|
if vim.g.lua_tree_quit_on_open then
|
||||||
M.close()
|
M.close()
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user