nvim: init.vim: Cleanup autocmd groups

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
Sanchayan Maity 2019-12-08 12:24:17 +05:30
parent 51d0f409b6
commit 0527052815

View file

@ -325,7 +325,7 @@ command! -bang -nargs=* GGrep
\ fzf#vim#with_preview({'dir': systemlist('git rev-parse --show-toplevel')[0]}), <bang>0)
" --------------------------- Autocmd groups ---------------------------------
augroup HaskellMaps
augroup haskell_maps
au!
au FileType haskell nmap <Leader>ht :NeomakeSh stack exec -- fast-tags -R .<CR>
au FileType haskell nmap <Leader>hg :Ghcid<CR>
@ -335,7 +335,7 @@ augroup HaskellMaps
au FileType haskell nmap <Leader>hi :exe ':HoogleInfo ' . expand('<cword>')<CR>
augroup END
augroup CMaps
augroup c_maps
au!
au FileType c nmap <Leader>ct :NeomakeSh ctags -R .<CR>
au FileType c nmap <Leader>cu :NeomakeSh cscope -bqR<CR>
@ -362,7 +362,7 @@ augroup CMaps
au FileType c nmap <silent> <Leader><Leader>sa :call CscopeQuery("a")<CR>
augroup END
augroup deopleteMaps
augroup rust_maps
au!
au FileType rust nmap <buffer> <Leader>rd <plug>DeopleteRustGoToDefinitionDefault
au FileType rust nmap <buffer> <Leader>rc <plug>DeopleteRustShowDocumentation
@ -376,22 +376,25 @@ augroup rainbow_lisp
autocmd FileType lisp,clojure,scheme RainbowParentheses
augroup END
" Starts the REPL.
autocmd FileType scheme nnoremap <buffer> <Leader>rc :SchemeConnect<cr>
" Evaluates the outer most / top level form and jumps the cursor back to where it was.
autocmd FileType scheme nnoremap <buffer> <Leader>re :normal mscpaF<cr>`s
" Evaluates the entire file.
autocmd FileType scheme nnoremap <buffer> <Leader>rf :normal msggcpG<cr>`s
augroup scheme_maps
au!
" Starts the REPL.
autocmd FileType scheme nnoremap <buffer> <Leader>rc :SchemeConnect<cr>
" Evaluates the outer most / top level form and jumps the cursor back to where it was.
autocmd FileType scheme nnoremap <buffer> <Leader>re :normal mscpaF<cr>`s
" Evaluates the entire file.
autocmd FileType scheme nnoremap <buffer> <Leader>rf :normal msggcpG<cr>`s
augroup END
" Toggles search highlighting off/on according to current mode. Source: http://blog.sanctum.geek.nz/vim-search-highlighting/
augroup ToggleSearchHighlighting
augroup toggle_search
autocmd!
autocmd InsertEnter * setlocal nohlsearch
autocmd InsertLeave * setlocal hlsearch
augroup END
" Close QF window if it is last window
augroup QFClose
augroup quickfix_close
au!
au WinEnter * if winnr('$') == 1 && &buftype == "quickfix"|q|endif
augroup END
@ -406,32 +409,33 @@ au QuitPre *.rs let s:quitting = 1
au BufEnter *.rs let s:quitting = 0
au BufWritePost *.rs if ! s:quitting | Neomake | else | echom "Neomake disabled"| endif
augroup Terminal
augroup terminal_job
au!
au TermOpen * setlocal statusline=%{b:terminal_job_id}
augroup END
" Default indentations
autocmd BufRead,BufNewFile */gst-*/*.[ch] set et sw=2
autocmd BufRead,BufNewFile */gstreamer-*/*.[ch] set et sw=2
autocmd BufRead,BufNewFile */pulseaudio/*.[ch] set et sw=4 tw=128
" Configure expanding of tabs for various file types
au BufRead,BufNewFile *.c set noexpandtab
au BufRead,BufNewFile *.h set noexpandtab
au BufRead,BufNewFile Makefile* set noexpandtab
au BufNewFile,BufRead *.vim setlocal noet ts=4 sw=4 sts=4
au BufNewFile,BufRead *.txt setlocal noet ts=4 sw=4
" Lua settings
autocmd BufNewFile,BufRead *.lua setlocal noet ts=4 sw=4 sts=4
" Python indent
autocmd BufNewFile,BufRead *.py setlocal tabstop=4 softtabstop=4 shiftwidth=4 textwidth=80 smarttab expandtab
" Shell/config/systemd settings
autocmd FileType fstab,systemd set noexpandtab
autocmd FileType gitconfig,sh,toml set noexpandtab
" Spell check for git commits
autocmd FileType gitcommit setlocal spell
" Spell Checking
autocmd BufRead,BufNewFile *.md,*.txt setlocal spell spelllang=en_uk
augroup indentation_defaults
au!
au BufRead,BufNewFile *.c set noexpandtab
au BufRead,BufNewFile *.h set noexpandtab
au BufRead,BufNewFile Makefile* set noexpandtab
au BufNewFile,BufRead *.vim setlocal noet ts=4 sw=4 sts=4
au BufNewFile,BufRead *.txt setlocal noet ts=4 sw=4
autocmd BufNewFile,BufRead *.lua setlocal noet ts=4 sw=4 sts=4
autocmd BufNewFile,BufRead *.py setlocal tabstop=4 softtabstop=4 shiftwidth=4 textwidth=80 smarttab expandtab
autocmd FileType fstab,systemd set noexpandtab
autocmd FileType gitconfig,sh,toml set noexpandtab
autocmd BufRead,BufNewFile */gst-*/*.[ch] set et sw=2
autocmd BufRead,BufNewFile */gstreamer-*/*.[ch] set et sw=2
autocmd BufRead,BufNewFile */pulseaudio/*.[ch] set et sw=4 tw=128
augroup END
augroup spell_check
au!
autocmd FileType gitcommit setlocal spell
autocmd BufRead,BufNewFile *.md,*.txt setlocal spell spelllang=en_uk
augroup END
" Automatically resize the window
autocmd VimResized * wincmd =