diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2019-05-27 12:16:28 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2019-05-27 12:16:28 +0000 |
commit | e52990e8cd5c494c43baefe2263a7be6d2b64b35 (patch) | |
tree | 6287759ee64e717b3d5a06850b0a086729a35dd5 /usr.bin/tmux/tmux.1 | |
parent | e83d6e71d661bb60ab9e411023ef755ccf52217f (diff) |
Add an additional {} syntax for defining strings in the configuration
file, making it much tidier to define commands that contain other tmux
or shell commands (like if-shell). Also tweak bind-key to expect a
string if it is only given one argument, so {} can be used with it as
well. From Avi Halachmi.
Diffstat (limited to 'usr.bin/tmux/tmux.1')
-rw-r--r-- | usr.bin/tmux/tmux.1 | 49 |
1 files changed, 40 insertions, 9 deletions
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index c37b6854a01..872d9a3bd92 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.654 2019/05/26 17:34:45 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.655 2019/05/27 12:16:27 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: May 26 2019 $ +.Dd $Mdocdate: May 27 2019 $ .Dt TMUX 1 .Os .Sh NAME @@ -490,11 +490,13 @@ line (the \e and the newline are completely removed). This is called line continuation and applies both inside and outside quoted strings and in comments. .Pp -Command arguments may be specified as strings surrounded by either single (') -or double quotes ("). +Command arguments may be specified as strings surrounded by single (') quotes, +double quotes (") or braces ({}). .\" " This is required when the argument contains any special character. -Strings cannot span multiple lines except with line continuation. +Single and double quoted strings cannot span multiple lines except with line +continuation. +Braces can span multiple lines. .Pp Outside of quotes and inside double quotes, these replacements are performed: .Bl -dash -offset indent @@ -520,6 +522,34 @@ is removed) and are not treated as having any special meaning - so for example variable. .El .Pp +Braces are similar to single quotes in that the text inside is taken literally +without replacements, but they can span multiple lines. +They are designed to avoid the need for additional escaping when passing a group +of +.Nm +or shell commands as an argument (for example to +.Ic if-shell +or +.Ic pipe-pane ) . +These two examples produce an identical command - note that no escaping is +needed when using {}: +.Bd -literal -offset indent +if-shell true { + display -p 'brace-dollar-foo: }$foo' +} + +if-shell true "\en display -p 'brace-dollar-foo: }\e$foo'\en" +.Ed +.Pp +Braces may be enclosed inside braces, for example: +.Bd -literal -offset indent +bind x if-shell "true" { + if-shell "true" { + display "true!" + } +} +.Ed +.Pp Environment variables may be set by using the syntax .Ql name=value , for example @@ -820,15 +850,16 @@ directly without invoking the shell. .Op Ar arguments refers to a .Nm -command, passed with the command and arguments separately, for example: +command, either passed with the command and arguments separately, for example: .Bd -literal -offset indent bind-key F1 set-option status off .Ed .Pp -Or if using -.Xr sh 1 : +Or passed as a single string argument in +.Pa .tmux.conf , +for example: .Bd -literal -offset indent -$ tmux bind-key F1 set-option status off +bind-key F1 { set-option status off } .Ed .Pp Example |