nvim: init.vim: Miscellaneous key bindings and package updates

This commit is contained in:
Sanchayan Maity 2019-11-05 11:48:13 +05:30 committed by Sanchayan Maity
parent b950eb70da
commit e35e64bb05

View file

@ -1,8 +1,8 @@
" Specify a directory for plugins (for Neovim: ~/.local/share/nvim/plugged)
call plug#begin('~/.config/nvim/plugged')
" Automatically match brackets as you type
Plug 'Raimondi/delimitMate'
" Automatically match structures as you type
Plug 'tpope/vim-endwise'
" Tab completion
Plug 'ervandew/supertab'
" EasyMotion - Allows <leader><leader>(b|e) to jump to (b)eginning or (end)
@ -82,6 +82,7 @@ Plug 'unblevable/quick-scope'
Plug 'igankevich/mesonic'
Plug 'rhysd/vim-clang-format', { 'for': [ 'c', 'cpp'] }
Plug 'pelodelfuego/vim-swoop'
Plug 'adelarsq/vim-matchit'
" Initialize plugin system
call plug#end()
@ -132,6 +133,7 @@ set gdefault " Use 'g' flag by default with :s/foo/bar/.
set magic " Use 'magic' patterns (extended regular expressions).
set autoread " Autoload file if it changes on disk
set termguicolors " Enable colors for terminal
set fileformat=unix
set clipboard^=unnamed,unnamedplus
set completeopt=menuone,preview,noinsert
@ -171,7 +173,9 @@ nnoremap <Leader>w <Esc>:w<CR>
" Search and Replace
nnoremap <Leader>sr :%s//g<Left><Left>
" Quit
nnoremap <Leader>q <Esc>:q<CR>
nnoremap <Leader>x <Esc>:x<CR>
nnoremap <Leader>q <Esc>:q<CR>
nnoremap <Leader>qa <Esc>:qa<CR>
" Search for the word under cursor
noremap <Leader>d :exe ':Rg ' . expand('<cword>')<CR>
" Open terminal
@ -190,15 +194,23 @@ nnoremap <Leader>gc :Gcommit --signoff<CR>
nnoremap <Leader>gp :Git! push<CR>
nnoremap <Leader>gu :Git! push -u
nnoremap <Leader>gr :Git! remote -v<CR>
" For gitgutter
nnoremap <Leader>ghn :GitGutterNextHunk<CR>
nnoremap <Leader>ghp :GitGutterPrevHunk<CR>
nnoremap <Leader>ghs :GitGutterStageHunk<CR>
nnoremap <Leader>ghu :GitGutterUndoHunk<CR>
nnoremap <Leader>ghr :GitGutterPreviewHunk<CR>
nnoremap <Leader>gqf :GitGutterQuickFix<CR>
nnoremap <Leader>ggf :GitGutterFold<CR>
" For Cscope
nnoremap <Leader>cr :cs reset<CR>
" For Neomake
nnoremap <Leader>nm :Neomake<CR>
nnoremap <Leader>nr :NeomakeClean<CR>
nnoremap <Leader>nc :NeomakeClean<CR>
nnoremap <Leader>ns :NeomakeSh
nnoremap <Leader>nj :NeomakeListJobs<CR>
nnoremap <Leader>nca :NeomakeCancelJobs<CR>
nnoremap <Leader>ncj :NeomakeCancelJob
nnoremap <Leader>njl :NeomakeListJobs<CR>
nnoremap <Leader>nja :NeomakeCancelJobs<CR>
nnoremap <Leader>njc :NeomakeCancelJob
" Haskell specific
" For ghcid
@ -224,10 +236,10 @@ nnoremap <Leader>ffc :lclose<CR>
" Key Bindings to help with terminal mode
:tnoremap <Esc> <C-\><C-n>
" Key bindings to move between window splits
nnoremap <A-h> <C-w>h
nnoremap <A-j> <C-w>j
nnoremap <A-k> <C-w>k
nnoremap <A-l> <C-w>l
nnoremap gh <C-w>h
nnoremap gj <C-w>j
nnoremap gk <C-w>k
nnoremap gl <C-w>l
" Disable Arrow Keys
inoremap <Up> <NOP>
@ -315,7 +327,19 @@ let g:airline_right_sep = ' '
let g:airline_right_alt_sep = '|'
" Let vim-gitgutter do its thing on large files
let g:gitgutter_max_signs=10000
let g:gitgutter_max_signs=1000
" Neomake
" compile when I open a file, change text, leave insert mode, etc ...
call neomake#configure#automake({
\ 'TextChanged': {},
\ 'InsertLeave': {},
\ 'BufWritePost': {},
\ 'BufWinEnter': {}
\ })
" When compilation is done, open the Location list or quickfix list
" Value of 2 preserves cursor position
let g:neomake_open_list = 2
" gutentags configuration
" https://www.reddit.com/r/vim/comments/d77t6j/guide_how_to_setup_ctags_with_gutentags_properly/