nvim: init.vim: Group the configurations

This commit is contained in:
Sanchayan Maity 2019-12-04 12:38:00 +05:30 committed by Sanchayan Maity
parent a2e5730165
commit 236048fb2f

View file

@ -1,6 +1,7 @@
" Specify a directory for plugins (for Neovim: ~/.local/share/nvim/plugged)
call plug#begin('~/.config/nvim/plugged')
" ----------------------------- Plugins --------------------------------------
" Automatically match structures as you type
Plug 'tpope/vim-endwise'
" Tab completion
@ -95,9 +96,7 @@ Plug 'jpalardy/vim-slime'
" Initialize plugin system
call plug#end()
syntax on
filetype plugin indent on
" ----------------------------- Settings -------------------------------------
" Set up leaders
let mapleader="\<SPACE>"
@ -175,6 +174,7 @@ set sessionoptions-=blank
syntax enable
colorscheme monokai
" --------------------------- Key Bindings -----------------------------------
" Use <C-L> to clear the highlighting of :set hlsearch.
if maparg('<C-L>', 'n') ==# ''
nnoremap <silent> <C-L> :nohlsearch<CR><C-L>
@ -301,6 +301,27 @@ noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
nnoremap <silent> <Leader>ss :call Cscope("s", expand('<cword>'))<CR>
nnoremap <silent> <Leader>sg :call Cscope("g", expand('<cword>'))<CR>
nnoremap <silent> <Leader>sd :call Cscope("d", expand('<cword>'))<CR>
nnoremap <silent> <Leader>sc :call Cscope("c", expand('<cword>'))<CR>
nnoremap <silent> <Leader>st :call Cscope("t", expand('<cword>'))<CR>
nnoremap <silent> <Leader>se :call Cscope("e", expand('<cword>'))<CR>
nnoremap <silent> <Leader>sf :call Cscope("f", expand('<cword>'))<CR>
nnoremap <silent> <Leader>si :call Cscope("i", expand('<cword>'))<CR>
nnoremap <silent> <Leader>sa :call Cscope("a", expand('<cword>'))<CR>
nnoremap <silent> <Leader><Leader>ss :call CscopeQuery("s")<CR>
nnoremap <silent> <Leader><Leader>sg :call CscopeQuery("g")<CR>
nnoremap <silent> <Leader><Leader>sd :call CscopeQuery("d")<CR>
nnoremap <silent> <Leader><Leader>sc :call CscopeQuery("c")<CR>
nnoremap <silent> <Leader><Leader>st :call CscopeQuery("t")<CR>
nnoremap <silent> <Leader><Leader>se :call CscopeQuery("e")<CR>
nnoremap <silent> <Leader><Leader>sf :call CscopeQuery("f")<CR>
nnoremap <silent> <Leader><Leader>si :call CscopeQuery("i")<CR>
nnoremap <silent> <Leader><Leader>sa :call CscopeQuery("a")<CR>
" --------------------------- Autocmd groups ---------------------------------
augroup deopleteMaps
au!
" For deoplete Rust
@ -345,8 +366,37 @@ let s:quitting = 0
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
let g:neomake_warning_sign = {'text': '?'}
augroup Terminal
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
" Automatically resize the window
autocmd VimResized * wincmd =
" --------------------------- Plugin settings --------------------------------
let g:haskell_enable_quantification = 1 " to enable highlighting of `forall`
let g:haskell_enable_recursivedo = 1 " to enable highlighting of `mdo` and `rec`
let g:haskell_enable_arrowsyntax = 1 " to enable highlighting of `proc`
@ -419,6 +469,7 @@ call neomake#configure#automake({
" When compilation is done, open the Location list or quickfix list
" Value of 2 preserves cursor position
let g:neomake_open_list = 2
let g:neomake_warning_sign = {'text': '?'}
" gutentags configuration
" https://www.reddit.com/r/vim/comments/d77t6j/guide_how_to_setup_ctags_with_gutentags_properly/
@ -467,35 +518,17 @@ let g:Lf_WindowPosition = 'popup'
let g:Lf_PreviewInPopup = 1
let g:Lf_CommandMap = {'<C-K>': ['<Up>'], '<C-J>': ['<Down>']}
augroup Terminal
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
" Automatically resize the window
autocmd VimResized * wincmd =
let g:nvimgdb_config_override = {
\ 'key_next': 'n',
\ 'key_step': 's',
\ 'key_finish': 'f',
\ 'key_continue': 'c',
\ 'key_until': 'u',
\ 'key_breakpoint': 'b',
\ 'set_tkeymaps': "NvimGdbNoTKeymaps",
\ }
" ----------------------------- Functions ------------------------------------
" For CScope and Quickfix
" https://medium.com/@lakshmankumar12/quickfix-and-location-list-in-vim-ca0292ac894d
" https://medium.com/@lakshmankumar12/vim-and-cscope-5f4558c8a8b8
@ -541,36 +574,6 @@ function! CscopeQuery(option)
endif
endfunction
nnoremap <silent> <Leader>ss :call Cscope("s", expand('<cword>'))<CR>
nnoremap <silent> <Leader>sg :call Cscope("g", expand('<cword>'))<CR>
nnoremap <silent> <Leader>sd :call Cscope("d", expand('<cword>'))<CR>
nnoremap <silent> <Leader>sc :call Cscope("c", expand('<cword>'))<CR>
nnoremap <silent> <Leader>st :call Cscope("t", expand('<cword>'))<CR>
nnoremap <silent> <Leader>se :call Cscope("e", expand('<cword>'))<CR>
nnoremap <silent> <Leader>sf :call Cscope("f", expand('<cword>'))<CR>
nnoremap <silent> <Leader>si :call Cscope("i", expand('<cword>'))<CR>
nnoremap <silent> <Leader>sa :call Cscope("a", expand('<cword>'))<CR>
nnoremap <silent> <Leader><Leader>ss :call CscopeQuery("s")<CR>
nnoremap <silent> <Leader><Leader>sg :call CscopeQuery("g")<CR>
nnoremap <silent> <Leader><Leader>sd :call CscopeQuery("d")<CR>
nnoremap <silent> <Leader><Leader>sc :call CscopeQuery("c")<CR>
nnoremap <silent> <Leader><Leader>st :call CscopeQuery("t")<CR>
nnoremap <silent> <Leader><Leader>se :call CscopeQuery("e")<CR>
nnoremap <silent> <Leader><Leader>sf :call CscopeQuery("f")<CR>
nnoremap <silent> <Leader><Leader>si :call CscopeQuery("i")<CR>
nnoremap <silent> <Leader><Leader>sa :call CscopeQuery("a")<CR>
function! NvimGdbNoTKeymaps()
tnoremap <silent> <buffer> <esc> <c-\><c-n>
endfunction
let g:nvimgdb_config_override = {
\ 'key_next': 'n',
\ 'key_step': 's',
\ 'key_finish': 'f',
\ 'key_continue': 'c',
\ 'key_until': 'u',
\ 'key_breakpoint': 'b',
\ 'set_tkeymaps': "NvimGdbNoTKeymaps",
\ }