Prevent opening buffers in NERDTree
This commit is contained in:
@@ -102,6 +102,11 @@ augroup CloseVimTree
|
|||||||
autocmd! bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
|
autocmd! bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
|
augroup PreventBuffer
|
||||||
|
autocmd FileType nerdtree let t:nerdtree_winnr = bufwinnr('%')
|
||||||
|
autocmd BufWinEnter * call PreventBuffersInNERDTree()
|
||||||
|
augroup END
|
||||||
|
|
||||||
"" Functions
|
"" Functions
|
||||||
|
|
||||||
function! CloseTab()
|
function! CloseTab()
|
||||||
@@ -120,6 +125,18 @@ function! CloseTab()
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! PreventBuffersInNERDTree()
|
||||||
|
if bufname('#') =~ 'NERD_tree' && bufname('%') !~ 'NERD_tree'
|
||||||
|
\ && exists('t:nerdtree_winnr') && bufwinnr('%') == t:nerdtree_winnr
|
||||||
|
\ && &buftype == ''
|
||||||
|
let bufnum = bufnr('%')
|
||||||
|
close
|
||||||
|
execute 'b ' . bufnum
|
||||||
|
execute ':NERDTree'
|
||||||
|
execute "normal! \<c-w>\<c-w>"
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
"" Keybindings
|
"" Keybindings
|
||||||
|
|
||||||
" Tab/Shift+Tab functionality
|
" Tab/Shift+Tab functionality
|
||||||
|
|||||||
Reference in New Issue
Block a user