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) " Specify a directory for plugins (for Neovim: ~/.local/share/nvim/plugged)
call plug#begin('~/.config/nvim/plugged') call plug#begin('~/.config/nvim/plugged')
" Automatically match brackets as you type " Automatically match structures as you type
Plug 'Raimondi/delimitMate' Plug 'tpope/vim-endwise'
" Tab completion " Tab completion
Plug 'ervandew/supertab' Plug 'ervandew/supertab'
" EasyMotion - Allows <leader><leader>(b|e) to jump to (b)eginning or (end) " 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 'igankevich/mesonic'
Plug 'rhysd/vim-clang-format', { 'for': [ 'c', 'cpp'] } Plug 'rhysd/vim-clang-format', { 'for': [ 'c', 'cpp'] }
Plug 'pelodelfuego/vim-swoop' Plug 'pelodelfuego/vim-swoop'
Plug 'adelarsq/vim-matchit'
" Initialize plugin system " Initialize plugin system
call plug#end() 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 magic " Use 'magic' patterns (extended regular expressions).
set autoread " Autoload file if it changes on disk set autoread " Autoload file if it changes on disk
set termguicolors " Enable colors for terminal set termguicolors " Enable colors for terminal
set fileformat=unix
set clipboard^=unnamed,unnamedplus set clipboard^=unnamed,unnamedplus
set completeopt=menuone,preview,noinsert set completeopt=menuone,preview,noinsert
@ -171,7 +173,9 @@ nnoremap <Leader>w <Esc>:w<CR>
" Search and Replace " Search and Replace
nnoremap <Leader>sr :%s//g<Left><Left> nnoremap <Leader>sr :%s//g<Left><Left>
" Quit " Quit
nnoremap <Leader>x <Esc>:x<CR>
nnoremap <Leader>q <Esc>:q<CR> nnoremap <Leader>q <Esc>:q<CR>
nnoremap <Leader>qa <Esc>:qa<CR>
" Search for the word under cursor " Search for the word under cursor
noremap <Leader>d :exe ':Rg ' . expand('<cword>')<CR> noremap <Leader>d :exe ':Rg ' . expand('<cword>')<CR>
" Open terminal " Open terminal
@ -190,15 +194,23 @@ nnoremap <Leader>gc :Gcommit --signoff<CR>
nnoremap <Leader>gp :Git! push<CR> nnoremap <Leader>gp :Git! push<CR>
nnoremap <Leader>gu :Git! push -u nnoremap <Leader>gu :Git! push -u
nnoremap <Leader>gr :Git! remote -v<CR> 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 " For Cscope
nnoremap <Leader>cr :cs reset<CR> nnoremap <Leader>cr :cs reset<CR>
" For Neomake " For Neomake
nnoremap <Leader>nm :Neomake<CR> nnoremap <Leader>nm :Neomake<CR>
nnoremap <Leader>nr :NeomakeClean<CR> nnoremap <Leader>nc :NeomakeClean<CR>
nnoremap <Leader>ns :NeomakeSh nnoremap <Leader>ns :NeomakeSh
nnoremap <Leader>nj :NeomakeListJobs<CR> nnoremap <Leader>njl :NeomakeListJobs<CR>
nnoremap <Leader>nca :NeomakeCancelJobs<CR> nnoremap <Leader>nja :NeomakeCancelJobs<CR>
nnoremap <Leader>ncj :NeomakeCancelJob nnoremap <Leader>njc :NeomakeCancelJob
" Haskell specific " Haskell specific
" For ghcid " For ghcid
@ -224,10 +236,10 @@ nnoremap <Leader>ffc :lclose<CR>
" Key Bindings to help with terminal mode " Key Bindings to help with terminal mode
:tnoremap <Esc> <C-\><C-n> :tnoremap <Esc> <C-\><C-n>
" Key bindings to move between window splits " Key bindings to move between window splits
nnoremap <A-h> <C-w>h nnoremap gh <C-w>h
nnoremap <A-j> <C-w>j nnoremap gj <C-w>j
nnoremap <A-k> <C-w>k nnoremap gk <C-w>k
nnoremap <A-l> <C-w>l nnoremap gl <C-w>l
" Disable Arrow Keys " Disable Arrow Keys
inoremap <Up> <NOP> inoremap <Up> <NOP>
@ -315,7 +327,19 @@ let g:airline_right_sep = ' '
let g:airline_right_alt_sep = '|' let g:airline_right_alt_sep = '|'
" Let vim-gitgutter do its thing on large files " 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 " gutentags configuration
" https://www.reddit.com/r/vim/comments/d77t6j/guide_how_to_setup_ctags_with_gutentags_properly/ " https://www.reddit.com/r/vim/comments/d77t6j/guide_how_to_setup_ctags_with_gutentags_properly/