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