1
0
mirror of https://git.decapod.one/brethil/dotfiles synced 2024-11-21 19:11:30 +01:00

vim: group autocommands in augroups

This commit is contained in:
bretello 2023-09-15 00:13:32 +02:00
parent de05c9c8f7
commit f6880b715e
Signed by: brethil
GPG Key ID: 876AAC6290170FE7

View File

@ -82,36 +82,49 @@ syntax match jsonComment "\(/\*\)\|\(\*/\)"
hi def link jsonComment Comment
au BufRead dvc.yaml let b:ale_fix_on_save=0
au BufRead *.dvc let b:ale_fix_on_save=0
au BufRead *.dvc set filetype=yaml
augroup dvc
au BufRead dvc.yaml let b:ale_fix_on_save=0
au BufRead *.dvc let b:ale_fix_on_save=0
au BufRead *.dvc set filetype=yaml
augroup END
au BufRead,BufNewFile */playbooks/*.yml set filetype=yaml.ansible
au BufRead,BufNewFile */.github/*/*.y{,a}ml
augroup ansible
au BufRead,BufNewFile */playbooks/*.yml set filetype=yaml.ansible
augroup END
augroup githubactions
au BufRead,BufNewFile */.github/*/*.y{,a}ml
\ let b:ale_linters = {'yaml': ['actionlint'] }
au BufRead,BufNewFile rules.v[46],*.rules setlocal filetype=iptables
augroup END
augroup iptables
au BufRead,BufNewFile rules.v[46],*.rules setlocal filetype=iptables
augroup END
autocmd! bufwritepost ~/.vimrc source ~/.vimrc
autocmd! bufwritepost $DOTFILES/vim/vimrc source ~/.vimrc
autocmd! bufwritepost $DOTFILES/vim/shortcuts.vim source ~/.vimrc
autocmd! bufwritepost $DOTFILES/vim/plugs.vim PlugInstall
autocmd! bufwritepost $DOTFILES/vim/plugs.vim PlugUpdate
augroup vimconfig
autocmd! bufwritepost ~/.vimrc source ~/.vimrc
autocmd! bufwritepost $DOTFILES/vim/vimrc source ~/.vimrc
autocmd! bufwritepost $DOTFILES/vim/shortcuts.vim source ~/.vimrc
autocmd! bufwritepost $DOTFILES/vim/plugs.vim PlugInstall
autocmd! bufwritepost $DOTFILES/vim/plugs.vim PlugUpdate
augroup END
if has('persistent_undo')
let undo_dir=$HOME . "/.vim/undo"
if !isdirectory(undo_dir)
call mkdir(undo_dir , "p", 0o700)
call mkdir(undo_dir , "p", 0700)
endif
let &undodir=undo_dir
set undofile
endif
" Return to last edit position when opening files (from amix's vimrc)
au BufReadPost * if ! exists('b:dotgitFolder') | if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
" set a marker to avoid returning to the previous position in .git folders
" (avoids returning to previous position for COMMIT_EDITMSG etc )
au BufReadPost */.git/* let b:dotgitFolder = 1
augroup dotgit
" Return to last edit position when opening files (from amix's vimrc)
au BufReadPost * if ! exists('b:dotgitFolder') | if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
" set a marker to avoid returning to the previous position in .git folders
" (avoids returning to previous position for COMMIT_EDITMSG etc )
au BufReadPost */.git/* let b:dotgitFolder = 1
augroup END
" Bash like keys for the command line
cnoremap <C-A> <Home>