From ca56b27b9ed2d24bddc21b463e6d1d2a4870cc33 Mon Sep 17 00:00:00 2001 From: Augusto Gunsch Date: Sun, 22 Aug 2021 17:40:06 -0300 Subject: [PATCH] Group autocommands --- config/nvim/init.vim | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/config/nvim/init.vim b/config/nvim/init.vim index 4d30860..59cd7fc 100644 --- a/config/nvim/init.vim +++ b/config/nvim/init.vim @@ -60,22 +60,25 @@ Plug 'tpope/vim-fugitive' call plug#end() -nnoremap :NERDTreeToggle +nnoremap :silent NERDTreeToggle -augroup nerdtree - autocmd FileType c silent if !exists('b:NERDTree') | silent NERDTree | endif +augroup nerdtree_start + autocmd FileType c silent if !exists('b:NERDTree') | silent NERDTree | au! nerdtree_start | endif augroup END -" Exit Vim if NERDTree is the only window remaining in the only tab. -autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif -" Close the tab if NERDTree is the only window remaining in it. -autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif -" Open the existing NERDTree on each new tab. -autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif +augroup nerdtree + " Exit Vim if NERDTree is the only window remaining in the only tab. + autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif + " Close the tab if NERDTree is the only window remaining in it. + autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif + " Open the existing NERDTree on each new tab. + autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif +augroup END let g:airline_theme = "powerlineish" let g:airline#extensions#tabline#enabled = 1 let g:airline_powerline_fonts = 1 +let g:airline#extensions#nerdtree_statusline = 1 lua << EOF