From bdde69d011436abdf9e90dff584981e83775d834 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Mon, 29 Jun 2020 22:26:13 +0900 Subject: [PATCH] [vim] Disable height calculation when 'preview' is found in the option string Fix #2093 And we'll phase out height specification with `~` prefix. --- README-VIM.md | 4 ++-- plugin/fzf.vim | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README-VIM.md b/README-VIM.md index be5bdbf..89b6cd0 100644 --- a/README-VIM.md +++ b/README-VIM.md @@ -128,7 +128,7 @@ let g:fzf_action = { " Default fzf layout " - down / up / left / right -let g:fzf_layout = { 'down': '~40%' } +let g:fzf_layout = { 'down': '40%' } " You can set up fzf window using a Vim command (Neovim or latest Vim 8 required) let g:fzf_layout = { 'window': 'enew' } @@ -416,7 +416,7 @@ When fzf starts in a terminal buffer, the file type of the buffer is set to `fzf`. So you can set up `FileType fzf` autocmd to customize the settings of the window. -For example, if you use the default layout (`{'down': '~40%'}`) on Neovim, you +For example, if you use the default layout (`{'down': '40%'}`) on Neovim, you might want to temporarily disable the statusline for a cleaner look. ```vim diff --git a/plugin/fzf.vim b/plugin/fzf.vim index fc45c79..e1a5d3d 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -629,6 +629,9 @@ function! s:calc_size(max, val, dict) endif let opts = $FZF_DEFAULT_OPTS.' '.s:evaluate_opts(get(a:dict, 'options', '')) + if opts =~ 'preview' + return size + endif let margin = match(opts, '--inline-info\|--info[^-]\{-}inline') > match(opts, '--no-inline-info\|--info[^-]\{-}\(default\|hidden\)') ? 1 : 2 let margin += stridx(opts, '--border') > stridx(opts, '--no-border') ? 2 : 0 if stridx(opts, '--header') > stridx(opts, '--no-header')