Add autogroups as vim.cmd

This commit is contained in:
flyingscorpio@clevo 2022-08-01 13:05:27 +02:00
parent e3e9ad6b40
commit 2cc0530a2f
2 changed files with 39 additions and 0 deletions

View file

@ -4,3 +4,10 @@ require('remaps')
require('options')
require('plugins')
-- require('colors')
require('autogroups')
-- vim.cmd([[
-- set runtimepath^=~/.vim runtimepath+=~/.vim/after
-- let &packpath = &runtimepath
-- source ~/.vimrc
-- ]])

View file

@ -0,0 +1,32 @@
-- 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
]])