diff --git a/nvim/.config/nvim/plugin/fzf.vim b/nvim/.config/nvim/plugin/fzf.vim index 256874a..efa3701 100644 --- a/nvim/.config/nvim/plugin/fzf.vim +++ b/nvim/.config/nvim/plugin/fzf.vim @@ -34,32 +34,15 @@ command! -bang -nargs=* FzfRgHidden " make fzf use the nvim floating window globally. (weee, technology!) " -let $FZF_DEFAULT_OPTS="--layout=reverse --margin=1,2" +let $FZF_DEFAULT_OPTS="--layout=reverse " " to use fzf in a floating window only conditionally, the best approach would -" probably be call fzf#run(fzf#wrap({ 'window': 'call FloatingFZF()' })) for " every command we want to floatize -let g:fzf_layout = { 'window': 'call FloatingFZF()' } - -function! FloatingFZF() - " create a minimal nofile scratch buffer - let buf = nvim_create_buf(v:false, v:true) - call setbufvar(buf, '&signcolumn', 'no') - - " this should probably change depending on fzf command - let height = float2nr(50) - let width = float2nr(200) - " center the window in editor - let horizontal = float2nr((&columns - width) / 2) - let vertical = float2nr((&lines - height) / 2) - - let opts = { - \ 'relative': 'editor', - \ 'row': vertical, - \ 'col': horizontal, - \ 'width': width, - \ 'height': height, - \ 'style': 'minimal' - \ } - - call nvim_open_win(buf, v:true, opts) -endfunction +if has('nvim-0.4.0') || has("patch-8.2.0191") + let g:fzf_layout = { 'window': { + \ 'width': 0.7, + \ 'height': 0.7, + \ 'highlight': 'PreProc', + \ 'border': 'rounded' } } +else " Fallback to a split window + let g:fzf_layout = { "window": "silent botright 16split enew" } +endif