From 8c3bb42a3566ed25870b2378e48de4bce1ff2514 Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Fri, 24 Sep 2021 22:32:32 +0200 Subject: [PATCH] vim: wrap au with group --- .vimrc | 49 ++++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/.vimrc b/.vimrc index 3f579ae..d57e984 100644 --- a/.vimrc +++ b/.vimrc @@ -99,18 +99,17 @@ augroup vimStartup \ exe "normal! g`\"" | \ endif + " Check that file have not been changed + " CursorHold : after cursor move + " WinEnter or BufWinEnter + au WinEnter * checktime + au BufWinEnter * checktime augroup END " command line history set history=1000 set tabpagemax=50 -" Check that file have not been changed -" CursorHold : after cursor move -" WinEnter or BufWinEnter -au WinEnter * checktime -au BufWinEnter * checktime - """"""""" " INPUT " """"""""" @@ -188,7 +187,7 @@ set shiftwidth=8 "filetype specific action -if has("autocmd") +augroup IrisPython au Filetype markdown set tabstop=4 shiftwidth=4 softtabstop=4 au BufRead,BufNewFile *.iris set ft=python au BufRead,BufNewFile *.ino set tabstop=4 shiftwidth=4 softtabstop=4 @@ -204,8 +203,7 @@ if has("autocmd") autocmd Filetype python set equalprg=autopep8\ - iab sefl self iab slef self - -endif +augroup END " vim -b : edit binary using xxd-format! augroup Binary @@ -230,7 +228,9 @@ fu DetectIndent() endfu " detect indentation see http://www.freehackers.org/Indent_Finder -autocmd BufReadPost /* call DetectIndent() +augroup IndentFind + autocmd BufReadPost /* call DetectIndent() +augroup END noremap :py3f ~/.vim/syntax/clang-format.py inoremap :py3f ~/.vim/syntax/clang-format.pyi @@ -282,10 +282,10 @@ nmap :TagbarToggle " close preview window after a completion -if has("autocmd") +augroup AutoCompletion autocmd CursorMovedI *.{[hc],cpp} if pumvisible() == 0|pclose|endif autocmd InsertLeave *.{[hc],cpp} if pumvisible() == 0|pclose|endif -endif +augroup END function! TagInNewTab() let word = expand("") @@ -342,9 +342,9 @@ if bufwinnr(1) imap a endif " open automatically quickfix window -if has("autocmd") +augroup QuickFix autocmd QuickFixCmdPost * cw -endif +augroup END " open a file in the same directory as the current file with F2 and split with shift+F2 map :tabe =expand("%:h") . "/" @@ -459,8 +459,10 @@ cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' edit! """"""""""" " NerdTree """"""""""" -autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif -map :NERDTreeToggle +augroup NerdGroup + autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif + map :NERDTreeToggle +augroup END """"""""""" " GitGutter @@ -653,7 +655,9 @@ if v:version >= 800 nmap (lcn-menu) endif endfunction - autocmd FileType * call LC_maps() + augroup LSP + autocmd FileType * call LC_maps() + augroup END else "Syntax checking | Install flake8 or pylint for python " Install shellcheck for bash @@ -717,8 +721,10 @@ Plugin 'rhysd/vim-grammarous' Plugin 'junegunn/goyo.vim' Plugin 'junegunn/limelight.vim' -autocmd! User GoyoEnter Limelight -autocmd! User GoyoLeave Limelight! +augroup LimeGroup + autocmd! User GoyoEnter Limelight + autocmd! User GoyoLeave Limelight! +augroup END "Complete delimiters Plugin 'Raimondi/delimitMate.git' @@ -756,8 +762,9 @@ let g:tex_conceal='abdmg' let g:polyglot_disabled = ['latex'] " Visual incrementation. increment in block with ctrl-A -Plugin 'triglav/vim-visual-increment' -set nrformats=alpha,octal,hex +"-> use g ctr-a instead +"Plugin 'triglav/vim-visual-increment' +"set nrformats=alpha,octal,hex Plugin 'christoomey/vim-tmux-navigator' let g:tmux_navigator_no_mappings=1