1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 17:20:04 +08:00
SpaceVim/config/plugins/nvim-tree.vim

43 lines
1.2 KiB
VimL
Raw Normal View History

2022-05-19 09:03:59 +08:00
let s:WIN = SpaceVim#api#import('vim#window')
nnoremap <silent> <F3> <cmd>NvimTreeToggle<CR>
" we can not use this option to disable default key bindings
" let g:nvim_tree_disable_default_keybindings = 1
augroup vfinit
au!
autocmd FileType NvimTree call s:nvim_tree_init()
autocmd BufEnter * nested if
\ (!has('vim_starting') && s:WIN.win_count() == 1 && g:_spacevim_autoclose_filetree
\ && &filetype ==# 'NvimTree') |
\ call s:close_last_filetree() | endif
augroup END
function! s:close_last_filetree() abort
call SpaceVim#layers#shell#close_terminal()
q
endfunction
function! s:nvim_tree_init() abort
nnoremap <silent><buffer> . :<C-u>lua require'nvim-tree.actions'.on_keypress('toggle_dotfiles')<Cr>
endfunction
lua <<EOF
-- init.lua
-- empty setup using defaults: add your own options
require'nvim-tree'.setup {
view = {
width = vim.api.nvim_eval('g:spacevim_sidebar_width'),
height = 30,
hide_root_folder = false,
side = "right",
preserve_window_proportions = false,
number = false,
relativenumber = false,
signcolumn = "yes",
mappings = {
custom_only = true,
list = {
-- user mappings go here
},
},
},
}
EOF