nvim-tree.lua/plugin/tree.vim
kyazdani42 f6e44c1726 cd to folder when doing nvim FOLDER and layout code
- when doing `nvim FOLDER` it works as expected, opening the tree
on the correct folder (updating the ROOT_PATH)
- add the code for keeping the tree window on the side no matter
what, but since the lack of window events, disable this feature.
2020-02-28 01:03:34 +01:00

28 lines
757 B
VimL

if has('win32') || exists('g:loaded_tree') | finish | endif
let s:save_cpo = &cpo
set cpo&vim
let g:loaded_netrw = 1
let g:loaded_netrwPlugin = 1
hi def link LuaTreePopup Normal
au BufWritePost * lua require'tree'.refresh()
au BufEnter * lua require'tree'.check_windows_and_close()
au VimEnter * lua require'tree'.check_buffer_and_open()
" TODO: WinEnter is not the right autocommand for this task,
" but we do not have LayoutChange or WinMove kind of option atm,
" so this is deactivated by default to avoid messing up users workflows
" au WinEnter * lua require'tree'.replace_tree()
command! LuaTreeToggle lua require'tree'.toggle()
command! LuaTreeRefresh lua require'tree'.refresh()
let &cpo = s:save_cpo
unlet s:save_cpo
let g:loaded_tree = 1