mirror of https://github.com/Llewellynvdm/fzf.git
Allow specifying fzf options in $FZF_TMUX_OPTS without '--'
This commit is contained in:
parent
779d8e1627
commit
19f9bbca0d
|
@ -8,8 +8,11 @@ CHANGELOG
|
||||||
```sh
|
```sh
|
||||||
fzf-tmux -p70%
|
fzf-tmux -p70%
|
||||||
fzf-tmux -p70% --color=border:bright-red
|
fzf-tmux -p70% --color=border:bright-red
|
||||||
fzf-tmux -p100%,60% --color=border:bright-yellow --border=horizontal
|
fzf-tmux -p100%,60% --color=border:bright-yellow --border=horizontal --padding 1,5 --margin 1,0
|
||||||
fzf-tmux -p70%,100% --color=border:bright-green --border=vertical
|
fzf-tmux -p70%,100% --color=border:bright-green --border=vertical
|
||||||
|
|
||||||
|
# Key bindings (CTRL-T, CTRL-R, ALT-C) will use these options
|
||||||
|
export FZF_TMUX_OPTS='-p100%,60% --color=border:green --border=horizontal --padding 1,5 --margin 1,0'
|
||||||
```
|
```
|
||||||
|
|
||||||
0.32.0
|
0.32.0
|
||||||
|
|
|
@ -10,7 +10,6 @@ fail() {
|
||||||
fzf="$(command -v fzf 2> /dev/null)" || fzf="$(dirname "$0")/fzf"
|
fzf="$(command -v fzf 2> /dev/null)" || fzf="$(dirname "$0")/fzf"
|
||||||
[[ -x "$fzf" ]] || fail 'fzf executable not found'
|
[[ -x "$fzf" ]] || fail 'fzf executable not found'
|
||||||
|
|
||||||
tmux_args=()
|
|
||||||
args=()
|
args=()
|
||||||
opt=""
|
opt=""
|
||||||
skip=""
|
skip=""
|
||||||
|
@ -119,8 +118,6 @@ while [[ $# -gt 0 ]]; do
|
||||||
# "--" can be used to separate fzf-tmux options from fzf options to
|
# "--" can be used to separate fzf-tmux options from fzf options to
|
||||||
# avoid conflicts
|
# avoid conflicts
|
||||||
skip=1
|
skip=1
|
||||||
tmux_args=("${args[@]}")
|
|
||||||
args=()
|
|
||||||
continue
|
continue
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -212,7 +209,7 @@ if [[ "$opt" =~ "-E" ]]; then
|
||||||
cat <&0 > $fifo1 &
|
cat <&0 > $fifo1 &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tmux popup -d "$PWD" "${tmux_args[@]}" $opt "bash $argsf" > /dev/null 2>&1
|
tmux popup -d "$PWD" $opt "bash $argsf" > /dev/null 2>&1
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -226,7 +223,7 @@ else
|
||||||
fi
|
fi
|
||||||
tmux set-window-option synchronize-panes off \;\
|
tmux set-window-option synchronize-panes off \;\
|
||||||
set-window-option remain-on-exit off \;\
|
set-window-option remain-on-exit off \;\
|
||||||
split-window -c "$PWD" $opt "${tmux_args[@]}" "bash -c 'exec -a fzf bash $argsf'" $swap \
|
split-window -c "$PWD" $opt "bash -c 'exec -a fzf bash $argsf'" $swap \
|
||||||
> /dev/null 2>&1 || { "$fzf" "${args[@]}"; exit $?; }
|
> /dev/null 2>&1 || { "$fzf" "${args[@]}"; exit $?; }
|
||||||
cat $fifo2
|
cat $fifo2
|
||||||
exit "$(cat $fifo3)"
|
exit "$(cat $fifo3)"
|
||||||
|
|
|
@ -1544,6 +1544,8 @@ func parseOptions(opts *Options, allArgs []string) {
|
||||||
opts.ClearOnExit = false
|
opts.ClearOnExit = false
|
||||||
case "--version":
|
case "--version":
|
||||||
opts.Version = true
|
opts.Version = true
|
||||||
|
case "--":
|
||||||
|
// Ignored
|
||||||
default:
|
default:
|
||||||
if match, value := optString(arg, "--algo="); match {
|
if match, value := optString(arg, "--algo="); match {
|
||||||
opts.FuzzyAlgo = parseAlgo(value)
|
opts.FuzzyAlgo = parseAlgo(value)
|
||||||
|
|
Loading…
Reference in New Issue