nvim: Miscellaneous clean up

1. Clean up the remnants of Neomake and grepper config left behind
2. Drop quickui and use a custom preview function for items in QF
window stolen from floaterm plugin's author
3. Cleanups for vim default configuration settings like wildignore

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
Sanchayan Maity 2020-05-22 11:28:55 +05:30
parent db58f26760
commit bc6a097739
4 changed files with 76 additions and 62 deletions

View file

@ -1,11 +1,42 @@
setlocal nolist norelativenumber nowrap number nocursorline " Quit vim if the last window is qf
setlocal scrolloff=0 autocmd BufEnter <buffer> if winnr('$') < 2| q | endif
noremap <silent><buffer> p :call quickui#tools#preview_quickfix()<CR> setlocal scrolloff=0
setlocal nowrap
setlocal norelativenumber number
setlocal linebreak
setlocal nolist
setlocal nocursorline
setlocal nobuflisted
setlocal nospell
nnoremap <buffer> [- :colder<CR> nnoremap <buffer> [- :colder<CR>
nnoremap <buffer> ]+ :cnewer<CR> nnoremap <buffer> ]+ :cnewer<CR>
nnoremap <buffer> <Leader>g :Cfilter<SPACE> nnoremap <buffer> <Leader>g :Cfilter<SPACE>
" Close QF window if it is last window nnoremap <buffer> o <CR><C-w>p
autocmd WinEnter * if winnr('$') == 1 && &buftype == "quickfix" | q | endif nnoremap <silent> <buffer> p :call <SID>preview_file()<CR>
let b:qf_isLoc = ! empty(getloclist(0))
if b:qf_isLoc == 1
nnoremap <buffer> q <CR>:lclose<CR>
else
nnoremap <buffer> q <CR>:cclose<CR>
endif
" Taken from https://github.com/voldikss/dotfiles
function! s:preview_file()
let winwidth = &columns
let cur_list = b:qf_isLoc == 1 ? getloclist('.') : getqflist()
let cur_line = getline(line('.'))
let cur_file = fnameescape(substitute(cur_line, '|.*$', '', ''))
if cur_line =~# '|\d\+'
let cur_pos = substitute(cur_line, '^\(.\{-}|\)\(\d\+\)\(.*\)', '\2', '')
execute 'vertical pedit! +'.cur_pos.' '.cur_file
else
execute 'vertical pedit! '.cur_file
endif
wincmd P
execute 'vert resize '.(winwidth / 2)
wincmd p
endfunction

View file

@ -33,45 +33,50 @@ set hidden
set noautochdir set noautochdir
set hlsearch set hlsearch
set relativenumber set relativenumber
set nostartofline " Do not jump to first character with page commands.
set ignorecase " Make searching case insensitive
set smartcase " ... unless the query has capital letters.
set magic " Use 'magic' patterns (extended regular expressions).
set autoread " Autoload file if it changes on disk
set termguicolors " Enable colors for terminal
set completeopt-=menu
set completeopt+=menuone " Show the completions UI even with only 1 item
set completeopt-=longest " Don't insert the longest common text
set completeopt-=preview " Hide the documentation preview window
set completeopt+=noinsert " Don't insert text automatically
set completeopt-=noselect " Highlight the first completion automatically
" Required for vim-workspace
" See https://github.com/thaerkh/vim-workspace/issues/11
set sessionoptions-=blank
set fileformat=unix
set inccommand=split
set switchbuf=useopen
set backspace=indent,eol,start
set scrolloff=3 " Show next 3 lines while scrolling.
set sidescrolloff=5 " Show next 5 columns while side-scrolling.
" Wild menu " Wild menu
set wildmenu set wildmenu
set wildmode=list:longest,full set wildmode=list:longest,full
set wildoptions=pum set wildoptions=pum
set pumblend=30 set pumblend=30
set wildignore+=.hg,.git,.svn " Version control set wildignore=*.o,*.obj,*~,*.exe,*.a,*.pdb,*.lib
set wildignore+=*.aux,*.out,*.toc " LaTeX intermediate files set wildignore+=__pycache__,.stversions,*.spl,*.out,%*
set wildignore+=*.jpg,*.bmp,*.gif,*.png,*.jpeg " binary images set wildignore+=*.so,*.dll,*.swp,*.egg,*.jar,*.class,*.pyc,*.pyo,*.bin,*.dex
set wildignore+=*.o " compiled object files set wildignore+=*.zip,*.7z,*.rar,*.gz,*.tar,*.gzip,*.bz2,*.tgz,*.xz
set wildignore+=*.sw? " Vim swap files set wildignore+=*DS_Store*,*.ipch
set wildignore+=*.luac " Lua byte code set wildignore+=*.gem
set wildignore+=*.pyc " Python byte code set wildignore+=*.png,*.jpg,*.gif,*.bmp,*.tga,*.pcx,*.ppm,*.img,*.iso
set wildignore+=*.orig " Merge resolution files set wildignore+=*.so,*.swp,*.zip,*/.Trash/**,*.pdf,*.dmg,*/.rbenv/**
set wildignore+=**/node_modules/** " Ignore garbage node_modules set wildignore+=*/.nx/**,*.app,*.git,.git
set wildignore+=**/output/** " Ignore Purescript output directory set wildignore+=*.wav,*.mp3,*.ogg,*.pcm
set wildignore+=*.mht,*.suo,*.sdf,*.jnlp
if !&scrolloff set wildignore+=*.chm,*.epub,*.pdf,*.mobi,*.ttf
set scrolloff=3 " Show next 3 lines while scrolling. set wildignore+=*.mp4,*.avi,*.flv,*.mov,*.mkv,*.swf,*.swc
endif set wildignore+=*.ppt,*.pptx,*.docx,*.xlt,*.xls,*.xlsx,*.odt,*.wps
if !&sidescrolloff set wildignore+=*.msi,*.crx,*.deb,*.vfd,*.apk,*.ipa,*.bin,*.msu
set sidescrolloff=5 " Show next 5 columns while side-scrolling. set wildignore+=*.gba,*.sfc,*.078,*.nds,*.smd,*.smc
endif set wildignore+=*.linux2,*.win32,*.darwin,*.freebsd,*.linux,*.android
set nostartofline " Do not jump to first character with page commands.
set ignorecase " Make searching case insensitive
set smartcase " ... unless the query has capital letters.
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 inccommand=split
set switchbuf=useopen
set backspace=indent,eol,start
set completeopt=menu,noselect,preview,noinsert
" Required for vim-workspace
" See https://github.com/thaerkh/vim-workspace/issues/11
set sessionoptions-=blank
" Disable providers we do not give a shit about " Disable providers we do not give a shit about
let g:loaded_python_provider = 0 let g:loaded_python_provider = 0

View file

@ -21,7 +21,7 @@ Plug 'wellle/tmux-complete.vim'
" Git support " Git support
Plug 'lambdalisue/gina.vim' Plug 'lambdalisue/gina.vim'
Plug 'airblade/vim-gitgutter' Plug 'airblade/vim-gitgutter'
Plug 'rhysd/git-messenger.vim' Plug 'rhysd/git-messenger.vim', { 'on': 'GitMessenger' }
Plug 'rhysd/conflict-marker.vim' Plug 'rhysd/conflict-marker.vim'
Plug 'whiteinge/diffconflicts' Plug 'whiteinge/diffconflicts'
Plug 'salcode/vim-interactive-rebase-reverse' Plug 'salcode/vim-interactive-rebase-reverse'
@ -39,7 +39,6 @@ Plug 'hauleth/asyncdo.vim'
Plug 'ronakg/quickr-cscope.vim' Plug 'ronakg/quickr-cscope.vim'
Plug 'stefandtw/quickfix-reflector.vim' Plug 'stefandtw/quickfix-reflector.vim'
Plug 'milkypostman/vim-togglelist' Plug 'milkypostman/vim-togglelist'
Plug 'skywind3000/vim-quickui'
Plug 'yssl/QFEnter' Plug 'yssl/QFEnter'
" Text Object plugins " Text Object plugins
Plug 'kana/vim-textobj-user' Plug 'kana/vim-textobj-user'
@ -74,7 +73,7 @@ Plug 'Twinside/vim-hoogle', { 'for': 'haskell' }
Plug 'godlygeek/tabular', { 'for': 'haskell' } Plug 'godlygeek/tabular', { 'for': 'haskell' }
Plug 'ndmitchell/ghcid', { 'rtp': 'plugins/nvim' } Plug 'ndmitchell/ghcid', { 'rtp': 'plugins/nvim' }
" Rust " Rust
Plug 'rust-lang/rust.vim' Plug 'rust-lang/rust.vim', { 'for': 'rust' }
Plug 'sebastianmarkow/deoplete-rust', { 'for': 'rust' } Plug 'sebastianmarkow/deoplete-rust', { 'for': 'rust' }
" Purescript " Purescript
Plug 'purescript-contrib/purescript-vim' Plug 'purescript-contrib/purescript-vim'

View file

@ -10,17 +10,6 @@ let g:gitgutter_sign_removed = '-r'
let g:gitgutter_sign_removed_first_line = '^^' let g:gitgutter_sign_removed_first_line = '^^'
let g:gitgutter_sign_modified_removed = 'mr' let g:gitgutter_sign_modified_removed = 'mr'
" Neomake
" 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': '?'}
let g:neomake_c_enabled_makers = ['gcc']
let g:neomake_c_gcc_maker = {
\ 'exe': 'gcc',
\ 'args': ['-Wall', '-Iinclude', '-Wextra', '-Weverything', '-pedantic', '-Wno-sign-conversion'],
\ }
" Automatically detect style file and apply style to formatting " Automatically detect style file and apply style to formatting
let g:clang_format#detect_style_file = 1 let g:clang_format#detect_style_file = 1
" Fix tab behaviour while switching through completion options " Fix tab behaviour while switching through completion options
@ -63,16 +52,6 @@ let g:floaterm_height = 0.8
let g:floaterm_winblend = 0 let g:floaterm_winblend = 0
let g:floaterm_borderchars = ['─', '│', '─', '│', '╭', '╮', '╯', '╰'] let g:floaterm_borderchars = ['─', '│', '─', '│', '╭', '╮', '╯', '╰']
" Vim grepper
let g:grepper = {}
let g:grepper.tools = ['rg']
let g:grepper.quickfix = 1
let g:grepper.buffer = 0
let g:grepper.buffers = 0
let g:grepper.switch = 0
let g:grepper.append = 0
let g:grepper.prompt = 0
" Incremental search " Incremental search
let g:incsearch#auto_nohlsearch = 1 let g:incsearch#auto_nohlsearch = 1