From 643cdfef111f13805cba0ef7edb04aeed6c96c43 Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Tue, 21 Apr 2020 13:40:44 +0530 Subject: [PATCH] nvim: Some minor cleanups, additions and refactor Signed-off-by: Sanchayan Maity --- nvim/.config/nvim/after/ftplugin/c.vim | 6 +++++ nvim/.config/nvim/after/ftplugin/qf.vim | 5 +++++ nvim/.config/nvim/init.vim | 30 +++++++++++-------------- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/nvim/.config/nvim/after/ftplugin/c.vim b/nvim/.config/nvim/after/ftplugin/c.vim index 6188a5f..6f9b3e7 100644 --- a/nvim/.config/nvim/after/ftplugin/c.vim +++ b/nvim/.config/nvim/after/ftplugin/c.vim @@ -1,3 +1,9 @@ +" Create folds based on files syntax +set foldmethod=syntax +" Scanning included files when ^n is troublesome +set complete-=i +set path+=/usr/include/** + nmap ct :NeomakeSh ctags -R . nmap cu :NeomakeSh cscope -bqR nmap cr :cs reset diff --git a/nvim/.config/nvim/after/ftplugin/qf.vim b/nvim/.config/nvim/after/ftplugin/qf.vim index cef3cb1..50989b4 100644 --- a/nvim/.config/nvim/after/ftplugin/qf.vim +++ b/nvim/.config/nvim/after/ftplugin/qf.vim @@ -1,2 +1,7 @@ noremap p :call quickui#tools#preview_quickfix() +noremap [- :colder +noremap ]+ :cnewer + +" Close QF window if it is last window +autocmd WinEnter * if winnr('$') == 1 && &buftype == "quickfix" | q | endif diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim index 967f676..01201f5 100644 --- a/nvim/.config/nvim/init.vim +++ b/nvim/.config/nvim/init.vim @@ -146,7 +146,6 @@ set splitright " Vertical split to right of current. set nobackup " no backup files set nowritebackup " only in case you don't want a backup file while editing set noswapfile " no swap files -set foldmethod=syntax " Create folds based on files syntax set nofoldenable " Open folds by default set undofile " Enable undo persistence across sessions set hidden @@ -181,6 +180,7 @@ set autoread " Autoload file if it changes on disk set termguicolors " Enable colors for terminal set fileformat=unix set inccommand=split +set switchbuf=useopen set clipboard^=unnamed,unnamedplus set backspace=indent,eol,start @@ -202,8 +202,6 @@ cnoremap " Use Q to execute default register. nnoremap Q -" Bind vanilla buffer switching -nnoremap b :b " For Fuzzy nnoremap ff :GFiles nnoremap f? :GFiles? @@ -222,10 +220,10 @@ nnoremap fo :Locate nnoremap fk :Maps nnoremap f/ :Rg nnoremap fs :exe ':Rg ' . expand('') -imap (fzf-complete-word) -imap (fzf-complete-path) -imap (fzf-complete-file) -imap (fzf-complete-line) +imap (fzf-complete-word) +imap (fzf-complete-path) +imap (fzf-complete-file) +imap (fzf-complete-line) " Save nnoremap w :w " Search and Replace @@ -240,6 +238,9 @@ nnoremap [b :bprevious nnoremap ]b :bnext nnoremap [B :bfirst nnoremap ]B :blast +nnoremap b :b +nnoremap bl :ls:b +nnoremap bd :bd " For floating terminal nnoremap se :FloatermNew nnoremap [s :FloatermPrev @@ -389,16 +390,6 @@ augroup rainbow_lisp autocmd FileType lisp,clojure,scheme RainbowParentheses augroup END -augroup quickfix - au! - " Close QF window if it is last window - au WinEnter * if winnr('$') == 1 && &buftype == "quickfix"|q|endif - " Existing bindings for QFGrep - " g input pattern to do further filtering - " v input pattern to do further inverted filtering - " r restore the Quickfix/location list with original entries -augroup END - augroup terminal_job au! au TermOpen * startinsert @@ -412,6 +403,10 @@ augroup END " --------------------------- Plugin settings -------------------------------- " Use airline +let g:airline#extensions#keymap#enabled = 0 +let g:airline#extensions#whitespace#enabled = 0 +let g:airline#extensions#wordcount#enabled = 0 +let g:airline#extensions#term#enabled = 0 let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#tabline#fnamemod = ':t' let g:airline#extensions#tabline#left_sep = ' ' @@ -425,6 +420,7 @@ let g:airline_left_alt_sep = '|' let g:airline_right_sep = ' ' let g:airline_right_alt_sep = '|' let g:airline_section_y = '%{winnr()}' +let g:airline_highlighting_cache = 1 " Let vim-gitgutter do its thing on large files let g:gitgutter_max_signs=1000