add config to open or close automatically
This commit is contained in:
@@ -18,6 +18,8 @@ Plug 'kyazdani42/nvim-tree.lua'
|
|||||||
let g:lua_tree_side = 'right' | 'left' "left by default
|
let g:lua_tree_side = 'right' | 'left' "left by default
|
||||||
let g:lua_tree_size = 40 "30 by default
|
let g:lua_tree_size = 40 "30 by default
|
||||||
let g:lua_tree_ignore = [ '.git', 'node_modules', '.cache' ] "empty by default, not working on mac atm
|
let g:lua_tree_ignore = [ '.git', 'node_modules', '.cache' ] "empty by default, not working on mac atm
|
||||||
|
let g:lua_tree_auto_open = 1 "0 by default, opens the tree when typing `vim $DIR` or `vim`
|
||||||
|
let g:lua_tree_auto_close = 1 "0 by default, closes the tree when it's the last window
|
||||||
let g:lua_tree_follow = 1 "0 by default, this option will bind BufEnter to the LuaTreeFindFile command
|
let g:lua_tree_follow = 1 "0 by default, this option will bind BufEnter to the LuaTreeFindFile command
|
||||||
" :help LuaTreeFindFile for more info
|
" :help LuaTreeFindFile for more info
|
||||||
|
|
||||||
@@ -62,6 +64,7 @@ nnoremap <leader>n :LuaTreeFindFile<CR>
|
|||||||
- Tree creation should be async
|
- Tree creation should be async
|
||||||
- refactor all `system` call to `libuv` functions, with better error management
|
- refactor all `system` call to `libuv` functions, with better error management
|
||||||
- bufferize leafs of node being closed so when opening again the node, we open every directory that was previously open
|
- bufferize leafs of node being closed so when opening again the node, we open every directory that was previously open
|
||||||
|
- make config module to make it easier to add/modify user options
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
- sneak like cd command to find a file/directory
|
- sneak like cd command to find a file/directory
|
||||||
|
|||||||
@@ -57,7 +57,19 @@ Each pattern is passed into the 'ls' function as `--ignore=PATTERN`
|
|||||||
|g:lua_tree_follow| *g:lua_tree_follow*
|
|g:lua_tree_follow| *g:lua_tree_follow*
|
||||||
|
|
||||||
Can be `0` or `1`. When `1`, will bind |:LuaTreeFindFile| to |BufEnter|
|
Can be `0` or `1`. When `1`, will bind |:LuaTreeFindFile| to |BufEnter|
|
||||||
|
Default is 0
|
||||||
|
|
||||||
|
|g:lua_tree_auto_open| *g:lua_tree_auto_open*
|
||||||
|
|
||||||
|
Can be `0` or `1`. When `1`, will bind |VimEnter| to automatically
|
||||||
|
open tree on startup if no files are specified.
|
||||||
|
Default is 0
|
||||||
|
|
||||||
|
|g:lua_tree_auto_close| *g:lua_tree_auto_close*
|
||||||
|
|
||||||
|
Can be `0` or `1`. When `1`, will bind |BufEnter| to automatically
|
||||||
|
close the tree if it's the last window.
|
||||||
|
Default is 0
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
INFORMATIONS *nvim-tree-info*
|
INFORMATIONS *nvim-tree-info*
|
||||||
|
|||||||
2
doc/tags
2
doc/tags
@@ -1,6 +1,8 @@
|
|||||||
:LuaTreeFindFile nvim-tree-lua.txt /*:LuaTreeFindFile*
|
:LuaTreeFindFile nvim-tree-lua.txt /*:LuaTreeFindFile*
|
||||||
:LuaTreeRefresh nvim-tree-lua.txt /*:LuaTreeRefresh*
|
:LuaTreeRefresh nvim-tree-lua.txt /*:LuaTreeRefresh*
|
||||||
:LuaTreeToggle nvim-tree-lua.txt /*:LuaTreeToggle*
|
:LuaTreeToggle nvim-tree-lua.txt /*:LuaTreeToggle*
|
||||||
|
g:lua_tree_auto_open nvim-tree-lua.txt /*g:lua_tree_auto_open*
|
||||||
|
g:lua_tree_auto_open nvim-tree-lua.txt /*g:lua_tree_auto_open*
|
||||||
g:lua_tree_follow nvim-tree-lua.txt /*g:lua_tree_follow*
|
g:lua_tree_follow nvim-tree-lua.txt /*g:lua_tree_follow*
|
||||||
g:lua_tree_ignore nvim-tree-lua.txt /*g:lua_tree_ignore*
|
g:lua_tree_ignore nvim-tree-lua.txt /*g:lua_tree_ignore*
|
||||||
g:lua_tree_side nvim-tree-lua.txt /*g:lua_tree_side*
|
g:lua_tree_side nvim-tree-lua.txt /*g:lua_tree_side*
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ init_tree()
|
|||||||
|
|
||||||
local function toggle()
|
local function toggle()
|
||||||
if is_win_open() == true then
|
if is_win_open() == true then
|
||||||
close()
|
local wins = api.nvim_list_wins()
|
||||||
|
if #wins > 1 then close() end
|
||||||
else
|
else
|
||||||
open()
|
open()
|
||||||
update_view()
|
update_view()
|
||||||
|
|||||||
@@ -9,8 +9,14 @@ let g:loaded_netrwPlugin = 1
|
|||||||
hi def link LuaTreePopup Normal
|
hi def link LuaTreePopup Normal
|
||||||
|
|
||||||
au BufWritePost * lua require'tree'.refresh()
|
au BufWritePost * lua require'tree'.refresh()
|
||||||
|
|
||||||
|
if get(g:, 'lua_tree_auto_close') != 0
|
||||||
au BufEnter * lua require'tree'.check_windows_and_close()
|
au BufEnter * lua require'tree'.check_windows_and_close()
|
||||||
|
endif
|
||||||
|
|
||||||
|
if get(g:, 'lua_tree_auto_open') != 0
|
||||||
au VimEnter * lua require'tree'.check_buffer_and_open()
|
au VimEnter * lua require'tree'.check_buffer_and_open()
|
||||||
|
endif
|
||||||
|
|
||||||
" TODO set status line dynamically on bufenter in the luatree
|
" TODO set status line dynamically on bufenter in the luatree
|
||||||
" to remove lightline and other possible components
|
" to remove lightline and other possible components
|
||||||
|
|||||||
Reference in New Issue
Block a user