From a7c9c08371d27b550f3896ab554f6490871a7a0a Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Thu, 21 Jul 2016 01:46:45 +0900 Subject: [PATCH] [vim] Make :FZF command configurable with g:fzf_layout To make it consistent with the other commands in fzf.vim --- plugin/fzf.vim | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugin/fzf.vim b/plugin/fzf.vim index 76d9cfa..668af7d 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -21,7 +21,7 @@ " OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION " WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -let s:default_height = '40%' +let s:default_layout = { 'down': '~40%' } let s:fzf_go = expand(':h:h').'/bin/fzf' let s:install = expand(':h:h').'/install' let s:installed = 0 @@ -481,7 +481,12 @@ function! s:cmd(bang, ...) abort let opts.dir = substitute(remove(args, -1), '\\\(["'']\)', '\1', 'g') endif if !a:bang - let opts.down = get(g:, 'fzf_height', get(g:, 'fzf_tmux_height', s:default_height)) + " For backward compatibility + if !exists('g:fzf_layout') && exists('g:fzf_height') + let opts.down = g:fzf_height + else + let opts = extend(opts, get(g:, 'fzf_layout', s:default_layout)) + endif endif call fzf#run(extend({'options': join(args), 'sink*': function('cmd_callback')}, opts)) endfunction