summaryrefslogtreecommitdiffstats
path: root/shell/completion.zsh
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2020-03-31 22:18:09 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2020-04-03 13:23:15 +0900
commitbf65e8cd12b0477a916ed16fa6d9d3ff9a78c824 (patch)
treeb2717ffe44d0d548a63359e5d18659bf6bb02a17 /shell/completion.zsh
parent0f5c6e8f040833ca632bb5ff345542879769225c (diff)
[fzf-tmux] Add option to start fzf in tmux popup window
Requires latest tmux built from source (e.g. brew install tmux --HEAD) Examples: # 50%/50% width and height on the center of the screen fzf-tmux -p # 80%/80% fzf-tmux -p80% # 80%/40% fzf-tmux -p80%,40% # Separate -w and -h fzf-tmux -w80% -h40% # 80%/40% at position (0, 0) fzf-tmux -w80% -h40% -x0 -y0 You can configure key bindings and fuzzy completion to open in tmux popup window like so: FZF_TMUX_OPTS='-p 80%'
Diffstat (limited to 'shell/completion.zsh')
-rw-r--r--shell/completion.zsh8
1 files changed, 4 insertions, 4 deletions
diff --git a/shell/completion.zsh b/shell/completion.zsh
index e828a704..e791b3a7 100644
--- a/shell/completion.zsh
+++ b/shell/completion.zsh
@@ -2,10 +2,10 @@
# / __/___ / __/
# / /_/_ / / /_
# / __/ / /_/ __/
-# /_/ /___/_/-completion.zsh
+# /_/ /___/_/ completion.zsh
#
# - $FZF_TMUX (default: 0)
-# - $FZF_TMUX_HEIGHT (default: '40%')
+# - $FZF_TMUX_OPTS (default: '-d 40%')
# - $FZF_COMPLETION_TRIGGER (default: '**')
# - $FZF_COMPLETION_OPTS (default: empty)
@@ -99,9 +99,9 @@ fi
__fzf_comprun() {
if [[ "$(type _fzf_comprun 2>&1)" =~ function ]]; then
_fzf_comprun "$@"
- elif [ -n "$TMUX_PANE" ] && [ "${FZF_TMUX:-0}" != 0 ] && [ ${LINES:-40} -gt 15 ]; then
+ elif [ -n "$TMUX_PANE" ] && { [ "${FZF_TMUX:-0}" != 0 ] && [ ${LINES:-40} -gt 15 ] || [ -n "$FZF_TMUX_OPTS" ]; }; then
shift
- fzf-tmux -d "${FZF_TMUX_HEIGHT:-40%}" "$@"
+ fzf-tmux ${(Q)${(Z+n+)FZF_TMUX_OPTS:--d${FZF_TMUX_HEIGHT:-40%}}} -- "$@"
else
shift
fzf "$@"