From 08fecd20c228ebee5d8ba9dccd9b2720235e0b0a Mon Sep 17 00:00:00 2001 From: Michael Grote Date: Sun, 31 Jul 2022 19:48:37 +0200 Subject: [PATCH] vim: nerdtree --- .vimrc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.vimrc b/.vimrc index 4b8fd64..e540c47 100644 --- a/.vimrc +++ b/.vimrc @@ -192,7 +192,7 @@ nmap Y y$ nnoremap sr :%s///gc vnoremap sr y:%s/"//gc " Toggle NERDTree -nnoremap :NERDTreeToggle +nnoremap :call ToggleNERDTreeFind() " toogle floaterm let g:floaterm_keymap_toggle = '' @@ -216,3 +216,13 @@ autocmd BufWritePre * :%s/\s\+$//e autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif " NERDTree - show hidden files let NERDTreeShowHidden=1 + +" NERDTREE - Find file or close +" https://stackoverflow.com/questions/14964020/is-it-possible-to-configure-behaviour-of-nerdtreetoggle-to-use-nerdtreefind-When +function! ToggleNERDTreeFind() + if g:NERDTree.IsOpen() + execute ':NERDTreeClose' + else + execute ':NERDTreeFind' + endif +endfunction