32 lines
1.3 KiB
Lua
32 lines
1.3 KiB
Lua
-- AUTOGROUPS
|
|
|
|
vim.cmd([[
|
|
augroup configgroup
|
|
autocmd!
|
|
|
|
" Run Flake8 on write in python files
|
|
autocmd BufWritePost *.py call flake8#Flake8()
|
|
" Open pdf after entering .ly file for side-by-side
|
|
autocmd VimEnter *.ly silent ![ -f ./%:r.pdf ] && zathura %:r.pdf &
|
|
" Run lilypond after save on .ly files
|
|
autocmd BufWritePost *.ly !lilypond --silent %
|
|
|
|
" Toggle relative number and absolute number according to focus and insert
|
|
autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
|
|
autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber
|
|
|
|
" FileType autocommands
|
|
autocmd FileType rust nnoremap <F9> :RustFmt<CR>
|
|
autocmd FileType python nnoremap <F9> :Black<CR>
|
|
autocmd FileType html,htmldjango,lilypond,python,tex,plaintex,yaml setlocal foldmethod=indent
|
|
autocmd FileType python setlocal colorcolumn=80
|
|
autocmd BufEnter Makefile,*.asm setlocal noexpandtab tabstop=6 shiftwidth=6 softtabstop=0
|
|
autocmd BufEnter *.sh setlocal shiftwidth=2 tabstop=2 softtabstop=2 foldlevel=0 foldmethod=marker
|
|
autocmd FileType yaml setlocal shiftwidth=4 tabstop=4 softtabstop=4
|
|
autocmd FileType vhdl setlocal shiftwidth=2 tabstop=2 softtabstop=2
|
|
|
|
autocmd BufRead,BufNewFile */playbooks/*.yml set filetype=yaml.ansible
|
|
autocmd BufRead,BufNewFile *.neomuttrc set filetype=neomuttrc
|
|
|
|
augroup END
|
|
]])
|