diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2021-02-05 12:23:50 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2021-02-05 12:23:50 +0000 |
commit | 159317b13a4eaf2fb48e5356341bfea18b5736bd (patch) | |
tree | 0e08ad2a0dcf6dbe0274187d0d4990c36e3ba7ca /usr.bin/tmux/tmux.1 | |
parent | 51521b16c8af298237f47bffc99c83c26ffb5982 (diff) |
Add a -S flag to new-window to make it select the existing window if one
with the given name already exists rather than failing with an error.
Also add a format to check if a window or session name exists which
allows the same with other commands. Requested by and discussed with
kn@.
Diffstat (limited to 'usr.bin/tmux/tmux.1')
-rw-r--r-- | usr.bin/tmux/tmux.1 | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index 7a3fc0a5164..831005bc7d4 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.816 2021/02/02 07:33:29 jmc Exp $ +.\" $OpenBSD: tmux.1,v 1.817 2021/02/05 12:23:49 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: February 2 2021 $ +.Dd $Mdocdate: February 5 2021 $ .Dt TMUX 1 .Os .Sh NAME @@ -2348,7 +2348,7 @@ the .Ic base-index option. .It Xo Ic new-window -.Op Fl abdkP +.Op Fl abdkPS .Op Fl c Ar start-directory .Op Fl e Ar environment .Op Fl F Ar format @@ -2377,6 +2377,14 @@ represents the window to be created; if the target already exists an error is shown, unless the .Fl k flag is used, in which case it is destroyed. +If +.Fl S +is given and a window named +.Ar window-name +already exists, it is selected (unless +.Fl d +is also given in which case the command does nothing). +.Pp .Ar shell-command is the command to execute. If @@ -4688,6 +4696,17 @@ For example, to get a list of windows formatted like the status line: #{W:#{E:window-status-format} ,#{E:window-status-current-format} } .Ed .Pp +.Ql N:\& +checks if a window (without any suffix or with the +.Ql w +suffix) or a session (with the +.Ql s +suffix) name exists, for example +.Ql `N/w:foo` +is replaced with 1 if a window named +.Ql foo +exists. +.Pp A prefix of the form .Ql s/foo/bar/:\& will substitute |