Skip to content
Myr

[fzf-tmux/vim/nvim] Do not split small window

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Close #699

authored by Junegunn Choi · committed by Junegunn Choi · parent 60112de · Browse files · 2 files+21 added−18 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+21 added−18 removed

  • other:+21 added−18 removed

2 files+21 added−18 removed

modified:bin/fzf-tmux+3 added-2 removed
15 unmodified lines
16swap=""17close=""18term=""19[[ -n "$LINES" ]] && lines=$LINES || lines=$(tput lines)20[[ -n "$COLUMNS" ]] && columns=$COLUMNS || columns=$(tput cols)2122help() {23 >&2 echo 'usage: fzf-tmux [-u|-d [HEIGHT[%]]] [-l|-r [WIDTH[%]]] [--] [FZF OPTIONS]24
58 unmodified lines
83 fi84 else85 if [[ -n "$swap" ]]; then86 if [[ "$arg" =~ ^.l ]]; then86 [[ -n "$COLUMNS" ]] && max=$COLUMNS || max=$(tput cols)87 max=$columns88 else89 max=$lines90 fi91 size=$(( max - size ))
16 unmodified lines
108 esac109 [[ -n "$skip" ]] && args+=("$arg")110done111111if [[ -z "$TMUX" ]] || [[ "$lines" -le 15 ]]; then112if [[ -z "$TMUX" ]] || [[ "$opt" =~ ^-h ]] && [[ "$columns" -le 40 ]] || [[ ! "$opt" =~ ^-h ]] && [[ "$lines" -le 15 ]]; then113 "$fzf" "${args[@]}"114 exit $?115fi116
64 unmodified lines
modified:plugin/fzf.vim+18 added-16 removed
287 unmodified lines
288 \ &lines, &columns, s:shellesc(s:fzf_tmux), size, (has_key(a:dict, 'source') ? '' : '-'))289endfunction290291function! s:splittable(dict)292 return s:present(a:dict, 'up', 'down', 'left', 'right')292 return s:present(a:dict, 'up', 'down') && &lines > 15 ||293 \ s:present(a:dict, 'left', 'right') && &columns > 40294endfunction295296function! s:pushd(dict)297 if s:present(a:dict, 'dir')
107 unmodified lines
405 \ 'left': ['vertical topleft', 'vertical resize', &columns],406 \ 'right': ['vertical botright', 'vertical resize', &columns] }407 let ppos = s:getpos()408 try408 for [dir, triple] in items(directions)409 let val = get(a:dict, dir, '')410 if !empty(val)411 let [cmd, resz, max] = triple412 if (dir == 'up' || dir == 'down') && val[0] == '~'413 let sz = s:calc_size(max, val, a:dict)414 else415 let sz = s:calc_size(max, val, {})416 endif417 execute cmd sz.'new'418 execute resz sz419 return [ppos, {}]420 endif421 endfor409 if s:present(a:dict, 'window')410 execute a:dict.window424 else411 elseif !s:splittable(a:dict)412 execute (tabpagenr()-1).'tabnew'413 else414 for [dir, triple] in items(directions)415 let val = get(a:dict, dir, '')416 if !empty(val)417 let [cmd, resz, max] = triple418 if (dir == 'up' || dir == 'down') && val[0] == '~'419 let sz = s:calc_size(max, val, a:dict)420 else421 let sz = s:calc_size(max, val, {})422 endif423 execute cmd sz.'new'424 execute resz sz425 return [ppos, {}]426 endif427 endfor428 endif429 return [ppos, { '&l:wfw': &l:wfw, '&l:wfh': &l:wfh }]430 finally431 setlocal winfixwidth winfixheight
146 unmodified lines