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`\"" |
\ 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 <C-K> :py3f ~/.vim/syntax/clang-format.py<CR>
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
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("<cword>")
@ -342,9 +342,9 @@ if bufwinnr(1)
imap <C-Up> <ESC><C-Up>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 <F2> :tabe <C-R>=expand("%:h") . "/"<CR>
@ -459,8 +459,10 @@ cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' <bar> edit!
"""""""""""
" NerdTree
"""""""""""
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
map <F9> :NERDTreeToggle<CR>
augroup NerdGroup
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
map <F9> :NERDTreeToggle<CR>
augroup END
"""""""""""
" GitGutter
@ -653,7 +655,9 @@ if v:version >= 800
nmap <C-F1> <Plug>(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