fix allow_resize and document it

This commit is contained in:
kyazdani42 2020-10-24 09:04:02 +02:00
parent 87a4d60bbc
commit 48d433d059
3 changed files with 8 additions and 1 deletions

View File

@ -37,6 +37,7 @@ let g:lua_tree_hide_dotfiles = 1 "0 by default, this option hides files and fold
let g:lua_tree_git_hl = 1 "0 by default, will enable file highlight for git attributes (can be used without the icons). let g:lua_tree_git_hl = 1 "0 by default, will enable file highlight for git attributes (can be used without the icons).
let g:lua_tree_root_folder_modifier = ':~' "This is the default. See :help filename-modifiers for more options let g:lua_tree_root_folder_modifier = ':~' "This is the default. See :help filename-modifiers for more options
let g:lua_tree_tab_open = 1 "0 by default, will open the tree when entering a new tab and the tree was previously open let g:lua_tree_tab_open = 1 "0 by default, will open the tree when entering a new tab and the tree was previously open
let g:lua_tree_allow_resize = 1 "0 by default, will not resize the tree when opening a file
let g:lua_tree_show_icons = { let g:lua_tree_show_icons = {
\ 'git': 1, \ 'git': 1,
\ 'folders': 0, \ 'folders': 0,

View File

@ -169,6 +169,12 @@ Can be 0 or 1. When 1, will open the tree when entering a new tab if the
tree was previously open. tree was previously open.
Default is 0 Default is 0
|g:lua_tree_allow_resize| *g:lua_tree_allow_resize*
Can be 0 or 1. When 1, it will not resize the tree to it's original width
when opening a new file.
Default is 0
============================================================================== ==============================================================================
INFORMATIONS *nvim-tree-info* INFORMATIONS *nvim-tree-info*

View File

@ -196,7 +196,7 @@ 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 if not M.Tree.win_width_allow_resize 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)