diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2020-09-12 21:08:05 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2020-09-12 21:14:32 +0900 |
commit | c60ed1758315f0d993fbcbf04459944c87e19a48 (patch) | |
tree | ef9183638391630c0157be73a32ee2b64c259239 /plugin | |
parent | e0f0b5bcf9e42d16ca4e1007e6d1b170388b3edc (diff) |
[vim] Change the default layout to use popup window
The new default is
{ 'window' : { 'width': 0.9, 'height': 0.6, 'highlight': 'Normal' } }
The default highlight group for the border of the popup window is
'Comment', but 'Normal' seems to be a safer choice.
If you prefer the previous default, add this to your Vim configuration file:
let g:fzf_layout = { 'down': '40%' }
(fzf will fall back to this if popup window is not supported)
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/fzf.vim | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/plugin/fzf.vim b/plugin/fzf.vim index 2e12739e..83e1cef5 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -115,7 +115,6 @@ function! s:fzf_tempname() return s:fzf_call('tempname') endfunction -let s:default_layout = { 'down': '~40%' } let s:layout_keys = ['window', 'tmux', 'up', 'down', 'left', 'right'] let s:fzf_go = s:base_dir.'/bin/fzf' let s:fzf_tmux = s:base_dir.'/bin/fzf-tmux' @@ -123,6 +122,16 @@ let s:fzf_tmux = s:base_dir.'/bin/fzf-tmux' let s:cpo_save = &cpo set cpo&vim +function! s:popup_support() + return has('nvim') ? has('nvim-0.4') : has('popupwin') && has('patch-8.2.191') +endfunction + +function! s:default_layout() + return s:popup_support() + \ ? { 'window' : { 'width': 0.9, 'height': 0.6, 'highlight': 'Normal' } } + \ : { 'down': '~40%' } +endfunction + function! fzf#install() if s:is_win && !has('win32unix') let script = s:base_dir.'/install.ps1' @@ -325,7 +334,7 @@ function! fzf#wrap(...) if !exists('g:fzf_layout') && exists('g:fzf_height') let opts.down = g:fzf_height else - let opts = extend(opts, s:validate_layout(get(g:, 'fzf_layout', s:default_layout))) + let opts = extend(opts, s:validate_layout(get(g:, 'fzf_layout', s:default_layout()))) endif endif @@ -658,7 +667,7 @@ function! s:split(dict) try if s:present(a:dict, 'window') if type(a:dict.window) == type({}) - if !(has('nvim') ? has('nvim-0.4') : has('popupwin') && has('patch-8.2.191')) + if !s:popup_support() throw 'Nvim 0.4+ or Vim 8.2.191+ with popupwin feature is required for pop-up window' end call s:popup(a:dict.window) |