Use -p option of split-window instead of manual calculation

This commit is contained in:
Junegunn Choi
2014-03-31 13:48:53 +09:00
parent 1a100a2919
commit af616457e3
2 changed files with 14 additions and 18 deletions

View File

@@ -115,20 +115,16 @@ function! s:execute_tmux(dict, command, temps)
let command = a:command
endif
if type(a:dict.tmux) == 1
if a:dict.tmux =~ '%$'
let height = &lines * str2nr(a:dict.tmux[0:-2]) / 100
else
let height = str2nr(a:dict.tmux)
endif
if type(a:dict.tmux) == 1 && a:dict.tmux =~ '%$'
let height = '-p '.a:dict.tmux[0:-2]
else
let height = a:dict.tmux
let height = '-l '.a:dict.tmux
endif
let s:pane = substitute(
\ system(
\ printf(
\ 'tmux split-window -l %d -P -F "#{pane_id}" %s',
\ 'tmux split-window %s -P -F "#{pane_id}" %s',
\ height, s:shellesc(command))), '\n', '', 'g')
let s:dict = a:dict
let s:temps = a:temps