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