From 3f4418d84dd8865f1bba410fc796acb53277abbf Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 19 Aug 2009 10:39:50 +0000 Subject: Extend command-prompt with a -p option which is a comma-separated list of one or more prompts to present in order. The responses to the prompt are replaced in the template string: %% are replaced in order, so the first prompt replaces the first %%, the second replaces the second, and so on. In addition, %1 up to %9 are replaced with the responses to the first the ninth prompts The default template is "%1" so the response to the first prompt is processed as a command. Note that this changes the behaviour for %% so if there is only one prompt, only the first %% will be replaced. Templates such as "neww -n '%%' 'ssh %%'" should be changed to "neww -n '%1' 'ssh %1'". From Tiago Cunha. --- tmux.1 | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'tmux.1') diff --git a/tmux.1 b/tmux.1 index b811c81e..f5f05f06 100644 --- a/tmux.1 +++ b/tmux.1 @@ -1662,6 +1662,7 @@ session option. Commands related to the status line are as follows: .Bl -tag -width Ds .It Xo Ic command-prompt +.Op Fl p Ar prompts .Op Fl t Ar target-client .Op Ar template .Xc @@ -1671,8 +1672,30 @@ This may be used from inside to execute commands interactively. If .Ar template -is specified, it is used as the command; any %% in the template will be -replaced by what is entered at the prompt. +is specified, it is used as the command. +If +.Fl p +is given, +.Ar prompts +is a comma-separated list of prompts which are displayed in order; otherwise +a single prompt is displayed, constructed from +.Ar template +if it is present, or +.Ql \&: +if not. +Before the command is executed, the first occurrence of the string +.Ql %% +and all occurences of +.Ql %1 +are replaced by the response to the first prompt, the second +.Ql %% +and all +.Ql %2 +are replaced with the response to the second prompt, and so on for further +prompts. Up to nine prompt responses may be replaced +.Ns ( Ql %1 +to +.Ns Ql %9 ) . .It Xo Ic confirm-before .Op Fl t Ar target-client .Ar command @@ -1926,6 +1949,7 @@ Creating new key bindings: .Bd -literal -offset indent bind-key b set-option status bind-key / command-prompt "split-window 'exec man %%'" +bind-key S command-prompt "new-window -n %1 'ssh %1'" .Ed .Sh SEE ALSO .Xr pty 4 -- cgit