chore: refacto setup part 1 (#603)
* chore: refacto setup part 1 refacto setup for code entrypoint following options switched boolean values as options to the setup function: - `nvim_tree_disable_netrw` -> `disable_netrw` - `nvim_tree_hijack_netrw` -> `hijack_netrw` - `nvim_tree_auto_open` -> `open_on_setup` - `nvim_tree_auto_close` -> `auto_close` - `nvim_tree_tab_open` -> `tab_open` - `nvim-tree-update-cwd` -> `update_cwd` - `nvim_tree_hijack_cursor` -> `hijack_cursor` - `nvim_tree_system_open_command` -> `system_open.cmd` - `nvim_tree_system_open_command_args` -> `system_open.args` - `nvim_tree_follow` -> `update_focused_file.enable` - `nvim_tree_follow_update_path` -> `update_focused_file.update_cwd` Also added new option `update_focused_file.ignore_list` which will ignore filepath or filetypes that matches one entry of the list when updating the path if update_cwd is true. * add deprecation warning * update readme * schedule on enter to avoid running before vim first buffer has loaded * update docs * correct typo * rename tab open -> open on tab
This commit is contained in:
@@ -1,49 +0,0 @@
|
||||
if !has('nvim-0.5') || exists('g:loaded_tree') | finish | endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
if get(g:, 'nvim_tree_disable_netrw', 1) == 1
|
||||
let g:loaded_netrw = 1
|
||||
let g:loaded_netrwPlugin = 1
|
||||
endif
|
||||
|
||||
augroup NvimTree
|
||||
if get(g:, 'nvim_tree_hijack_netrw', 1) == 1 && get(g:, 'nvim_tree_disable_netrw', 1) == 0
|
||||
silent! autocmd! FileExplorer *
|
||||
endif
|
||||
au BufWritePost * lua require'nvim-tree'.refresh()
|
||||
if get(g:, 'nvim_tree_lsp_diagnostics', 0) == 1
|
||||
au User LspDiagnosticsChanged lua require'nvim-tree.diagnostics'.update()
|
||||
endif
|
||||
au BufEnter * lua require'nvim-tree'.buf_enter()
|
||||
if get(g:, 'nvim_tree_auto_close') == 1
|
||||
au WinClosed * lua require'nvim-tree'.on_leave()
|
||||
endif
|
||||
au ColorScheme * lua require'nvim-tree'.reset_highlight()
|
||||
au User FugitiveChanged,NeogitStatusRefreshed lua require'nvim-tree'.refresh()
|
||||
if get(g:, 'nvim_tree_tab_open') == 1
|
||||
au TabEnter * lua require'nvim-tree'.tab_change()
|
||||
endif
|
||||
au SessionLoadPost * lua require'nvim-tree.view'._wipe_rogue_buffer()
|
||||
if get(g:, 'nvim_tree_hijack_cursor', 1) == 1
|
||||
au CursorMoved NvimTree lua require'nvim-tree'.place_cursor_on_node()
|
||||
endif
|
||||
if get(g:, 'nvim_tree_update_cwd') == 1
|
||||
au DirChanged * lua require'nvim-tree.lib'.change_dir(vim.loop.cwd())
|
||||
endif
|
||||
augroup end
|
||||
|
||||
command! NvimTreeOpen lua require'nvim-tree'.open()
|
||||
command! NvimTreeClose lua require'nvim-tree'.close()
|
||||
command! NvimTreeToggle lua require'nvim-tree'.toggle()
|
||||
command! NvimTreeFocus lua require'nvim-tree'.focus()
|
||||
command! NvimTreeRefresh lua require'nvim-tree'.refresh()
|
||||
command! NvimTreeClipboard lua require'nvim-tree'.print_clipboard()
|
||||
command! NvimTreeFindFile lua require'nvim-tree'.find_file(true)
|
||||
command! -nargs=1 NvimTreeResize lua require'nvim-tree'.resize(<args>)
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
let g:loaded_tree = 1
|
||||
Reference in New Issue
Block a user