From aa99ea7e0c90380df54836219dd8e03190c44f3b Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Tue, 7 Jul 2020 20:52:28 +0530 Subject: [PATCH] nvim: Drop quickui Revert 13cea58905. This does not play well with defined color scheme and overrides it which is annoying. The VimEnter approach mentioned did not work, so just drop it and use preview windows as earlier. Signed-off-by: Sanchayan Maity --- nvim/.config/nvim/after/ftplugin/qf.vim | 24 ++++++++++++++++++++++-- nvim/.config/nvim/init.vim | 2 -- nvim/.config/nvim/keymappings.vim | 1 - 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/nvim/.config/nvim/after/ftplugin/qf.vim b/nvim/.config/nvim/after/ftplugin/qf.vim index cc0380d..07ce1cf 100644 --- a/nvim/.config/nvim/after/ftplugin/qf.vim +++ b/nvim/.config/nvim/after/ftplugin/qf.vim @@ -15,10 +15,30 @@ setlocal nospell nnoremap [- :colder nnoremap ]+ :cnewer nnoremap g :Cfilter -nnoremap p :call quickui#tools#preview_quickfix() -if !empty(getloclist(0)) == 1 +nnoremap o p +nnoremap p :call preview_file() + +let b:qf_isLoc = ! empty(getloclist(0)) +if b:qf_isLoc == 1 nnoremap q :lclose else nnoremap q :cclose 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 diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim index 238c919..6b9ddf2 100644 --- a/nvim/.config/nvim/init.vim +++ b/nvim/.config/nvim/init.vim @@ -61,8 +61,6 @@ Plug 'liuchengxu/vim-which-key' Plug 'christoomey/vim-system-copy' " Toggle terminal Plug 'caenrique/nvim-toggle-terminal' -" Floating preview -Plug 'skywind3000/vim-quickui' " LSP Plug 'neovim/nvim-lsp' Plug 'haorenW1025/diagnostic-nvim' diff --git a/nvim/.config/nvim/keymappings.vim b/nvim/.config/nvim/keymappings.vim index a394bcd..fcecf54 100644 --- a/nvim/.config/nvim/keymappings.vim +++ b/nvim/.config/nvim/keymappings.vim @@ -59,7 +59,6 @@ nnoremap L* :Glgrep! nnoremap Ls :Glgrep! nnoremap Lt :call ToggleLocationList() " Preview tags -nnoremap pf :call quickui#tools#preview_tag('') nnoremap pt :ptag nnoremap [p :ptprevious nnoremap ]p :ptnext