Add -f to switch-mode to read choices from a file, GitHub issue 5738.

This commit is contained in:
nicm
2026-10-15 08:07:17 +00:00
committed by tmux update bot
parent 1fbadf9b41
commit 73d8f81c2c
4 changed files with 163 additions and 13 deletions

24
tmux.1
View File

@@ -1,4 +1,4 @@
.\" $OpenBSD: tmux.1,v 1.1186 2026/10/14 12:33:46 nicm Exp $
.\" $OpenBSD: tmux.1,v 1.1187 2026/10/15 08:07:17 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
@@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: October 14 2026 $
.Dd $Mdocdate: October 15 2026 $
.Dt TMUX 1
.Os
.Sh NAME
@@ -3205,6 +3205,7 @@ command works only if at least one client is attached.
.Ic switch\-mode
.Op Fl krsZw
.Op Fl F Ar format
.Op Fl f Ar path
.Op Fl O Ar sort\-order
.Op Fl t Ar target\-pane
.Op Ar command
@@ -3250,6 +3251,24 @@ If
is not given, "switch\-client \-Zt \[aq]%%\[aq]" is used.
.Fl F
specifies the format for each item in the list.
.Pp
.Fl f
reads choices from
.Ar path
instead of listing sessions or windows.
Each line is one choice.
With
.Fl f ,
.Ql switch_item
contains the original line and the default display format is
.Ql #{switch_item} .
Fuzzy matching uses the displayed text.
When a choice is selected,
.Ql %%
and
.Ql %1
are replaced by the original line
.Pp
.Fl k
kills the pane when the mode is exited.
.Pp
@@ -7619,6 +7638,7 @@ The following variables are available, where appropriate:
.It Li "session_windows" Ta "" Ta "Number of windows in session"
.It Li "socket_path" Ta "" Ta "Server socket path"
.It Li "start_time" Ta "" Ta "Server start time"
.It Li "switch_item" Ta "" Ta "Original input line in switch mode"
.It Li "synchronized_output_flag" Ta "" Ta "1 if pane has synchronized output enabled"
.It Li "uid" Ta "" Ta "Server UID"
.It Li "user" Ta "" Ta "Server user"