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:
parent
de05c9c8f7
commit
f6880b715e
17
vim/vimrc
17
vim/vimrc
|
@ -82,36 +82,49 @@ syntax match jsonComment "\(/\*\)\|\(\*/\)"
|
||||||
hi def link jsonComment Comment
|
hi def link jsonComment Comment
|
||||||
|
|
||||||
|
|
||||||
|
augroup dvc
|
||||||
au BufRead dvc.yaml let b:ale_fix_on_save=0
|
au BufRead dvc.yaml let b:ale_fix_on_save=0
|
||||||
au BufRead *.dvc let b:ale_fix_on_save=0
|
au BufRead *.dvc let b:ale_fix_on_save=0
|
||||||
au BufRead *.dvc set filetype=yaml
|
au BufRead *.dvc set filetype=yaml
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
augroup ansible
|
||||||
au BufRead,BufNewFile */playbooks/*.yml set filetype=yaml.ansible
|
au BufRead,BufNewFile */playbooks/*.yml set filetype=yaml.ansible
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
augroup githubactions
|
||||||
au BufRead,BufNewFile */.github/*/*.y{,a}ml
|
au BufRead,BufNewFile */.github/*/*.y{,a}ml
|
||||||
\ let b:ale_linters = {'yaml': ['actionlint'] }
|
\ let b:ale_linters = {'yaml': ['actionlint'] }
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
augroup iptables
|
||||||
au BufRead,BufNewFile rules.v[46],*.rules setlocal filetype=iptables
|
au BufRead,BufNewFile rules.v[46],*.rules setlocal filetype=iptables
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
augroup vimconfig
|
||||||
autocmd! bufwritepost ~/.vimrc source ~/.vimrc
|
autocmd! bufwritepost ~/.vimrc source ~/.vimrc
|
||||||
autocmd! bufwritepost $DOTFILES/vim/vimrc source ~/.vimrc
|
autocmd! bufwritepost $DOTFILES/vim/vimrc source ~/.vimrc
|
||||||
autocmd! bufwritepost $DOTFILES/vim/shortcuts.vim source ~/.vimrc
|
autocmd! bufwritepost $DOTFILES/vim/shortcuts.vim source ~/.vimrc
|
||||||
autocmd! bufwritepost $DOTFILES/vim/plugs.vim PlugInstall
|
autocmd! bufwritepost $DOTFILES/vim/plugs.vim PlugInstall
|
||||||
autocmd! bufwritepost $DOTFILES/vim/plugs.vim PlugUpdate
|
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
|
||||||
|
|
||||||
|
augroup dotgit
|
||||||
" Return to last edit position when opening files (from amix's vimrc)
|
" 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
|
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
|
" set a marker to avoid returning to the previous position in .git folders
|
||||||
" (avoids returning to previous position for COMMIT_EDITMSG etc )
|
" (avoids returning to previous position for COMMIT_EDITMSG etc )
|
||||||
au BufReadPost */.git/* let b:dotgitFolder = 1
|
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>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user