nvim: Add back quickui again for floating preview windows

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
Sanchayan Maity 2020-06-21 09:51:12 +05:30
parent 9e8562186a
commit 13cea58905
5 changed files with 12 additions and 26 deletions

View file

@ -15,30 +15,10 @@ setlocal nospell
nnoremap <buffer> [- :colder<CR>
nnoremap <buffer> ]+ :cnewer<CR>
nnoremap <buffer> <Leader>g :Cfilter<SPACE>
nnoremap <buffer> p :call quickui#tools#preview_quickfix()<CR>
nnoremap <buffer> o <CR><C-w>p
nnoremap <silent> <buffer> p :call <SID>preview_file()<CR>
let b:qf_isLoc = ! empty(getloclist(0))
if b:qf_isLoc == 1
if !empty(getloclist(0)) == 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

@ -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

View file

@ -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

View file

@ -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'

View file

@ -85,6 +85,7 @@ nnoremap L* :Glgrep! <cword><CR>
nnoremap Ls :Glgrep!<SPACE>
nnoremap Lt :call ToggleLocationList()<CR>
" Preview tags
nnoremap pf :call quickui#tools#preview_tag('')<cr>
nnoremap pt :ptag <C-R><C-W><CR>
nnoremap [p :ptprevious<CR>
nnoremap ]p :ptnext<CR>