From baf94304cc8167be3a61b73a3000bdf1e2a18145 Mon Sep 17 00:00:00 2001 From: don philipe Date: Wed, 17 Apr 2024 22:44:34 +0200 Subject: [PATCH] Replace NERDTreeTabs plug Remove named plugin and replace it with native NERDTree configuration to display NERDTree in all tabs (mirroring). Add C-x as tab closing shortcut. Custom command :NT now opens NERDTree instead of NERDTreeToggle --- .vimrc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.vimrc b/.vimrc index 6c171b2..ffd9e00 100644 --- a/.vimrc +++ b/.vimrc @@ -37,9 +37,10 @@ inoremap > strpart(getline('.'), col('.')-1, 1) == ">" ? "\" : ">" " Tab navigation " new tab and move to previous window (NERDTree if open) -nmap :tabnew :wincmd p +nmap :tabnew :wincmd h nmap :tabprev nmap :tabnext +nmap :tabclose " Resize windows with arrow keys nmap :res -1 @@ -63,6 +64,9 @@ if empty(glob(data_dir . '/autoload/plug.vim')) autocmd VimEnter * PlugInstall --sync | source $MYVIMRC endif +" Open the existing NERDTree on each new tab +autocmd BufWinEnter * if &buftype != 'quickfix' && getcmdwintype() == '' | silent NERDTreeMirror | endif + " Shortcut for JSON formatting via jq if executable('jq') command JQ %!jq . @@ -77,9 +81,6 @@ Plug 'pearofducks/ansible-vim' " NERDtree Plug 'preservim/nerdtree' -" One NERDtree for all tabs -Plug 'jistr/vim-nerdtree-tabs' - " Git plugin for NERDtree Plug 'Xuyuanp/nerdtree-git-plugin' @@ -138,7 +139,7 @@ call plug#end() " Set alias command for toggeling nerd tree -command NT NERDTreeTabsToggle +command NT NERDTree " special configuration: