Skip to content
Snippets Groups Projects
Commit 49c752b1 authored by Junegunn Choi's avatar Junegunn Choi
Browse files

[vim] up/down/left/right options to take boolean values

When 1 is given, 50% of the screen width or height will be used as the
default size of the pane.
parent daa79a6d
No related branches found
No related tags found
No related merge requests found
......@@ -130,11 +130,20 @@ function! fzf#run(...) abort
endif
endfunction
function! s:present(dict, ...)
for key in a:000
if !empty(get(a:dict, key, ''))
return 1
endif
endfor
return 0
endfunction
function! s:fzf_tmux(dict)
let size = ''
for o in ['up', 'down', 'left', 'right']
if has_key(a:dict, o)
let size = '-'.o[0].a:dict[o]
if s:present(a:dict, o)
let size = '-'.o[0].(a:dict[o] == 1 ? '' : a:dict[o])
endif
endfor
return printf('LINES=%d COLUMNS=%d %s %s %s --',
......@@ -142,14 +151,11 @@ function! s:fzf_tmux(dict)
endfunction
function! s:tmux_splittable(dict)
return has_key(a:dict, 'up') ||
\ has_key(a:dict, 'down') ||
\ has_key(a:dict, 'left') ||
\ has_key(a:dict, 'right')
return s:present(a:dict, 'up', 'down', 'left', 'right')
endfunction
function! s:pushd(dict)
if !empty(get(a:dict, 'dir', ''))
if s:present(a:dict, 'dir')
let a:dict.prev_dir = getcwd()
execute 'chdir '.s:escape(a:dict.dir)
return 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment