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