mirror of
https://github.com/junegunn/fzf
synced 2026-07-28 17:51:42 +00:00
77e6394f50
The pane sets the options itself before running fzf, so that they are
in place no matter how quickly the command exits, targeted at
$TMUX_PANE; the default target would resolve to the active pane of
the session's current window.
- pane-border-format is set to '#{pane_title}' so that the label is
displayed on the border when pane-border-status is enabled;
pane-border-status itself is a window option in released tmux
versions and is left alone
- When a border style is explicitly specified with --border, a popup
is used instead of a floating pane so that the fzf-drawn border is
the only border shown; give 'border-native' to force a floating pane
- 'none' and 'line' are treated as no border; fzf draws no box for
either, so the label is displayed on the native border
- Remove 'border-fzf' which is now redundant; it was never released
- The title is escaped for select-pane -T which expands format
expressions; a lone ';' is escaped as tmux would treat it as a
command separator
- The label is skipped when ANSI stripping leaves an empty string
- --border-label-pos is ignored
- Fix remain-on-exit set on the original pane instead of the floating
pane
42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
package fzf
|
|
|
|
import (
|
|
"os/exec"
|
|
)
|
|
|
|
func runZellij(args []string, opts *Options) (int, error) {
|
|
argStr, dir := popupArgStr(args, opts)
|
|
|
|
zellijArgs := []string{
|
|
"run", "--floating", "--close-on-exit", "--block-until-exit",
|
|
"--cwd", dir,
|
|
}
|
|
if !opts.Tmux.border {
|
|
zellijArgs = append(zellijArgs, "--borderless", "true")
|
|
}
|
|
switch opts.Tmux.position {
|
|
case posUp:
|
|
zellijArgs = append(zellijArgs, "-y", "0")
|
|
case posDown:
|
|
zellijArgs = append(zellijArgs, "-y", "9999")
|
|
case posLeft:
|
|
zellijArgs = append(zellijArgs, "-x", "0")
|
|
case posRight:
|
|
zellijArgs = append(zellijArgs, "-x", "9999")
|
|
case posCenter:
|
|
// Zellij centers floating panes by default
|
|
}
|
|
zellijArgs = append(zellijArgs, "--width", opts.Tmux.width.String())
|
|
zellijArgs = append(zellijArgs, "--height", opts.Tmux.height.String())
|
|
zellijArgs = append(zellijArgs, "--")
|
|
|
|
return runProxy(argStr, func(temp string, needBash bool) (*exec.Cmd, error) {
|
|
sh, err := sh(needBash)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
zellijArgs = append(zellijArgs, sh, temp)
|
|
return exec.Command("zellij", zellijArgs...), nil
|
|
}, opts, true)
|
|
}
|