nvim: init.vim: Use floating window for FZF
Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
parent
f98349ed99
commit
01470159ef
1 changed files with 21 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue