From 13cea589057f20ee2551f6a588cbf8693be22faa Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Sun, 21 Jun 2020 09:51:12 +0530 Subject: [PATCH] nvim: Add back quickui again for floating preview windows Signed-off-by: Sanchayan Maity --- nvim/.config/nvim/after/ftplugin/qf.vim | 24 ++---------------------- nvim/.config/nvim/colors/molokai.vim | 8 ++++---- nvim/.config/nvim/colors/wombat.vim | 3 +++ nvim/.config/nvim/init.vim | 2 ++ nvim/.config/nvim/keymappings.vim | 1 + 5 files changed, 12 insertions(+), 26 deletions(-) diff --git a/nvim/.config/nvim/after/ftplugin/qf.vim b/nvim/.config/nvim/after/ftplugin/qf.vim index 3567815..cc0380d 100644 --- a/nvim/.config/nvim/after/ftplugin/qf.vim +++ b/nvim/.config/nvim/after/ftplugin/qf.vim @@ -15,30 +15,10 @@ setlocal nospell nnoremap [- :colder nnoremap ]+ :cnewer nnoremap g :Cfilter +nnoremap p :call quickui#tools#preview_quickfix() -nnoremap o p -nnoremap p :call preview_file() - -let b:qf_isLoc = ! empty(getloclist(0)) -if b:qf_isLoc == 1 +if !empty(getloclist(0)) == 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/colors/molokai.vim b/nvim/.config/nvim/colors/molokai.vim index a43f0a7..a3a30b7 100644 --- a/nvim/.config/nvim/colors/molokai.vim +++ b/nvim/.config/nvim/colors/molokai.vim @@ -17,10 +17,11 @@ if exists("syntax_on") endif let g:colors_name="molokai" +set background=dark + " vertical split lines should look like a line instead of a dashed one set fillchars+=vert:│ - hi Boolean guifg=#AE81FF hi Character guifg=#E6DB74 hi Number guifg=#AE81FF @@ -117,6 +118,5 @@ hi Conceal guifg=#f92672 guibg=bg hi Searchlight guifg=#FF00FF guibg=#000000 -" Must be at the end, because of ctermbg=234 bug. -" https://groups.google.com/forum/#!msg/vim_dev/afPqwAFNdrU/nqh6tOM87QUJ -set background=dark +hi QuickDefaultBackground guifg=#F8F8F2 guibg=NONE gui=NONE +hi QuickDefaultPreview guibg=NONE diff --git a/nvim/.config/nvim/colors/wombat.vim b/nvim/.config/nvim/colors/wombat.vim index 49e6a6f..1697808 100644 --- a/nvim/.config/nvim/colors/wombat.vim +++ b/nvim/.config/nvim/colors/wombat.vim @@ -94,5 +94,8 @@ hi ModeMsg guifg=#F6F3E8 guibg=NONE gui=NONE hi Searchlight guifg=#FF00FF guibg=#000000 +hi QuickDefaultBackground guifg=#F6F3E8 guibg=#000000 gui=NONE +hi QuickDefaultPreview guibg=#000000 + " Custom stuff hi Modified guifg=black guibg=#FFA500 diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim index 73c927e..96b240c 100644 --- a/nvim/.config/nvim/init.vim +++ b/nvim/.config/nvim/init.vim @@ -60,6 +60,8 @@ Plug 'christoomey/vim-system-copy' Plug 'caenrique/nvim-toggle-terminal' " Resize window with golden ratio Plug 'roman/golden-ratio' +" 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 5021e88..8229cc9 100644 --- a/nvim/.config/nvim/keymappings.vim +++ b/nvim/.config/nvim/keymappings.vim @@ -85,6 +85,7 @@ 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