Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tmux_width_factor #504

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ If you're using tmux >= 3.2, we provide a script `ftb-tmux-popup` to make full u
zstyle ':fzf-tab:*' fzf-command ftb-tmux-popup
```

if tmux popup is not populated in proper size you can change it's resize factor for wider window
```zsh
# default is 5
zstyle ':fzf-tab:*' fzf-tmux-width-factor 25
```

BTW, you can also use this script outside the fzf-tab.

```zsh
Expand Down
2 changes: 2 additions & 0 deletions lib/-ftb-fzf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ local ret=0
-ftb-zstyle -s fzf-pad fzf_pad || fzf_pad=2
-ftb-zstyle -s fzf-min-height fzf_min_height || fzf_min_height=0
-ftb-zstyle -b use-fzf-default-opts use_fzf_default_opts || use_fzf_default_opts="no"
-ftb-zstyle -s fzf-tmux-width-factor fzf_tmux_width_factor || fzf_tmux_width_factor=5

-ftb-zstyle -a debug-command debug_command && {
${(eX)debug_command} $fzf_flags
Expand Down Expand Up @@ -96,6 +97,7 @@ FZF_DEFAULT_OPTS=$fzf_default_opts SHELL=$ZSH_NAME $fzf_command \
--expect=$continuous_trigger,$print_query,$accept_line \
--header-lines=$header_lines \
--height=${FZF_TMUX_HEIGHT:=$(( min(max(lines, fzf_min_height), LINES / 3 * 2) ))} \
--width=${FZF_TMUX_WIDTH:-80} \
--layout=reverse \
--multi \
--nth=2,3 \
Expand Down
2 changes: 1 addition & 1 deletion lib/ftb-tmux-popup
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ else
fi

# calculate the popup width and x position
popup_width=$(( min(max(comp_length + 5, popup_min_size[1]), window_width) ))
popup_width=$(( min(max(comp_length + fzf_tmux_width_factor, popup_min_size[1]), window_width) ))
popup_x=$(( cursor_x + popup_width > window_width ? window_width - popup_width : cursor_x ))

echo -E "env FZF_DEFAULT_OPTS='' SHELL=$ZSH_NAME $commands[fzf] ${(qq)fzf_opts[@]} < $tmp_dir/completions.$$ > $tmp_dir/result-$$" > $tmp_dir/fzf-$$
Expand Down