nvim: init.vim: Use floating window for FZF

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
Sanchayan Maity 2019-12-07 15:14:39 +05:30
parent f98349ed99
commit 01470159ef

View file

@ -611,3 +611,24 @@ endfunction
function! NvimGdbNoTKeymaps()
tnoremap <silent> <buffer> <Esc> <C-\><C-n>
endfunction
let $FZF_DEFAULT_OPTS='--layout=reverse'
let g:fzf_layout = { 'window': 'call FloatingFZF()' }
function! FloatingFZF()
let buf = nvim_create_buf(v:false, v:true)
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
\ }
" open the new window, floating, and enter to it
call nvim_open_win(buf, v:true, opts)
endfunction