nvim: init.vim: Open fuzzy search results in floating window
Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
parent
1f28479f98
commit
c5af132ec6
1 changed files with 24 additions and 0 deletions
|
@ -482,3 +482,27 @@ nnoremap <silent> <Leader><Leader>se :call CscopeQuery('6')<CR>
|
||||||
nnoremap <silent> <Leader><Leader>sf :call CscopeQuery('7')<CR>
|
nnoremap <silent> <Leader><Leader>sf :call CscopeQuery('7')<CR>
|
||||||
nnoremap <silent> <Leader><Leader>si :call CscopeQuery('8')<CR>
|
nnoremap <silent> <Leader><Leader>si :call CscopeQuery('8')<CR>
|
||||||
nnoremap <silent> <Leader><Leader>sa :call CscopeQuery('9')<CR>
|
nnoremap <silent> <Leader><Leader>sa :call CscopeQuery('9')<CR>
|
||||||
|
|
||||||
|
" Adapted from https://www.reddit.com/r/neovim/comments/djmehv/im_probably_really_late_to_the_party_but_fzf_in_a/
|
||||||
|
let g:skim_layout = { 'window': 'call FloatingSkim()' }
|
||||||
|
|
||||||
|
function! FloatingSkim()
|
||||||
|
let buf = nvim_create_buf(v:false, v:true)
|
||||||
|
call setbufvar(buf, '&signcolumn', 'no')
|
||||||
|
|
||||||
|
let height = float2nr(&lines * 0.4)
|
||||||
|
let width = float2nr(&columns * 0.8)
|
||||||
|
let horizontal = float2nr((&columns - width) / 2)
|
||||||
|
let vertical = float2nr((&columns - width) / 2)
|
||||||
|
|
||||||
|
let opts = {
|
||||||
|
\ 'relative': 'editor',
|
||||||
|
\ 'row': vertical,
|
||||||
|
\ 'col': horizontal,
|
||||||
|
\ 'width': width,
|
||||||
|
\ 'height': height,
|
||||||
|
\ 'style': 'minimal'
|
||||||
|
\ }
|
||||||
|
|
||||||
|
call nvim_open_win(buf, v:true, opts)
|
||||||
|
endfunction
|
||||||
|
|
Loading…
Reference in a new issue