vim: wrap au with group

This commit is contained in:
Mathieu Maret 2021-09-24 22:32:32 +02:00
parent 17ab57f18a
commit 8c3bb42a35
1 changed files with 28 additions and 21 deletions

49
.vimrc
View File

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