From fd1d4b4960d3067e8fbdd34b6ad078d1de36525c Mon Sep 17 00:00:00 2001 From: Riyyi Date: Sun, 11 Nov 2018 13:26:54 +0100 Subject: [PATCH] Wrap vim autocmd inside augroups --- .config/vim/ftplugin/tex.vim | 4 +++- .config/vim/vimrc | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.config/vim/ftplugin/tex.vim b/.config/vim/ftplugin/tex.vim index f5f3bc0..459dd94 100644 --- a/.config/vim/ftplugin/tex.vim +++ b/.config/vim/ftplugin/tex.vim @@ -21,4 +21,6 @@ noremap :setlocal spell spelllang=en_us,nl noremap :setlocal nospell " Start spell check when vim is run -autocmd VimEnter * call feedkeys("\") +augroup SpellCheck + autocmd! VimEnter * call feedkeys("\") +augroup END diff --git a/.config/vim/vimrc b/.config/vim/vimrc index c877c3a..38cee9a 100644 --- a/.config/vim/vimrc +++ b/.config/vim/vimrc @@ -93,10 +93,14 @@ let g:vimtex_view_method = 'zathura' "" Autocommands " Remove trailing whitespace in the following filetypes -autocmd FileType c,cpp,ino,java,py,php,sh,tex autocmd BufWritePre %s/\s\+$//e +augroup TrailingWhitespace + autocmd! FileType c,cpp,ino,java,py,php,sh,tex autocmd BufWritePre %s/\s\+$//e +augroup END " Close vim if only window is NERD Tree -autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif +augroup CloseVimTree + autocmd! bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif +augroup END "" Functions