diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2015-03-10 01:41:35 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2015-03-10 01:41:35 +0900 |
commit | 12d81e212f3bd933532e65ed0de9f06c7746f222 (patch) | |
tree | aa6fccdede81c7f9c43dc7383474393918c4b2f2 /bin | |
parent | c22e729d9c8810f8c227b353367c3b60ae333ee0 (diff) |
[vim] Use fzf-tmux script for tmux integration
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/fzf-tmux | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/bin/fzf-tmux b/bin/fzf-tmux index 0eb2e375..324562a2 100755 --- a/bin/fzf-tmux +++ b/bin/fzf-tmux @@ -7,9 +7,13 @@ opt="" skip="" swap="" close="" +term="" while [ $# -gt 0 ]; do arg="$1" case "$arg" in + -) + term=1 + ;; -w*|-h*|-d*|-u*|-r*|-l*) if [ -n "$skip" ]; then args+=("$1") @@ -53,7 +57,11 @@ while [ $# -gt 0 ]; do fi else if [ -n "$swap" ]; then - [[ "$arg" =~ ^.l ]] && max=$(tput cols) || max=$(tput lines) + if [[ "$arg" =~ ^.l ]]; then + [ -n "$COLUMNS" ] && max=$COLUMNS || max=$(tput cols) + else + [ -n "$LINES" ] && max=$LINES || max=$(tput lines) + fi size=$(( max - size )) [ $size -lt 0 ] && size=0 opt="$opt -l $size" @@ -103,7 +111,7 @@ envs="FZF_DEFAULT_OPTS=$(printf %q "$FZF_DEFAULT_OPTS") FZF_DEFAULT_COMMAND=$(pr mkfifo $fifo2 mkfifo $fifo3 -if [ -t 0 ]; then +if [ -n "$term" -o -t 0 ]; then tmux set-window-option -q synchronize-panes off \;\ split-window $opt "$envs"' sh -c "'$fzf' '"$fzf_args"' > '$fifo2'; echo \$? > '$fifo3' '"$close"'"' $swap else |