Use -p option of split-window instead of manual calculation
This commit is contained in:
parent
1a100a2919
commit
af616457e3
20
install
20
install
@ -115,14 +115,14 @@ __fsel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
__fsel_tmux() {
|
__fsel_tmux() {
|
||||||
local height lines
|
local height
|
||||||
height=${FZF_TMUX_HEIGHT:-40%}
|
height=${FZF_TMUX_HEIGHT:-40%}
|
||||||
lines=${LINES:-40}
|
|
||||||
if [[ $height =~ %$ ]]; then
|
if [[ $height =~ %$ ]]; then
|
||||||
height=${height:0:${#height}-1}
|
height="-p ${height%\%}"
|
||||||
height=$(( height * lines / 100 ))
|
else
|
||||||
|
height="-l $height"
|
||||||
fi
|
fi
|
||||||
tmux split-window -l $height "tmux send-keys -t $TMUX_PANE \"\$($__fsel)\""
|
tmux split-window $height "tmux send-keys -t $TMUX_PANE \"\$($__fsel)\""
|
||||||
}
|
}
|
||||||
|
|
||||||
__fcd() {
|
__fcd() {
|
||||||
@ -189,14 +189,14 @@ EOF
|
|||||||
|
|
||||||
if [ -n "$TMUX_PANE" -a ${FZF_TMUX:-1} -ne 0 -a ${LINES:-40} -gt 15 ]; then
|
if [ -n "$TMUX_PANE" -a ${FZF_TMUX:-1} -ne 0 -a ${LINES:-40} -gt 15 ]; then
|
||||||
fzf-file-widget() {
|
fzf-file-widget() {
|
||||||
local height lines
|
local height
|
||||||
height=${FZF_TMUX_HEIGHT:-40%}
|
height=${FZF_TMUX_HEIGHT:-40%}
|
||||||
lines=${LINES:-40}
|
|
||||||
if [[ $height =~ %$ ]]; then
|
if [[ $height =~ %$ ]]; then
|
||||||
height=${height:0:${#height}-1}
|
height="-p ${height%\%}"
|
||||||
height=$(( height * lines / 100 ))
|
else
|
||||||
|
height="-l $height"
|
||||||
fi
|
fi
|
||||||
tmux split-window -l $height "tmux send-keys -t $TMUX_PANE \"\$($__fsel)\""
|
tmux split-window $height "tmux send-keys -t $TMUX_PANE \"\$($__fsel)\""
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fzf-file-widget() {
|
fzf-file-widget() {
|
||||||
|
@ -115,20 +115,16 @@ function! s:execute_tmux(dict, command, temps)
|
|||||||
let command = a:command
|
let command = a:command
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if type(a:dict.tmux) == 1
|
if type(a:dict.tmux) == 1 && a:dict.tmux =~ '%$'
|
||||||
if a:dict.tmux =~ '%$'
|
let height = '-p '.a:dict.tmux[0:-2]
|
||||||
let height = &lines * str2nr(a:dict.tmux[0:-2]) / 100
|
|
||||||
else
|
else
|
||||||
let height = str2nr(a:dict.tmux)
|
let height = '-l '.a:dict.tmux
|
||||||
endif
|
|
||||||
else
|
|
||||||
let height = a:dict.tmux
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let s:pane = substitute(
|
let s:pane = substitute(
|
||||||
\ system(
|
\ system(
|
||||||
\ printf(
|
\ 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')
|
\ height, s:shellesc(command))), '\n', '', 'g')
|
||||||
let s:dict = a:dict
|
let s:dict = a:dict
|
||||||
let s:temps = a:temps
|
let s:temps = a:temps
|
||||||
|
Loading…
x
Reference in New Issue
Block a user