1.\" $OpenBSD: tmux.1,v 1.786 2020/06/18 08:34:22 nicm Exp $ 2.\" 3.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> 4.\" 5.\" Permission to use, copy, modify, and distribute this software for any 6.\" purpose with or without fee is hereby granted, provided that the above 7.\" copyright notice and this permission notice appear in all copies. 8.\" 9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13.\" WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER 14.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 15.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" 17.Dd $Mdocdate: June 18 2020 $ 18.Dt TMUX 1 19.Os 20.Sh NAME 21.Nm tmux 22.Nd terminal multiplexer 23.Sh SYNOPSIS 24.Nm tmux 25.Bk -words 26.Op Fl 2CDluvV 27.Op Fl c Ar shell-command 28.Op Fl f Ar file 29.Op Fl L Ar socket-name 30.Op Fl S Ar socket-path 31.Op Fl T Ar features 32.Op Ar command Op Ar flags 33.Ek 34.Sh DESCRIPTION 35.Nm 36is a terminal multiplexer: 37it enables a number of terminals to be created, accessed, and 38controlled from a single screen. 39.Nm 40may be detached from a screen 41and continue running in the background, 42then later reattached. 43.Pp 44When 45.Nm 46is started it creates a new 47.Em session 48with a single 49.Em window 50and displays it on screen. 51A status line at the bottom of the screen 52shows information on the current session 53and is used to enter interactive commands. 54.Pp 55A session is a single collection of 56.Em pseudo terminals 57under the management of 58.Nm . 59Each session has one or more 60windows linked to it. 61A window occupies the entire screen 62and may be split into rectangular panes, 63each of which is a separate pseudo terminal 64(the 65.Xr pty 4 66manual page documents the technical details of pseudo terminals). 67Any number of 68.Nm 69instances may connect to the same session, 70and any number of windows may be present in the same session. 71Once all sessions are killed, 72.Nm 73exits. 74.Pp 75Each session is persistent and will survive accidental disconnection 76(such as 77.Xr ssh 1 78connection timeout) or intentional detaching (with the 79.Ql C-b d 80key strokes). 81.Nm 82may be reattached using: 83.Pp 84.Dl $ tmux attach 85.Pp 86In 87.Nm , 88a session is displayed on screen by a 89.Em client 90and all sessions are managed by a single 91.Em server . 92The server and each client are separate processes which communicate through a 93socket in 94.Pa /tmp . 95.Pp 96The options are as follows: 97.Bl -tag -width "XXXXXXXXXXXX" 98.It Fl 2 99Force 100.Nm 101to assume the terminal supports 256 colours. 102This is equivalent to 103.Fl T Ar 256 . 104.It Fl C 105Start in control mode (see the 106.Sx CONTROL MODE 107section). 108Given twice 109.Xo ( Fl CC ) Xc 110disables echo. 111.It Fl c Ar shell-command 112Execute 113.Ar shell-command 114using the default shell. 115If necessary, the 116.Nm 117server will be started to retrieve the 118.Ic default-shell 119option. 120This option is for compatibility with 121.Xr sh 1 122when 123.Nm 124is used as a login shell. 125.It Fl D 126Do not start the 127.Nm 128server as a daemon. 129This also turns the 130.Ic exit-empty 131option off. 132With 133.Fl D , 134.Ar command 135may not be specified. 136.It Fl f Ar file 137Specify an alternative configuration file. 138By default, 139.Nm 140loads the system configuration file from 141.Pa /etc/tmux.conf , 142if present, then looks for a user configuration file at 143.Pa ~/.tmux.conf . 144.Pp 145The configuration file is a set of 146.Nm 147commands which are executed in sequence when the server is first started. 148.Nm 149loads configuration files once when the server process has started. 150The 151.Ic source-file 152command may be used to load a file later. 153.Pp 154.Nm 155shows any error messages from commands in configuration files in the first 156session created, and continues to process the rest of the configuration file. 157.It Fl L Ar socket-name 158.Nm 159stores the server socket in a directory under 160.Ev TMUX_TMPDIR 161or 162.Pa /tmp 163if it is unset. 164The default socket is named 165.Em default . 166This option allows a different socket name to be specified, allowing several 167independent 168.Nm 169servers to be run. 170Unlike 171.Fl S 172a full path is not necessary: the sockets are all created in the same 173directory. 174.Pp 175If the socket is accidentally removed, the 176.Dv SIGUSR1 177signal may be sent to the 178.Nm 179server process to recreate it (note that this will fail if any parent 180directories are missing). 181.It Fl l 182Behave as a login shell. 183This flag currently has no effect and is for compatibility with other shells 184when using tmux as a login shell. 185.It Fl S Ar socket-path 186Specify a full alternative path to the server socket. 187If 188.Fl S 189is specified, the default socket directory is not used and any 190.Fl L 191flag is ignored. 192.It Fl u 193Write UTF-8 output to the terminal even if the first environment 194variable of 195.Ev LC_ALL , 196.Ev LC_CTYPE , 197or 198.Ev LANG 199that is set does not contain 200.Qq UTF-8 201or 202.Qq UTF8 . 203This is equivalent to 204.Fl T Ar UTF-8 . 205.It Fl T Ar features 206Set terminal features for the client. 207This is a comma-separated list of features. 208See the 209.Ic terminal-features 210option. 211.It Fl v 212Request verbose logging. 213Log messages will be saved into 214.Pa tmux-client-PID.log 215and 216.Pa tmux-server-PID.log 217files in the current directory, where 218.Em PID 219is the PID of the server or client process. 220If 221.Fl v 222is specified twice, an additional 223.Pa tmux-out-PID.log 224file is generated with a copy of everything 225.Nm 226writes to the terminal. 227.Pp 228The 229.Dv SIGUSR2 230signal may be sent to the 231.Nm 232server process to toggle logging between on (as if 233.Fl v 234was given) and off. 235.It Fl V 236Report the 237.Nm 238version. 239.It Ar command Op Ar flags 240This specifies one of a set of commands used to control 241.Nm , 242as described in the following sections. 243If no commands are specified, the 244.Ic new-session 245command is assumed. 246.El 247.Sh DEFAULT KEY BINDINGS 248.Nm 249may be controlled from an attached client by using a key combination of a 250prefix key, 251.Ql C-b 252(Ctrl-b) by default, followed by a command key. 253.Pp 254The default command key bindings are: 255.Pp 256.Bl -tag -width "XXXXXXXXXX" -offset indent -compact 257.It C-b 258Send the prefix key (C-b) through to the application. 259.It C-o 260Rotate the panes in the current window forwards. 261.It C-z 262Suspend the 263.Nm 264client. 265.It ! 266Break the current pane out of the window. 267.It \&" 268.\" " 269Split the current pane into two, top and bottom. 270.It # 271List all paste buffers. 272.It $ 273Rename the current session. 274.It % 275Split the current pane into two, left and right. 276.It & 277Kill the current window. 278.It ' 279Prompt for a window index to select. 280.It \&( 281Switch the attached client to the previous session. 282.It \&) 283Switch the attached client to the next session. 284.It , 285Rename the current window. 286.It - 287Delete the most recently copied buffer of text. 288.It . 289Prompt for an index to move the current window. 290.It 0 to 9 291Select windows 0 to 9. 292.It : 293Enter the 294.Nm 295command prompt. 296.It ; 297Move to the previously active pane. 298.It = 299Choose which buffer to paste interactively from a list. 300.It \&? 301List all key bindings. 302.It D 303Choose a client to detach. 304.It L 305Switch the attached client back to the last session. 306.It \&[ 307Enter copy mode to copy text or view the history. 308.It \&] 309Paste the most recently copied buffer of text. 310.It c 311Create a new window. 312.It d 313Detach the current client. 314.It f 315Prompt to search for text in open windows. 316.It i 317Display some information about the current window. 318.It l 319Move to the previously selected window. 320.It m 321Mark the current pane (see 322.Ic select-pane 323.Fl m ) . 324.It M 325Clear the marked pane. 326.It n 327Change to the next window. 328.It o 329Select the next pane in the current window. 330.It p 331Change to the previous window. 332.It q 333Briefly display pane indexes. 334.It r 335Force redraw of the attached client. 336.It s 337Select a new session for the attached client interactively. 338.It t 339Show the time. 340.It w 341Choose the current window interactively. 342.It x 343Kill the current pane. 344.It z 345Toggle zoom state of the current pane. 346.It { 347Swap the current pane with the previous pane. 348.It } 349Swap the current pane with the next pane. 350.It ~ 351Show previous messages from 352.Nm , 353if any. 354.It Page Up 355Enter copy mode and scroll one page up. 356.It Up, Down 357.It Left, Right 358Change to the pane above, below, to the left, or to the right of the current 359pane. 360.It M-1 to M-5 361Arrange panes in one of the five preset layouts: even-horizontal, 362even-vertical, main-horizontal, main-vertical, or tiled. 363.It Space 364Arrange the current window in the next preset layout. 365.It M-n 366Move to the next window with a bell or activity marker. 367.It M-o 368Rotate the panes in the current window backwards. 369.It M-p 370Move to the previous window with a bell or activity marker. 371.It C-Up, C-Down 372.It C-Left, C-Right 373Resize the current pane in steps of one cell. 374.It M-Up, M-Down 375.It M-Left, M-Right 376Resize the current pane in steps of five cells. 377.El 378.Pp 379Key bindings may be changed with the 380.Ic bind-key 381and 382.Ic unbind-key 383commands. 384.Sh COMMAND PARSING AND EXECUTION 385.Nm 386supports a large number of commands which can be used to control its 387behaviour. 388Each command is named and can accept zero or more flags and arguments. 389They may be bound to a key with the 390.Ic bind-key 391command or run from the shell prompt, a shell script, a configuration file or 392the command prompt. 393For example, the same 394.Ic set-option 395command run from the shell prompt, from 396.Pa ~/.tmux.conf 397and bound to a key may look like: 398.Bd -literal -offset indent 399$ tmux set-option -g status-style bg=cyan 400 401set-option -g status-style bg=cyan 402 403bind-key C set-option -g status-style bg=cyan 404.Ed 405.Pp 406Here, the command name is 407.Ql set-option , 408.Ql Fl g 409is a flag and 410.Ql status-style 411and 412.Ql bg=cyan 413are arguments. 414.Pp 415.Nm 416distinguishes between command parsing and execution. 417In order to execute a command, 418.Nm 419needs it to be split up into its name and arguments. 420This is command parsing. 421If a command is run from the shell, the shell parses it; from inside 422.Nm 423or from a configuration file, 424.Nm 425does. 426Examples of when 427.Nm 428parses commands are: 429.Bl -dash -offset indent 430.It 431in a configuration file; 432.It 433typed at the command prompt (see 434.Ic command-prompt ) ; 435.It 436given to 437.Ic bind-key ; 438.It 439passed as arguments to 440.Ic if-shell 441or 442.Ic confirm-before . 443.El 444.Pp 445To execute commands, each client has a 446.Ql command queue . 447A global command queue not attached to any client is used on startup 448for configuration files like 449.Pa ~/.tmux.conf . 450Parsed commands added to the queue are executed in order. 451Some commands, like 452.Ic if-shell 453and 454.Ic confirm-before , 455parse their argument to create a new command which is inserted immediately 456after themselves. 457This means that arguments can be parsed twice or more - once when the parent command (such as 458.Ic if-shell ) 459is parsed and again when it parses and executes its command. 460Commands like 461.Ic if-shell , 462.Ic run-shell 463and 464.Ic display-panes 465stop execution of subsequent commands on the queue until something happens - 466.Ic if-shell 467and 468.Ic run-shell 469until a shell command finishes and 470.Ic display-panes 471until a key is pressed. 472For example, the following commands: 473.Bd -literal -offset indent 474new-session; new-window 475if-shell "true" "split-window" 476kill-session 477.Ed 478.Pp 479Will execute 480.Ic new-session , 481.Ic new-window , 482.Ic if-shell , 483the shell command 484.Xr true 1 , 485.Ic split-window 486and 487.Ic kill-session 488in that order. 489.Pp 490The 491.Sx COMMANDS 492section lists the 493.Nm 494commands and their arguments. 495.Sh PARSING SYNTAX 496This section describes the syntax of commands parsed by 497.Nm , 498for example in a configuration file or at the command prompt. 499Note that when commands are entered into the shell, they are parsed by the shell 500- see for example 501.Xr ksh 1 502or 503.Xr csh 1 . 504.Pp 505Each command is terminated by a newline or a semicolon (;). 506Commands separated by semicolons together form a 507.Ql command sequence 508- if a command in the sequence encounters an error, no subsequent commands are 509executed. 510.Pp 511Comments are marked by the unquoted # character - any remaining text after a 512comment is ignored until the end of the line. 513.Pp 514If the last character of a line is \e, the line is joined with the following 515line (the \e and the newline are completely removed). 516This is called line continuation and applies both inside and outside quoted 517strings and in comments, but not inside braces. 518.Pp 519Command arguments may be specified as strings surrounded by single (') quotes, 520double quotes (") or braces ({}). 521.\" " 522This is required when the argument contains any special character. 523Single and double quoted strings cannot span multiple lines except with line 524continuation. 525Braces can span multiple lines. 526.Pp 527Outside of quotes and inside double quotes, these replacements are performed: 528.Bl -dash -offset indent 529.It 530Environment variables preceded by $ are replaced with their value from the 531global environment (see the 532.Sx GLOBAL AND SESSION ENVIRONMENT 533section). 534.It 535A leading ~ or ~user is expanded to the home directory of the current or 536specified user. 537.It 538\euXXXX or \euXXXXXXXX is replaced by the Unicode codepoint corresponding to 539the given four or eight digit hexadecimal number. 540.It 541When preceded (escaped) by a \e, the following characters are replaced: \ee by 542the escape character; \er by a carriage return; \en by a newline; and \et by a 543tab. 544.It 545\eooo is replaced by a character of the octal value ooo. 546Three octal digits are required, for example \e001. 547The largest valid character is \e377. 548.It 549Any other characters preceded by \e are replaced by themselves (that is, the \e 550is removed) and are not treated as having any special meaning - so for example 551\e; will not mark a command sequence and \e$ will not expand an environment 552variable. 553.El 554.Pp 555Braces are parsed as a configuration file (so conditions such as 556.Ql %if 557are processed) and then converted into a string. 558They are designed to avoid the need for additional escaping when passing a 559group of 560.Nm 561commands as an argument (for example to 562.Ic if-shell ) . 563These two examples produce an identical command - note that no escaping is 564needed when using {}: 565.Bd -literal -offset indent 566if-shell true { 567 display -p 'brace-dollar-foo: }$foo' 568} 569 570if-shell true "display -p 'brace-dollar-foo: }\e$foo'" 571.Ed 572.Pp 573Braces may be enclosed inside braces, for example: 574.Bd -literal -offset indent 575bind x if-shell "true" { 576 if-shell "true" { 577 display "true!" 578 } 579} 580.Ed 581.Pp 582Environment variables may be set by using the syntax 583.Ql name=value , 584for example 585.Ql HOME=/home/user . 586Variables set during parsing are added to the global environment. 587A hidden variable may be set with 588.Ql %hidden , 589for example: 590.Bd -literal -offset indent 591%hidden MYVAR=42 592.Ed 593.Pp 594Hidden variables are not passed to the environment of processes created 595by tmux. 596See the 597.Sx GLOBAL AND SESSION ENVIRONMENT 598section. 599.Pp 600Commands may be parsed conditionally by surrounding them with 601.Ql %if , 602.Ql %elif , 603.Ql %else 604and 605.Ql %endif . 606The argument to 607.Ql %if 608and 609.Ql %elif 610is expanded as a format (see 611.Sx FORMATS ) 612and if it evaluates to false (zero or empty), subsequent text is ignored until 613the closing 614.Ql %elif , 615.Ql %else 616or 617.Ql %endif . 618For example: 619.Bd -literal -offset indent 620%if "#{==:#{host},myhost}" 621set -g status-style bg=red 622%elif "#{==:#{host},myotherhost}" 623set -g status-style bg=green 624%else 625set -g status-style bg=blue 626%endif 627.Ed 628.Pp 629Will change the status line to red if running on 630.Ql myhost , 631green if running on 632.Ql myotherhost , 633or blue if running on another host. 634Conditionals may be given on one line, for example: 635.Bd -literal -offset indent 636%if #{==:#{host},myhost} set -g status-style bg=red %endif 637.Ed 638.Sh COMMANDS 639This section describes the commands supported by 640.Nm . 641Most commands accept the optional 642.Fl t 643(and sometimes 644.Fl s ) 645argument with one of 646.Ar target-client , 647.Ar target-session , 648.Ar target-window , 649or 650.Ar target-pane . 651These specify the client, session, window or pane which a command should affect. 652.Pp 653.Ar target-client 654should be the name of the client, 655typically the 656.Xr pty 4 657file to which the client is connected, for example either of 658.Pa /dev/ttyp1 659or 660.Pa ttyp1 661for the client attached to 662.Pa /dev/ttyp1 . 663If no client is specified, 664.Nm 665attempts to work out the client currently in use; if that fails, an error is 666reported. 667Clients may be listed with the 668.Ic list-clients 669command. 670.Pp 671.Ar target-session 672is tried as, in order: 673.Bl -enum -offset Ds 674.It 675A session ID prefixed with a $. 676.It 677An exact name of a session (as listed by the 678.Ic list-sessions 679command). 680.It 681The start of a session name, for example 682.Ql mysess 683would match a session named 684.Ql mysession . 685.It 686An 687.Xr fnmatch 3 688pattern which is matched against the session name. 689.El 690.Pp 691If the session name is prefixed with an 692.Ql = , 693only an exact match is accepted (so 694.Ql =mysess 695will only match exactly 696.Ql mysess , 697not 698.Ql mysession ) . 699.Pp 700If a single session is found, it is used as the target session; multiple matches 701produce an error. 702If a session is omitted, the current session is used if available; if no 703current session is available, the most recently used is chosen. 704.Pp 705.Ar target-window 706(or 707.Ar src-window 708or 709.Ar dst-window ) 710specifies a window in the form 711.Em session Ns \&: Ns Em window . 712.Em session 713follows the same rules as for 714.Ar target-session , 715and 716.Em window 717is looked for in order as: 718.Bl -enum -offset Ds 719.It 720A special token, listed below. 721.It 722A window index, for example 723.Ql mysession:1 724is window 1 in session 725.Ql mysession . 726.It 727A window ID, such as @1. 728.It 729An exact window name, such as 730.Ql mysession:mywindow . 731.It 732The start of a window name, such as 733.Ql mysession:mywin . 734.It 735As an 736.Xr fnmatch 3 737pattern matched against the window name. 738.El 739.Pp 740Like sessions, a 741.Ql = 742prefix will do an exact match only. 743An empty window name specifies the next unused index if appropriate (for 744example the 745.Ic new-window 746and 747.Ic link-window 748commands) 749otherwise the current window in 750.Em session 751is chosen. 752.Pp 753The following special tokens are available to indicate particular windows. 754Each has a single-character alternative form. 755.Bl -column "XXXXXXXXXX" "X" 756.It Sy "Token" Ta Sy "" Ta Sy "Meaning" 757.It Li "{start}" Ta "^" Ta "The lowest-numbered window" 758.It Li "{end}" Ta "$" Ta "The highest-numbered window" 759.It Li "{last}" Ta "!" Ta "The last (previously current) window" 760.It Li "{next}" Ta "+" Ta "The next window by number" 761.It Li "{previous}" Ta "-" Ta "The previous window by number" 762.El 763.Pp 764.Ar target-pane 765(or 766.Ar src-pane 767or 768.Ar dst-pane ) 769may be a pane ID or takes a similar form to 770.Ar target-window 771but with the optional addition of a period followed by a pane index or pane ID, 772for example: 773.Ql mysession:mywindow.1 . 774If the pane index is omitted, the currently active pane in the specified 775window is used. 776The following special tokens are available for the pane index: 777.Bl -column "XXXXXXXXXXXXXX" "X" 778.It Sy "Token" Ta Sy "" Ta Sy "Meaning" 779.It Li "{last}" Ta "!" Ta "The last (previously active) pane" 780.It Li "{next}" Ta "+" Ta "The next pane by number" 781.It Li "{previous}" Ta "-" Ta "The previous pane by number" 782.It Li "{top}" Ta "" Ta "The top pane" 783.It Li "{bottom}" Ta "" Ta "The bottom pane" 784.It Li "{left}" Ta "" Ta "The leftmost pane" 785.It Li "{right}" Ta "" Ta "The rightmost pane" 786.It Li "{top-left}" Ta "" Ta "The top-left pane" 787.It Li "{top-right}" Ta "" Ta "The top-right pane" 788.It Li "{bottom-left}" Ta "" Ta "The bottom-left pane" 789.It Li "{bottom-right}" Ta "" Ta "The bottom-right pane" 790.It Li "{up-of}" Ta "" Ta "The pane above the active pane" 791.It Li "{down-of}" Ta "" Ta "The pane below the active pane" 792.It Li "{left-of}" Ta "" Ta "The pane to the left of the active pane" 793.It Li "{right-of}" Ta "" Ta "The pane to the right of the active pane" 794.El 795.Pp 796The tokens 797.Ql + 798and 799.Ql - 800may be followed by an offset, for example: 801.Bd -literal -offset indent 802select-window -t:+2 803.Ed 804.Pp 805In addition, 806.Em target-session , 807.Em target-window 808or 809.Em target-pane 810may consist entirely of the token 811.Ql {mouse} 812(alternative form 813.Ql = ) 814to specify the session, window or pane where the most recent mouse event occurred 815(see the 816.Sx MOUSE SUPPORT 817section) 818or 819.Ql {marked} 820(alternative form 821.Ql ~ ) 822to specify the marked pane (see 823.Ic select-pane 824.Fl m ) . 825.Pp 826Sessions, window and panes are each numbered with a unique ID; session IDs are 827prefixed with a 828.Ql $ , 829windows with a 830.Ql @ , 831and panes with a 832.Ql % . 833These are unique and are unchanged for the life of the session, window or pane 834in the 835.Nm 836server. 837The pane ID is passed to the child process of the pane in the 838.Ev TMUX_PANE 839environment variable. 840IDs may be displayed using the 841.Ql session_id , 842.Ql window_id , 843or 844.Ql pane_id 845formats (see the 846.Sx FORMATS 847section) and the 848.Ic display-message , 849.Ic list-sessions , 850.Ic list-windows 851or 852.Ic list-panes 853commands. 854.Pp 855.Ar shell-command 856arguments are 857.Xr sh 1 858commands. 859This may be a single argument passed to the shell, for example: 860.Bd -literal -offset indent 861new-window 'vi /etc/passwd' 862.Ed 863.Pp 864Will run: 865.Bd -literal -offset indent 866/bin/sh -c 'vi /etc/passwd' 867.Ed 868.Pp 869Additionally, the 870.Ic new-window , 871.Ic new-session , 872.Ic split-window , 873.Ic respawn-window 874and 875.Ic respawn-pane 876commands allow 877.Ar shell-command 878to be given as multiple arguments and executed directly (without 879.Ql sh -c ) . 880This can avoid issues with shell quoting. 881For example: 882.Bd -literal -offset indent 883$ tmux new-window vi /etc/passwd 884.Ed 885.Pp 886Will run 887.Xr vi 1 888directly without invoking the shell. 889.Pp 890.Ar command 891.Op Ar arguments 892refers to a 893.Nm 894command, either passed with the command and arguments separately, for example: 895.Bd -literal -offset indent 896bind-key F1 set-option status off 897.Ed 898.Pp 899Or passed as a single string argument in 900.Pa .tmux.conf , 901for example: 902.Bd -literal -offset indent 903bind-key F1 { set-option status off } 904.Ed 905.Pp 906Example 907.Nm 908commands include: 909.Bd -literal -offset indent 910refresh-client -t/dev/ttyp2 911 912rename-session -tfirst newname 913 914set-option -wt:0 monitor-activity on 915 916new-window ; split-window -d 917 918bind-key R source-file ~/.tmux.conf \e; \e 919 display-message "source-file done" 920.Ed 921.Pp 922Or from 923.Xr sh 1 : 924.Bd -literal -offset indent 925$ tmux kill-window -t :1 926 927$ tmux new-window \e; split-window -d 928 929$ tmux new-session -d 'vi /etc/passwd' \e; split-window -d \e; attach 930.Ed 931.Sh CLIENTS AND SESSIONS 932The 933.Nm 934server manages clients, sessions, windows and panes. 935Clients are attached to sessions to interact with them, either 936when they are created with the 937.Ic new-session 938command, or later with the 939.Ic attach-session 940command. 941Each session has one or more windows 942.Em linked 943into it. 944Windows may be linked to multiple sessions and are made up of one or 945more panes, 946each of which contains a pseudo terminal. 947Commands for creating, linking and otherwise manipulating windows 948are covered 949in the 950.Sx WINDOWS AND PANES 951section. 952.Pp 953The following commands are available to manage clients and sessions: 954.Bl -tag -width Ds 955.It Xo Ic attach-session 956.Op Fl dErx 957.Op Fl c Ar working-directory 958.Op Fl f Ar flags 959.Op Fl t Ar target-session 960.Xc 961.D1 (alias: Ic attach ) 962If run from outside 963.Nm , 964create a new client in the current terminal and attach it to 965.Ar target-session . 966If used from inside, switch the current client. 967If 968.Fl d 969is specified, any other clients attached to the session are detached. 970If 971.Fl x 972is given, send 973.Dv SIGHUP 974to the parent process of the client as well as 975detaching the client, typically causing it to exit. 976.Fl f 977sets a comma-separated list of client flags. 978The flags are: 979.Bl -tag -width Ds 980.It active-pane 981the client has an independent active pane 982.It ignore-size 983the client does not affect the size of other clients 984.It no-output 985the client does not receive pane output in control mode 986.It pause-after=seconds 987output is paused once the pane is 988.Ar seconds 989behind in control mode 990.It read-only 991the client is read-only 992.It wait-exit 993wait for an empty line input before exiting in control mode 994.El 995.Pp 996A leading 997.Ql ! 998turns a flag off if the client is already attached. 999.Fl r 1000is an alias for 1001.Fl f 1002.Ar read-only,ignore-size . 1003When a client is read-only, only keys bound to the 1004.Ic detach-client 1005or 1006.Ic switch-client 1007commands have any effect. 1008A client with the 1009.Ar active-pane 1010flag allows the active pane to be selected independently of the window's active 1011pane used by clients without the flag. 1012This only affects the cursor position and commands issued from the client; 1013other features such as hooks and styles continue to use the window's active 1014pane. 1015.Pp 1016If no server is started, 1017.Ic attach-session 1018will attempt to start it; this will fail unless sessions are created in the 1019configuration file. 1020.Pp 1021The 1022.Ar target-session 1023rules for 1024.Ic attach-session 1025are slightly adjusted: if 1026.Nm 1027needs to select the most recently used session, it will prefer the most 1028recently used 1029.Em unattached 1030session. 1031.Pp 1032.Fl c 1033will set the session working directory (used for new windows) to 1034.Ar working-directory . 1035.Pp 1036If 1037.Fl E 1038is used, the 1039.Ic update-environment 1040option will not be applied. 1041.It Xo Ic detach-client 1042.Op Fl aP 1043.Op Fl E Ar shell-command 1044.Op Fl s Ar target-session 1045.Op Fl t Ar target-client 1046.Xc 1047.D1 (alias: Ic detach ) 1048Detach the current client if bound to a key, the client specified with 1049.Fl t , 1050or all clients currently attached to the session specified by 1051.Fl s . 1052The 1053.Fl a 1054option kills all but the client given with 1055.Fl t . 1056If 1057.Fl P 1058is given, send 1059.Dv SIGHUP 1060to the parent process of the client, typically causing it 1061to exit. 1062With 1063.Fl E , 1064run 1065.Ar shell-command 1066to replace the client. 1067.It Ic has-session Op Fl t Ar target-session 1068.D1 (alias: Ic has ) 1069Report an error and exit with 1 if the specified session does not exist. 1070If it does exist, exit with 0. 1071.It Ic kill-server 1072Kill the 1073.Nm 1074server and clients and destroy all sessions. 1075.It Xo Ic kill-session 1076.Op Fl aC 1077.Op Fl t Ar target-session 1078.Xc 1079Destroy the given session, closing any windows linked to it and no other 1080sessions, and detaching all clients attached to it. 1081If 1082.Fl a 1083is given, all sessions but the specified one is killed. 1084The 1085.Fl C 1086flag clears alerts (bell, activity, or silence) in all windows linked to the 1087session. 1088.It Xo Ic list-clients 1089.Op Fl F Ar format 1090.Op Fl t Ar target-session 1091.Xc 1092.D1 (alias: Ic lsc ) 1093List all clients attached to the server. 1094For the meaning of the 1095.Fl F 1096flag, see the 1097.Sx FORMATS 1098section. 1099If 1100.Ar target-session 1101is specified, list only clients connected to that session. 1102.It Xo Ic list-commands 1103.Op Fl F Ar format 1104.Op Ar command 1105.Xc 1106.D1 (alias: Ic lscm ) 1107List the syntax of 1108.Ar command 1109or - if omitted - of all commands supported by 1110.Nm . 1111.It Xo Ic list-sessions 1112.Op Fl F Ar format 1113.Op Fl f Ar filter 1114.Xc 1115.D1 (alias: Ic ls ) 1116List all sessions managed by the server. 1117.Fl F 1118specifies the format of each line and 1119.Fl f 1120a filter. 1121Only sessions for which the filter is true are shown. 1122See the 1123.Sx FORMATS 1124section. 1125.It Ic lock-client Op Fl t Ar target-client 1126.D1 (alias: Ic lockc ) 1127Lock 1128.Ar target-client , 1129see the 1130.Ic lock-server 1131command. 1132.It Ic lock-session Op Fl t Ar target-session 1133.D1 (alias: Ic locks ) 1134Lock all clients attached to 1135.Ar target-session . 1136.It Xo Ic new-session 1137.Op Fl AdDEPX 1138.Op Fl c Ar start-directory 1139.Op Fl e Ar environment 1140.Op Fl f Ar flags 1141.Op Fl F Ar format 1142.Op Fl n Ar window-name 1143.Op Fl s Ar session-name 1144.Op Fl t Ar group-name 1145.Op Fl x Ar width 1146.Op Fl y Ar height 1147.Op Ar shell-command 1148.Xc 1149.D1 (alias: Ic new ) 1150Create a new session with name 1151.Ar session-name . 1152.Pp 1153The new session is attached to the current terminal unless 1154.Fl d 1155is given. 1156.Ar window-name 1157and 1158.Ar shell-command 1159are the name of and shell command to execute in the initial window. 1160With 1161.Fl d , 1162the initial size comes from the global 1163.Ic default-size 1164option; 1165.Fl x 1166and 1167.Fl y 1168can be used to specify a different size. 1169.Ql - 1170uses the size of the current client if any. 1171If 1172.Fl x 1173or 1174.Fl y 1175is given, the 1176.Ic default-size 1177option is set for the session. 1178.Fl f 1179sets a comma-separated list of client flags (see 1180.Ic attach-session ) . 1181.Pp 1182If run from a terminal, any 1183.Xr termios 4 1184special characters are saved and used for new windows in the new session. 1185.Pp 1186The 1187.Fl A 1188flag makes 1189.Ic new-session 1190behave like 1191.Ic attach-session 1192if 1193.Ar session-name 1194already exists; in this case, 1195.Fl D 1196behaves like 1197.Fl d 1198to 1199.Ic attach-session , 1200and 1201.Fl X 1202behaves like 1203.Fl x 1204to 1205.Ic attach-session . 1206.Pp 1207If 1208.Fl t 1209is given, it specifies a 1210.Ic session group . 1211Sessions in the same group share the same set of windows - new windows are 1212linked to all sessions in the group and any windows closed removed from all 1213sessions. 1214The current and previous window and any session options remain independent and 1215any session in a group may be killed without affecting the others. 1216The 1217.Ar group-name 1218argument may be: 1219.Bl -enum -width Ds 1220.It 1221the name of an existing group, in which case the new session is added to that 1222group; 1223.It 1224the name of an existing session - the new session is added to the same group 1225as that session, creating a new group if necessary; 1226.It 1227the name for a new group containing only the new session. 1228.El 1229.Pp 1230.Fl n 1231and 1232.Ar shell-command 1233are invalid if 1234.Fl t 1235is used. 1236.Pp 1237The 1238.Fl P 1239option prints information about the new session after it has been created. 1240By default, it uses the format 1241.Ql #{session_name}:\& 1242but a different format may be specified with 1243.Fl F . 1244.Pp 1245If 1246.Fl E 1247is used, the 1248.Ic update-environment 1249option will not be applied. 1250.Fl e 1251takes the form 1252.Ql VARIABLE=value 1253and sets an environment variable for the newly created session; it may be 1254specified multiple times. 1255.It Xo Ic refresh-client 1256.Op Fl cDlLRSU 1257.Op Fl A Ar pane:state 1258.Op Fl C Ar XxY 1259.Op Fl f Ar flags 1260.Op Fl t Ar target-client 1261.Op Ar adjustment 1262.Xc 1263.D1 (alias: Ic refresh ) 1264Refresh the current client if bound to a key, or a single client if one is given 1265with 1266.Fl t . 1267If 1268.Fl S 1269is specified, only update the client's status line. 1270.Pp 1271The 1272.Fl U , 1273.Fl D , 1274.Fl L 1275.Fl R , 1276and 1277.Fl c 1278flags allow the visible portion of a window which is larger than the client 1279to be changed. 1280.Fl U 1281moves the visible part up by 1282.Ar adjustment 1283rows and 1284.Fl D 1285down, 1286.Fl L 1287left by 1288.Ar adjustment 1289columns and 1290.Fl R 1291right. 1292.Fl c 1293returns to tracking the cursor automatically. 1294If 1295.Ar adjustment 1296is omitted, 1 is used. 1297Note that the visible position is a property of the client not of the 1298window, changing the current window in the attached session will reset 1299it. 1300.Pp 1301.Fl C 1302sets the width and height of a control mode client. 1303.Fl A 1304allows a control mode client to trigger actions on a pane. 1305The argument is a pane ID (with leading 1306.Ql % ) , 1307a colon, then one of 1308.Ql on , 1309.Ql off , 1310.Ql continue 1311or 1312.Ql pause . 1313If 1314.Ql off , 1315.Nm 1316will not send output from the pane to the client and if all clients have turned 1317the pane off, will stop reading from the pane. 1318If 1319.Ql continue , 1320.Nm 1321will return to sending output to the pane if it was paused (manually or with the 1322.Ar pause-after 1323flag). 1324If 1325.Ql pause , 1326.Nm 1327will pause the pane. 1328.Fl A 1329may be given multiple times for different panes. 1330.Pp 1331.Fl f 1332sets a comma-separated list of client flags, see 1333.Ic attach-session . 1334.Pp 1335.Fl l 1336requests the clipboard from the client using the 1337.Xr xterm 1 1338escape sequence and stores it in a new paste buffer. 1339.Pp 1340.Fl L , 1341.Fl R , 1342.Fl U 1343and 1344.Fl D 1345move the visible portion of the window left, right, up or down 1346by 1347.Ar adjustment , 1348if the window is larger than the client. 1349.Fl c 1350resets so that the position follows the cursor. 1351See the 1352.Ic window-size 1353option. 1354.It Xo Ic rename-session 1355.Op Fl t Ar target-session 1356.Ar new-name 1357.Xc 1358.D1 (alias: Ic rename ) 1359Rename the session to 1360.Ar new-name . 1361.It Xo Ic show-messages 1362.Op Fl JT 1363.Op Fl t Ar target-client 1364.Xc 1365.D1 (alias: Ic showmsgs ) 1366Show server messages or information. 1367Messages are stored, up to a maximum of the limit set by the 1368.Ar message-limit 1369server option. 1370.Fl J 1371and 1372.Fl T 1373show debugging information about jobs and terminals. 1374.It Xo Ic source-file 1375.Op Fl nqv 1376.Ar path 1377.Ar ... 1378.Xc 1379.D1 (alias: Ic source ) 1380Execute commands from one or more files specified by 1381.Ar path 1382(which may be 1383.Xr glob 7 1384patterns). 1385If 1386.Fl q 1387is given, no error will be returned if 1388.Ar path 1389does not exist. 1390With 1391.Fl n , 1392the file is parsed but no commands are executed. 1393.Fl v 1394shows the parsed commands and line numbers if possible. 1395.It Ic start-server 1396.D1 (alias: Ic start ) 1397Start the 1398.Nm 1399server, if not already running, without creating any sessions. 1400.Pp 1401Note that as by default the 1402.Nm 1403server will exit with no sessions, this is only useful if a session is created in 1404.Pa ~/.tmux.conf , 1405.Ic exit-empty 1406is turned off, or another command is run as part of the same command sequence. 1407For example: 1408.Bd -literal -offset indent 1409$ tmux start \\; show -g 1410.Ed 1411.It Xo Ic suspend-client 1412.Op Fl t Ar target-client 1413.Xc 1414.D1 (alias: Ic suspendc ) 1415Suspend a client by sending 1416.Dv SIGTSTP 1417(tty stop). 1418.It Xo Ic switch-client 1419.Op Fl ElnprZ 1420.Op Fl c Ar target-client 1421.Op Fl t Ar target-session 1422.Op Fl T Ar key-table 1423.Xc 1424.D1 (alias: Ic switchc ) 1425Switch the current session for client 1426.Ar target-client 1427to 1428.Ar target-session . 1429As a special case, 1430.Fl t 1431may refer to a pane (a target that contains 1432.Ql \&: , 1433.Ql \&. 1434or 1435.Ql % ) , 1436to change session, window and pane. 1437In that case, 1438.Fl Z 1439keeps the window zoomed if it was zoomed. 1440If 1441.Fl l , 1442.Fl n 1443or 1444.Fl p 1445is used, the client is moved to the last, next or previous session 1446respectively. 1447.Fl r 1448toggles the client 1449.Ic read-only 1450and 1451.Ic ignore-size 1452flags (see the 1453.Ic attach-session 1454command). 1455.Pp 1456If 1457.Fl E 1458is used, 1459.Ic update-environment 1460option will not be applied. 1461.Pp 1462.Fl T 1463sets the client's key table; the next key from the client will be interpreted 1464from 1465.Ar key-table . 1466This may be used to configure multiple prefix keys, or to bind commands to 1467sequences of keys. 1468For example, to make typing 1469.Ql abc 1470run the 1471.Ic list-keys 1472command: 1473.Bd -literal -offset indent 1474bind-key -Ttable2 c list-keys 1475bind-key -Ttable1 b switch-client -Ttable2 1476bind-key -Troot a switch-client -Ttable1 1477.Ed 1478.El 1479.Sh WINDOWS AND PANES 1480Each window displayed by 1481.Nm 1482may be split into one or more 1483.Em panes ; 1484each pane takes up a certain area of the display and is a separate terminal. 1485A window may be split into panes using the 1486.Ic split-window 1487command. 1488Windows may be split horizontally (with the 1489.Fl h 1490flag) or vertically. 1491Panes may be resized with the 1492.Ic resize-pane 1493command (bound to 1494.Ql C-Up , 1495.Ql C-Down 1496.Ql C-Left 1497and 1498.Ql C-Right 1499by default), the current pane may be changed with the 1500.Ic select-pane 1501command and the 1502.Ic rotate-window 1503and 1504.Ic swap-pane 1505commands may be used to swap panes without changing their position. 1506Panes are numbered beginning from zero in the order they are created. 1507.Pp 1508By default, a 1509.Nm 1510pane permits direct access to the terminal contained in the pane. 1511A pane may also be put into one of several modes: 1512.Bl -dash -offset indent 1513.It 1514Copy mode, which permits a section of a window or its 1515history to be copied to a 1516.Em paste buffer 1517for later insertion into another window. 1518This mode is entered with the 1519.Ic copy-mode 1520command, bound to 1521.Ql \&[ 1522by default. 1523Copied text can be pasted with the 1524.Ic paste-buffer 1525command, bound to 1526.Ql \&] . 1527.It 1528View mode, which is like copy mode but is entered when a command that produces 1529output, such as 1530.Ic list-keys , 1531is executed from a key binding. 1532.It 1533Choose mode, which allows an item to be chosen from a list. 1534This may be a client, a session or window or pane, or a buffer. 1535This mode is entered with the 1536.Ic choose-buffer , 1537.Ic choose-client 1538and 1539.Ic choose-tree 1540commands. 1541.El 1542.Pp 1543In copy mode an indicator is displayed in the top-right corner of the pane with 1544the current position and the number of lines in the history. 1545.Pp 1546Commands are sent to copy mode using the 1547.Fl X 1548flag to the 1549.Ic send-keys 1550command. 1551When a key is pressed, copy mode automatically uses one of two key tables, 1552depending on the 1553.Ic mode-keys 1554option: 1555.Ic copy-mode 1556for emacs, or 1557.Ic copy-mode-vi 1558for vi. 1559Key tables may be viewed with the 1560.Ic list-keys 1561command. 1562.Pp 1563The following commands are supported in copy mode: 1564.Bl -column "CommandXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" "viXXXXXXXXXX" "emacs" -offset indent 1565.It Sy "Command" Ta Sy "vi" Ta Sy "emacs" 1566.It Li "append-selection" Ta "" Ta "" 1567.It Li "append-selection-and-cancel" Ta "A" Ta "" 1568.It Li "back-to-indentation" Ta "^" Ta "M-m" 1569.It Li "begin-selection" Ta "Space" Ta "C-Space" 1570.It Li "bottom-line" Ta "L" Ta "" 1571.It Li "cancel" Ta "q" Ta "Escape" 1572.It Li "clear-selection" Ta "Escape" Ta "C-g" 1573.It Li "copy-end-of-line [<prefix>]" Ta "D" Ta "C-k" 1574.It Li "copy-line [<prefix>]" Ta "" Ta "" 1575.It Li "copy-pipe [<command>] [<prefix>]" Ta "" Ta "" 1576.It Li "copy-pipe-no-clear [<command>] [<prefix>]" Ta "" Ta "" 1577.It Li "copy-pipe-and-cancel [<command>] [<prefix>]" Ta "" Ta "" 1578.It Li "copy-selection [<prefix>]" Ta "" Ta "" 1579.It Li "copy-selection-no-clear [<prefix>]" Ta "" Ta "" 1580.It Li "copy-selection-and-cancel [<prefix>]" Ta "Enter" Ta "M-w" 1581.It Li "cursor-down" Ta "j" Ta "Down" 1582.It Li "cursor-down-and-cancel" Ta "" Ta "" 1583.It Li "cursor-left" Ta "h" Ta "Left" 1584.It Li "cursor-right" Ta "l" Ta "Right" 1585.It Li "cursor-up" Ta "k" Ta "Up" 1586.It Li "end-of-line" Ta "$" Ta "C-e" 1587.It Li "goto-line <line>" Ta ":" Ta "g" 1588.It Li "halfpage-down" Ta "C-d" Ta "M-Down" 1589.It Li "halfpage-down-and-cancel" Ta "" Ta "" 1590.It Li "halfpage-up" Ta "C-u" Ta "M-Up" 1591.It Li "history-bottom" Ta "G" Ta "M->" 1592.It Li "history-top" Ta "g" Ta "M-<" 1593.It Li "jump-again" Ta ";" Ta ";" 1594.It Li "jump-backward <to>" Ta "F" Ta "F" 1595.It Li "jump-forward <to>" Ta "f" Ta "f" 1596.It Li "jump-reverse" Ta "," Ta "," 1597.It Li "jump-to-backward <to>" Ta "T" Ta "" 1598.It Li "jump-to-forward <to>" Ta "t" Ta "" 1599.It Li "jump-to-mark" Ta "M-x" Ta "M-x" 1600.It Li "middle-line" Ta "M" Ta "M-r" 1601.It Li "next-matching-bracket" Ta "%" Ta "M-C-f" 1602.It Li "next-paragraph" Ta "}" Ta "M-}" 1603.It Li "next-space" Ta "W" Ta "" 1604.It Li "next-space-end" Ta "E" Ta "" 1605.It Li "next-word" Ta "w" Ta "" 1606.It Li "next-word-end" Ta "e" Ta "M-f" 1607.It Li "other-end" Ta "o" Ta "" 1608.It Li "page-down" Ta "C-f" Ta "PageDown" 1609.It Li "page-down-and-cancel" Ta "" Ta "" 1610.It Li "page-up" Ta "C-b" Ta "PageUp" 1611.It Li "previous-matching-bracket" Ta "" Ta "M-C-b" 1612.It Li "previous-paragraph" Ta "{" Ta "M-{" 1613.It Li "previous-space" Ta "B" Ta "" 1614.It Li "previous-word" Ta "b" Ta "M-b" 1615.It Li "rectangle-toggle" Ta "v" Ta "R" 1616.It Li "refresh-from-pane" Ta "r" Ta "r" 1617.It Li "scroll-down" Ta "C-e" Ta "C-Down" 1618.It Li "scroll-down-and-cancel" Ta "" Ta "" 1619.It Li "scroll-up" Ta "C-y" Ta "C-Up" 1620.It Li "search-again" Ta "n" Ta "n" 1621.It Li "search-backward <for>" Ta "?" Ta "" 1622.It Li "search-backward-incremental <for>" Ta "" Ta "C-r" 1623.It Li "search-backward-text <for>" Ta "" Ta "" 1624.It Li "search-forward <for>" Ta "/" Ta "" 1625.It Li "search-forward-incremental <for>" Ta "" Ta "C-s" 1626.It Li "search-forward-text <for>" Ta "" Ta "" 1627.It Li "search-reverse" Ta "N" Ta "N" 1628.It Li "select-line" Ta "V" Ta "" 1629.It Li "select-word" Ta "" Ta "" 1630.It Li "set-mark" Ta "X" Ta "X" 1631.It Li "start-of-line" Ta "0" Ta "C-a" 1632.It Li "stop-selection" Ta "" Ta "" 1633.It Li "top-line" Ta "H" Ta "M-R" 1634.El 1635.Pp 1636The search commands come in several varieties: 1637.Ql search-forward 1638and 1639.Ql search-backward 1640search for a regular expression; 1641the 1642.Ql -text 1643variants search for a plain text string rather than a regular expression; 1644.Ql -incremental 1645perform an incremental search and expect to be used with the 1646.Fl i 1647flag to the 1648.Ic command-prompt 1649command. 1650.Ql search-again 1651repeats the last search and 1652.Ql search-reverse 1653does the same but reverses the direction (forward becomes backward and backward 1654becomes forward). 1655.Pp 1656Copy commands may take an optional buffer prefix argument which is used 1657to generate the buffer name (the default is 1658.Ql buffer 1659so buffers are named 1660.Ql buffer0 , 1661.Ql buffer1 1662and so on). 1663Pipe commands take a command argument which is the command to which the 1664copied text is piped. 1665The 1666.Ql -and-cancel 1667variants of some commands exit copy mode after they have completed (for copy 1668commands) or when the cursor reaches the bottom (for scrolling commands). 1669.Ql -no-clear 1670variants do not clear the selection. 1671.Pp 1672The next and previous word keys use space and the 1673.Ql - , 1674.Ql _ 1675and 1676.Ql @ 1677characters as word delimiters by default, but this can be adjusted by 1678setting the 1679.Em word-separators 1680session option. 1681Next word moves to the start of the next word, next word end to the end of the 1682next word and previous word to the start of the previous word. 1683The three next and previous space keys work similarly but use a space alone as 1684the word separator. 1685.Pp 1686The jump commands enable quick movement within a line. 1687For instance, typing 1688.Ql f 1689followed by 1690.Ql / 1691will move the cursor to the next 1692.Ql / 1693character on the current line. 1694A 1695.Ql \&; 1696will then jump to the next occurrence. 1697.Pp 1698Commands in copy mode may be prefaced by an optional repeat count. 1699With vi key bindings, a prefix is entered using the number keys; with 1700emacs, the Alt (meta) key and a number begins prefix entry. 1701.Pp 1702The synopsis for the 1703.Ic copy-mode 1704command is: 1705.Bl -tag -width Ds 1706.It Xo Ic copy-mode 1707.Op Fl eHMqu 1708.Op Fl s Ar src-pane 1709.Op Fl t Ar target-pane 1710.Xc 1711Enter copy mode. 1712The 1713.Fl u 1714option scrolls one page up. 1715.Fl M 1716begins a mouse drag (only valid if bound to a mouse key binding, see 1717.Sx MOUSE SUPPORT ) . 1718.Fl H 1719hides the position indicator in the top right. 1720.Fl q 1721cancels copy mode and any other modes. 1722.Fl s 1723copies from 1724.Ar src-pane 1725instead of 1726.Ar target-pane . 1727.Pp 1728.Fl e 1729specifies that scrolling to the bottom of the history (to the visible screen) 1730should exit copy mode. 1731While in copy mode, pressing a key other than those used for scrolling will 1732disable this behaviour. 1733This is intended to allow fast scrolling through a pane's history, for 1734example with: 1735.Bd -literal -offset indent 1736bind PageUp copy-mode -eu 1737.Ed 1738.El 1739.Pp 1740A number of preset arrangements of panes are available, these are called layouts. 1741These may be selected with the 1742.Ic select-layout 1743command or cycled with 1744.Ic next-layout 1745(bound to 1746.Ql Space 1747by default); once a layout is chosen, panes within it may be moved and resized 1748as normal. 1749.Pp 1750The following layouts are supported: 1751.Bl -tag -width Ds 1752.It Ic even-horizontal 1753Panes are spread out evenly from left to right across the window. 1754.It Ic even-vertical 1755Panes are spread evenly from top to bottom. 1756.It Ic main-horizontal 1757A large (main) pane is shown at the top of the window and the remaining panes 1758are spread from left to right in the leftover space at the bottom. 1759Use the 1760.Em main-pane-height 1761window option to specify the height of the top pane. 1762.It Ic main-vertical 1763Similar to 1764.Ic main-horizontal 1765but the large pane is placed on the left and the others spread from top to 1766bottom along the right. 1767See the 1768.Em main-pane-width 1769window option. 1770.It Ic tiled 1771Panes are spread out as evenly as possible over the window in both rows and 1772columns. 1773.El 1774.Pp 1775In addition, 1776.Ic select-layout 1777may be used to apply a previously used layout - the 1778.Ic list-windows 1779command displays the layout of each window in a form suitable for use with 1780.Ic select-layout . 1781For example: 1782.Bd -literal -offset indent 1783$ tmux list-windows 17840: ksh [159x48] 1785 layout: bb62,159x48,0,0{79x48,0,0,79x48,80,0} 1786$ tmux select-layout bb62,159x48,0,0{79x48,0,0,79x48,80,0} 1787.Ed 1788.Pp 1789.Nm 1790automatically adjusts the size of the layout for the current window size. 1791Note that a layout cannot be applied to a window with more panes than that 1792from which the layout was originally defined. 1793.Pp 1794Commands related to windows and panes are as follows: 1795.Bl -tag -width Ds 1796.It Xo Ic break-pane 1797.Op Fl abdP 1798.Op Fl F Ar format 1799.Op Fl n Ar window-name 1800.Op Fl s Ar src-pane 1801.Op Fl t Ar dst-window 1802.Xc 1803.D1 (alias: Ic breakp ) 1804Break 1805.Ar src-pane 1806off from its containing window to make it the only pane in 1807.Ar dst-window . 1808With 1809.Fl a 1810or 1811.Fl b , 1812the window is moved to the next index after or before (existing windows are 1813moved if necessary). 1814If 1815.Fl d 1816is given, the new window does not become the current window. 1817The 1818.Fl P 1819option prints information about the new window after it has been created. 1820By default, it uses the format 1821.Ql #{session_name}:#{window_index} 1822but a different format may be specified with 1823.Fl F . 1824.It Xo Ic capture-pane 1825.Op Fl aepPqCJN 1826.Op Fl b Ar buffer-name 1827.Op Fl E Ar end-line 1828.Op Fl S Ar start-line 1829.Op Fl t Ar target-pane 1830.Xc 1831.D1 (alias: Ic capturep ) 1832Capture the contents of a pane. 1833If 1834.Fl p 1835is given, the output goes to stdout, otherwise to the buffer specified with 1836.Fl b 1837or a new buffer if omitted. 1838If 1839.Fl a 1840is given, the alternate screen is used, and the history is not accessible. 1841If no alternate screen exists, an error will be returned unless 1842.Fl q 1843is given. 1844If 1845.Fl e 1846is given, the output includes escape sequences for text and background 1847attributes. 1848.Fl C 1849also escapes non-printable characters as octal \exxx. 1850.Fl N 1851preserves trailing spaces at each line's end and 1852.Fl J 1853preserves trailing spaces and joins any wrapped lines. 1854.Fl P 1855captures only any output that the pane has received that is the beginning of an 1856as-yet incomplete escape sequence. 1857.Pp 1858.Fl S 1859and 1860.Fl E 1861specify the starting and ending line numbers, zero is the first line of the 1862visible pane and negative numbers are lines in the history. 1863.Ql - 1864to 1865.Fl S 1866is the start of the history and to 1867.Fl E 1868the end of the visible pane. 1869The default is to capture only the visible contents of the pane. 1870.It Xo 1871.Ic choose-client 1872.Op Fl NrZ 1873.Op Fl F Ar format 1874.Op Fl f Ar filter 1875.Op Fl O Ar sort-order 1876.Op Fl t Ar target-pane 1877.Op Ar template 1878.Xc 1879Put a pane into client mode, allowing a client to be selected interactively from 1880a list. 1881.Fl Z 1882zooms the pane. 1883The following keys may be used in client mode: 1884.Bl -column "Key" "Function" -offset indent 1885.It Sy "Key" Ta Sy "Function" 1886.It Li "Enter" Ta "Choose selected client" 1887.It Li "Up" Ta "Select previous client" 1888.It Li "Down" Ta "Select next client" 1889.It Li "C-s" Ta "Search by name" 1890.It Li "n" Ta "Repeat last search" 1891.It Li "t" Ta "Toggle if client is tagged" 1892.It Li "T" Ta "Tag no clients" 1893.It Li "C-t" Ta "Tag all clients" 1894.It Li "d" Ta "Detach selected client" 1895.It Li "D" Ta "Detach tagged clients" 1896.It Li "x" Ta "Detach and HUP selected client" 1897.It Li "X" Ta "Detach and HUP tagged clients" 1898.It Li "z" Ta "Suspend selected client" 1899.It Li "Z" Ta "Suspend tagged clients" 1900.It Li "f" Ta "Enter a format to filter items" 1901.It Li "O" Ta "Change sort field" 1902.It Li "r" Ta "Reverse sort order" 1903.It Li "v" Ta "Toggle preview" 1904.It Li "q" Ta "Exit mode" 1905.El 1906.Pp 1907After a client is chosen, 1908.Ql %% 1909is replaced by the client name in 1910.Ar template 1911and the result executed as a command. 1912If 1913.Ar template 1914is not given, "detach-client -t '%%'" is used. 1915.Pp 1916.Fl O 1917specifies the initial sort field: one of 1918.Ql name , 1919.Ql size , 1920.Ql creation , 1921or 1922.Ql activity . 1923.Fl r 1924reverses the sort order. 1925.Fl f 1926specifies an initial filter: the filter is a format - if it evaluates to zero, 1927the item in the list is not shown, otherwise it is shown. 1928If a filter would lead to an empty list, it is ignored. 1929.Fl F 1930specifies the format for each item in the list. 1931.Fl N 1932starts without the preview. 1933This command works only if at least one client is attached. 1934.It Xo 1935.Ic choose-tree 1936.Op Fl GNrswZ 1937.Op Fl F Ar format 1938.Op Fl f Ar filter 1939.Op Fl O Ar sort-order 1940.Op Fl t Ar target-pane 1941.Op Ar template 1942.Xc 1943Put a pane into tree mode, where a session, window or pane may be chosen 1944interactively from a list. 1945.Fl s 1946starts with sessions collapsed and 1947.Fl w 1948with windows collapsed. 1949.Fl Z 1950zooms the pane. 1951The following keys may be used in tree mode: 1952.Bl -column "Key" "Function" -offset indent 1953.It Sy "Key" Ta Sy "Function" 1954.It Li "Enter" Ta "Choose selected item" 1955.It Li "Up" Ta "Select previous item" 1956.It Li "Down" Ta "Select next item" 1957.It Li "+" Ta "Expand selected item" 1958.It Li "-" Ta "Collapse selected item" 1959.It Li "M-+" Ta "Expand all items" 1960.It Li "M--" Ta "Collapse all items" 1961.It Li "x" Ta "Kill selected item" 1962.It Li "X" Ta "Kill tagged items" 1963.It Li "<" Ta "Scroll list of previews left" 1964.It Li ">" Ta "Scroll list of previews right" 1965.It Li "C-s" Ta "Search by name" 1966.It Li "m" Ta "Set the marked pane" 1967.It Li "M" Ta "Clear the marked pane" 1968.It Li "n" Ta "Repeat last search" 1969.It Li "t" Ta "Toggle if item is tagged" 1970.It Li "T" Ta "Tag no items" 1971.It Li "C-t" Ta "Tag all items" 1972.It Li "\&:" Ta "Run a command for each tagged item" 1973.It Li "f" Ta "Enter a format to filter items" 1974.It Li "H" Ta "Jump to the starting pane" 1975.It Li "O" Ta "Change sort field" 1976.It Li "r" Ta "Reverse sort order" 1977.It Li "v" Ta "Toggle preview" 1978.It Li "q" Ta "Exit mode" 1979.El 1980.Pp 1981After a session, window or pane is chosen, 1982.Ql %% 1983is replaced by the target in 1984.Ar template 1985and the result executed as a command. 1986If 1987.Ar template 1988is not given, "switch-client -t '%%'" is used. 1989.Pp 1990.Fl O 1991specifies the initial sort field: one of 1992.Ql index , 1993.Ql name , 1994or 1995.Ql time . 1996.Fl r 1997reverses the sort order. 1998.Fl f 1999specifies an initial filter: the filter is a format - if it evaluates to zero, 2000the item in the list is not shown, otherwise it is shown. 2001If a filter would lead to an empty list, it is ignored. 2002.Fl F 2003specifies the format for each item in the tree. 2004.Fl N 2005starts without the preview. 2006.Fl G 2007includes all sessions in any session groups in the tree rather than only the 2008first. 2009This command works only if at least one client is attached. 2010.It Xo 2011.Ic customize-mode 2012.Op Fl NZ 2013.Op Fl F Ar format 2014.Op Fl f Ar filter 2015.Op Fl t Ar target-pane 2016.Op Ar template 2017.Xc 2018Put a pane into customize mode, where options and key bindings may be browsed 2019and modified from a list. 2020Option values in the list are shown for the active pane in the current window. 2021.Fl Z 2022zooms the pane. 2023The following keys may be used in customize mode: 2024.Bl -column "Key" "Function" -offset indent 2025.It Sy "Key" Ta Sy "Function" 2026.It Li "Enter" Ta "Set pane, window, session or global option value" 2027.It Li "Up" Ta "Select previous item" 2028.It Li "Down" Ta "Select next item" 2029.It Li "+" Ta "Expand selected item" 2030.It Li "-" Ta "Collapse selected item" 2031.It Li "M-+" Ta "Expand all items" 2032.It Li "M--" Ta "Collapse all items" 2033.It Li "s" Ta "Set option value or key attribute" 2034.It Li "S" Ta "Set global option value" 2035.It Li "w" Ta "Set window option value, if option is for pane and window" 2036.It Li "d" Ta "Set an option or key to the default" 2037.It Li "D" Ta "Set tagged options and tagged keys to the default" 2038.It Li "u" Ta "Unset an option (set to default value if global) or unbind a key" 2039.It Li "U" Ta "Unset tagged options and unbind tagged keys" 2040.It Li "C-s" Ta "Search by name" 2041.It Li "n" Ta "Repeat last search" 2042.It Li "t" Ta "Toggle if item is tagged" 2043.It Li "T" Ta "Tag no items" 2044.It Li "C-t" Ta "Tag all items" 2045.It Li "f" Ta "Enter a format to filter items" 2046.It Li "v" Ta "Toggle option information" 2047.It Li "q" Ta "Exit mode" 2048.El 2049.Pp 2050.Fl f 2051specifies an initial filter: the filter is a format - if it evaluates to zero, 2052the item in the list is not shown, otherwise it is shown. 2053If a filter would lead to an empty list, it is ignored. 2054.Fl F 2055specifies the format for each item in the tree. 2056.Fl N 2057starts without the option information. 2058This command works only if at least one client is attached. 2059.It Xo 2060.Ic display-panes 2061.Op Fl b 2062.Op Fl d Ar duration 2063.Op Fl t Ar target-client 2064.Op Ar template 2065.Xc 2066.D1 (alias: Ic displayp ) 2067Display a visible indicator of each pane shown by 2068.Ar target-client . 2069See the 2070.Ic display-panes-colour 2071and 2072.Ic display-panes-active-colour 2073session options. 2074The indicator is closed when a key is pressed or 2075.Ar duration 2076milliseconds have passed. 2077If 2078.Fl d 2079is not given, 2080.Ic display-panes-time 2081is used. 2082A duration of zero means the indicator stays until a key is pressed. 2083While the indicator is on screen, a pane may be chosen with the 2084.Ql 0 2085to 2086.Ql 9 2087keys, which will cause 2088.Ar template 2089to be executed as a command with 2090.Ql %% 2091substituted by the pane ID. 2092The default 2093.Ar template 2094is "select-pane -t '%%'". 2095With 2096.Fl b , 2097other commands are not blocked from running until the indicator is closed. 2098.It Xo Ic find-window 2099.Op Fl iCNrTZ 2100.Op Fl t Ar target-pane 2101.Ar match-string 2102.Xc 2103.D1 (alias: Ic findw ) 2104Search for a 2105.Xr fnmatch 3 2106pattern or, with 2107.Fl r , 2108regular expression 2109.Ar match-string 2110in window names, titles, and visible content (but not history). 2111The flags control matching behavior: 2112.Fl C 2113matches only visible window contents, 2114.Fl N 2115matches only the window name and 2116.Fl T 2117matches only the window title. 2118.Fl i 2119makes the search ignore case. 2120The default is 2121.Fl CNT . 2122.Fl Z 2123zooms the pane. 2124.Pp 2125This command works only if at least one client is attached. 2126.It Xo Ic join-pane 2127.Op Fl bdfhv 2128.Op Fl l Ar size 2129.Op Fl s Ar src-pane 2130.Op Fl t Ar dst-pane 2131.Xc 2132.D1 (alias: Ic joinp ) 2133Like 2134.Ic split-window , 2135but instead of splitting 2136.Ar dst-pane 2137and creating a new pane, split it and move 2138.Ar src-pane 2139into the space. 2140This can be used to reverse 2141.Ic break-pane . 2142The 2143.Fl b 2144option causes 2145.Ar src-pane 2146to be joined to left of or above 2147.Ar dst-pane . 2148.Pp 2149If 2150.Fl s 2151is omitted and a marked pane is present (see 2152.Ic select-pane 2153.Fl m ) , 2154the marked pane is used rather than the current pane. 2155.It Xo Ic kill-pane 2156.Op Fl a 2157.Op Fl t Ar target-pane 2158.Xc 2159.D1 (alias: Ic killp ) 2160Destroy the given pane. 2161If no panes remain in the containing window, it is also destroyed. 2162The 2163.Fl a 2164option kills all but the pane given with 2165.Fl t . 2166.It Xo Ic kill-window 2167.Op Fl a 2168.Op Fl t Ar target-window 2169.Xc 2170.D1 (alias: Ic killw ) 2171Kill the current window or the window at 2172.Ar target-window , 2173removing it from any sessions to which it is linked. 2174The 2175.Fl a 2176option kills all but the window given with 2177.Fl t . 2178.It Xo Ic last-pane 2179.Op Fl deZ 2180.Op Fl t Ar target-window 2181.Xc 2182.D1 (alias: Ic lastp ) 2183Select the last (previously selected) pane. 2184.Fl Z 2185keeps the window zoomed if it was zoomed. 2186.Fl e 2187enables or 2188.Fl d 2189disables input to the pane. 2190.It Ic last-window Op Fl t Ar target-session 2191.D1 (alias: Ic last ) 2192Select the last (previously selected) window. 2193If no 2194.Ar target-session 2195is specified, select the last window of the current session. 2196.It Xo Ic link-window 2197.Op Fl abdk 2198.Op Fl s Ar src-window 2199.Op Fl t Ar dst-window 2200.Xc 2201.D1 (alias: Ic linkw ) 2202Link the window at 2203.Ar src-window 2204to the specified 2205.Ar dst-window . 2206If 2207.Ar dst-window 2208is specified and no such window exists, the 2209.Ar src-window 2210is linked there. 2211With 2212.Fl a 2213or 2214.Fl b 2215the window is moved to the next index after or before 2216.Ar dst-window 2217(existing windows are moved if necessary). 2218If 2219.Fl k 2220is given and 2221.Ar dst-window 2222exists, it is killed, otherwise an error is generated. 2223If 2224.Fl d 2225is given, the newly linked window is not selected. 2226.It Xo Ic list-panes 2227.Op Fl as 2228.Op Fl F Ar format 2229.Op Fl f Ar filter 2230.Op Fl t Ar target 2231.Xc 2232.D1 (alias: Ic lsp ) 2233If 2234.Fl a 2235is given, 2236.Ar target 2237is ignored and all panes on the server are listed. 2238If 2239.Fl s 2240is given, 2241.Ar target 2242is a session (or the current session). 2243If neither is given, 2244.Ar target 2245is a window (or the current window). 2246.Fl F 2247specifies the format of each line and 2248.Fl f 2249a filter. 2250Only panes for which the filter is true are shown. 2251See the 2252.Sx FORMATS 2253section. 2254.It Xo Ic list-windows 2255.Op Fl a 2256.Op Fl F Ar format 2257.Op Fl f Ar filter 2258.Op Fl t Ar target-session 2259.Xc 2260.D1 (alias: Ic lsw ) 2261If 2262.Fl a 2263is given, list all windows on the server. 2264Otherwise, list windows in the current session or in 2265.Ar target-session . 2266.Fl F 2267specifies the format of each line and 2268.Fl f 2269a filter. 2270Only windows for which the filter is true are shown. 2271See the 2272.Sx FORMATS 2273section. 2274.It Xo Ic move-pane 2275.Op Fl bdfhv 2276.Op Fl l Ar size 2277.Op Fl s Ar src-pane 2278.Op Fl t Ar dst-pane 2279.Xc 2280.D1 (alias: Ic movep ) 2281Does the same as 2282.Ic join-pane . 2283.It Xo Ic move-window 2284.Op Fl abrdk 2285.Op Fl s Ar src-window 2286.Op Fl t Ar dst-window 2287.Xc 2288.D1 (alias: Ic movew ) 2289This is similar to 2290.Ic link-window , 2291except the window at 2292.Ar src-window 2293is moved to 2294.Ar dst-window . 2295With 2296.Fl r , 2297all windows in the session are renumbered in sequential order, respecting 2298the 2299.Ic base-index 2300option. 2301.It Xo Ic new-window 2302.Op Fl abdkP 2303.Op Fl c Ar start-directory 2304.Op Fl e Ar environment 2305.Op Fl F Ar format 2306.Op Fl n Ar window-name 2307.Op Fl t Ar target-window 2308.Op Ar shell-command 2309.Xc 2310.D1 (alias: Ic neww ) 2311Create a new window. 2312With 2313.Fl a 2314or 2315.Fl b , 2316the new window is inserted at the next index after or before the specified 2317.Ar target-window , 2318moving windows up if necessary; 2319otherwise 2320.Ar target-window 2321is the new window location. 2322.Pp 2323If 2324.Fl d 2325is given, the session does not make the new window the current window. 2326.Ar target-window 2327represents the window to be created; if the target already exists an error is 2328shown, unless the 2329.Fl k 2330flag is used, in which case it is destroyed. 2331.Ar shell-command 2332is the command to execute. 2333If 2334.Ar shell-command 2335is not specified, the value of the 2336.Ic default-command 2337option is used. 2338.Fl c 2339specifies the working directory in which the new window is created. 2340.Pp 2341When the shell command completes, the window closes. 2342See the 2343.Ic remain-on-exit 2344option to change this behaviour. 2345.Pp 2346.Fl e 2347takes the form 2348.Ql VARIABLE=value 2349and sets an environment variable for the newly created window; it may be 2350specified multiple times. 2351.Pp 2352The 2353.Ev TERM 2354environment variable must be set to 2355.Ql screen 2356or 2357.Ql tmux 2358for all programs running 2359.Em inside 2360.Nm . 2361New windows will automatically have 2362.Ql TERM=screen 2363added to their environment, but care must be taken not to reset this in shell 2364start-up files or by the 2365.Fl e 2366option. 2367.Pp 2368The 2369.Fl P 2370option prints information about the new window after it has been created. 2371By default, it uses the format 2372.Ql #{session_name}:#{window_index} 2373but a different format may be specified with 2374.Fl F . 2375.It Ic next-layout Op Fl t Ar target-window 2376.D1 (alias: Ic nextl ) 2377Move a window to the next layout and rearrange the panes to fit. 2378.It Xo Ic next-window 2379.Op Fl a 2380.Op Fl t Ar target-session 2381.Xc 2382.D1 (alias: Ic next ) 2383Move to the next window in the session. 2384If 2385.Fl a 2386is used, move to the next window with an alert. 2387.It Xo Ic pipe-pane 2388.Op Fl IOo 2389.Op Fl t Ar target-pane 2390.Op Ar shell-command 2391.Xc 2392.D1 (alias: Ic pipep ) 2393Pipe output sent by the program in 2394.Ar target-pane 2395to a shell command or vice versa. 2396A pane may only be connected to one command at a time, any existing pipe is 2397closed before 2398.Ar shell-command 2399is executed. 2400The 2401.Ar shell-command 2402string may contain the special character sequences supported by the 2403.Ic status-left 2404option. 2405If no 2406.Ar shell-command 2407is given, the current pipe (if any) is closed. 2408.Pp 2409.Fl I 2410and 2411.Fl O 2412specify which of the 2413.Ar shell-command 2414output streams are connected to the pane: 2415with 2416.Fl I 2417stdout is connected (so anything 2418.Ar shell-command 2419prints is written to the pane as if it were typed); 2420with 2421.Fl O 2422stdin is connected (so any output in the pane is piped to 2423.Ar shell-command ) . 2424Both may be used together and if neither are specified, 2425.Fl O 2426is used. 2427.Pp 2428The 2429.Fl o 2430option only opens a new pipe if no previous pipe exists, allowing a pipe to 2431be toggled with a single key, for example: 2432.Bd -literal -offset indent 2433bind-key C-p pipe-pane -o 'cat >>~/output.#I-#P' 2434.Ed 2435.It Xo Ic previous-layout 2436.Op Fl t Ar target-window 2437.Xc 2438.D1 (alias: Ic prevl ) 2439Move to the previous layout in the session. 2440.It Xo Ic previous-window 2441.Op Fl a 2442.Op Fl t Ar target-session 2443.Xc 2444.D1 (alias: Ic prev ) 2445Move to the previous window in the session. 2446With 2447.Fl a , 2448move to the previous window with an alert. 2449.It Xo Ic rename-window 2450.Op Fl t Ar target-window 2451.Ar new-name 2452.Xc 2453.D1 (alias: Ic renamew ) 2454Rename the current window, or the window at 2455.Ar target-window 2456if specified, to 2457.Ar new-name . 2458.It Xo Ic resize-pane 2459.Op Fl DLMRTUZ 2460.Op Fl t Ar target-pane 2461.Op Fl x Ar width 2462.Op Fl y Ar height 2463.Op Ar adjustment 2464.Xc 2465.D1 (alias: Ic resizep ) 2466Resize a pane, up, down, left or right by 2467.Ar adjustment 2468with 2469.Fl U , 2470.Fl D , 2471.Fl L 2472or 2473.Fl R , 2474or 2475to an absolute size 2476with 2477.Fl x 2478or 2479.Fl y . 2480The 2481.Ar adjustment 2482is given in lines or columns (the default is 1); 2483.Fl x 2484and 2485.Fl y 2486may be a given as a number of lines or columns or followed by 2487.Ql % 2488for a percentage of the window size (for example 2489.Ql -x 10% ) . 2490With 2491.Fl Z , 2492the active pane is toggled between zoomed (occupying the whole of the window) 2493and unzoomed (its normal position in the layout). 2494.Pp 2495.Fl M 2496begins mouse resizing (only valid if bound to a mouse key binding, see 2497.Sx MOUSE SUPPORT ) . 2498.Pp 2499.Fl T 2500trims all lines below the current cursor position and moves lines out of the 2501history to replace them. 2502.It Xo Ic resize-window 2503.Op Fl aADLRU 2504.Op Fl t Ar target-window 2505.Op Fl x Ar width 2506.Op Fl y Ar height 2507.Op Ar adjustment 2508.Xc 2509.D1 (alias: Ic resizew ) 2510Resize a window, up, down, left or right by 2511.Ar adjustment 2512with 2513.Fl U , 2514.Fl D , 2515.Fl L 2516or 2517.Fl R , 2518or 2519to an absolute size 2520with 2521.Fl x 2522or 2523.Fl y . 2524The 2525.Ar adjustment 2526is given in lines or cells (the default is 1). 2527.Fl A 2528sets the size of the largest session containing the window; 2529.Fl a 2530the size of the smallest. 2531This command will automatically set 2532.Ic window-size 2533to manual in the window options. 2534.It Xo Ic respawn-pane 2535.Op Fl k 2536.Op Fl c Ar start-directory 2537.Op Fl e Ar environment 2538.Op Fl t Ar target-pane 2539.Op Ar shell-command 2540.Xc 2541.D1 (alias: Ic respawnp ) 2542Reactivate a pane in which the command has exited (see the 2543.Ic remain-on-exit 2544window option). 2545If 2546.Ar shell-command 2547is not given, the command used when the pane was created or last respawned is 2548executed. 2549The pane must be already inactive, unless 2550.Fl k 2551is given, in which case any existing command is killed. 2552.Fl c 2553specifies a new working directory for the pane. 2554The 2555.Fl e 2556option has the same meaning as for the 2557.Ic new-window 2558command. 2559.It Xo Ic respawn-window 2560.Op Fl k 2561.Op Fl c Ar start-directory 2562.Op Fl e Ar environment 2563.Op Fl t Ar target-window 2564.Op Ar shell-command 2565.Xc 2566.D1 (alias: Ic respawnw ) 2567Reactivate a window in which the command has exited (see the 2568.Ic remain-on-exit 2569window option). 2570If 2571.Ar shell-command 2572is not given, the command used when the window was created or last respawned is 2573executed. 2574The window must be already inactive, unless 2575.Fl k 2576is given, in which case any existing command is killed. 2577.Fl c 2578specifies a new working directory for the window. 2579The 2580.Fl e 2581option has the same meaning as for the 2582.Ic new-window 2583command. 2584.It Xo Ic rotate-window 2585.Op Fl DUZ 2586.Op Fl t Ar target-window 2587.Xc 2588.D1 (alias: Ic rotatew ) 2589Rotate the positions of the panes within a window, either upward (numerically 2590lower) with 2591.Fl U 2592or downward (numerically higher). 2593.Fl Z 2594keeps the window zoomed if it was zoomed. 2595.It Xo Ic select-layout 2596.Op Fl Enop 2597.Op Fl t Ar target-pane 2598.Op Ar layout-name 2599.Xc 2600.D1 (alias: Ic selectl ) 2601Choose a specific layout for a window. 2602If 2603.Ar layout-name 2604is not given, the last preset layout used (if any) is reapplied. 2605.Fl n 2606and 2607.Fl p 2608are equivalent to the 2609.Ic next-layout 2610and 2611.Ic previous-layout 2612commands. 2613.Fl o 2614applies the last set layout if possible (undoes the most recent layout change). 2615.Fl E 2616spreads the current pane and any panes next to it out evenly. 2617.It Xo Ic select-pane 2618.Op Fl DdeLlMmRUZ 2619.Op Fl T Ar title 2620.Op Fl t Ar target-pane 2621.Xc 2622.D1 (alias: Ic selectp ) 2623Make pane 2624.Ar target-pane 2625the active pane in its window. 2626If one of 2627.Fl D , 2628.Fl L , 2629.Fl R , 2630or 2631.Fl U 2632is used, respectively the pane below, to the left, to the right, or above the 2633target pane is used. 2634.Fl Z 2635keeps the window zoomed if it was zoomed. 2636.Fl l 2637is the same as using the 2638.Ic last-pane 2639command. 2640.Fl e 2641enables or 2642.Fl d 2643disables input to the pane. 2644.Fl T 2645sets the pane title. 2646.Pp 2647.Fl m 2648and 2649.Fl M 2650are used to set and clear the 2651.Em marked pane . 2652There is one marked pane at a time, setting a new marked pane clears the last. 2653The marked pane is the default target for 2654.Fl s 2655to 2656.Ic join-pane , 2657.Ic move-pane , 2658.Ic swap-pane 2659and 2660.Ic swap-window . 2661.It Xo Ic select-window 2662.Op Fl lnpT 2663.Op Fl t Ar target-window 2664.Xc 2665.D1 (alias: Ic selectw ) 2666Select the window at 2667.Ar target-window . 2668.Fl l , 2669.Fl n 2670and 2671.Fl p 2672are equivalent to the 2673.Ic last-window , 2674.Ic next-window 2675and 2676.Ic previous-window 2677commands. 2678If 2679.Fl T 2680is given and the selected window is already the current window, 2681the command behaves like 2682.Ic last-window . 2683.It Xo Ic split-window 2684.Op Fl bdfhIvP 2685.Op Fl c Ar start-directory 2686.Op Fl e Ar environment 2687.Op Fl l Ar size 2688.Op Fl t Ar target-pane 2689.Op Ar shell-command 2690.Op Fl F Ar format 2691.Xc 2692.D1 (alias: Ic splitw ) 2693Create a new pane by splitting 2694.Ar target-pane : 2695.Fl h 2696does a horizontal split and 2697.Fl v 2698a vertical split; if neither is specified, 2699.Fl v 2700is assumed. 2701The 2702.Fl l 2703option specifies the size of the new pane in lines (for vertical split) or in 2704columns (for horizontal split); 2705.Ar size 2706may be followed by 2707.Ql % 2708to specify a percentage of the available space. 2709The 2710.Fl b 2711option causes the new pane to be created to the left of or above 2712.Ar target-pane . 2713The 2714.Fl f 2715option creates a new pane spanning the full window height (with 2716.Fl h ) 2717or full window width (with 2718.Fl v ) , 2719instead of splitting the active pane. 2720.Pp 2721An empty 2722.Ar shell-command 2723('') will create a pane with no command running in it. 2724Output can be sent to such a pane with the 2725.Ic display-message 2726command. 2727The 2728.Fl I 2729flag (if 2730.Ar shell-command 2731is not specified or empty) 2732will create an empty pane and forward any output from stdin to it. 2733For example: 2734.Bd -literal -offset indent 2735$ make 2>&1|tmux splitw -dI & 2736.Ed 2737.Pp 2738All other options have the same meaning as for the 2739.Ic new-window 2740command. 2741.It Xo Ic swap-pane 2742.Op Fl dDUZ 2743.Op Fl s Ar src-pane 2744.Op Fl t Ar dst-pane 2745.Xc 2746.D1 (alias: Ic swapp ) 2747Swap two panes. 2748If 2749.Fl U 2750is used and no source pane is specified with 2751.Fl s , 2752.Ar dst-pane 2753is swapped with the previous pane (before it numerically); 2754.Fl D 2755swaps with the next pane (after it numerically). 2756.Fl d 2757instructs 2758.Nm 2759not to change the active pane and 2760.Fl Z 2761keeps the window zoomed if it was zoomed. 2762.Pp 2763If 2764.Fl s 2765is omitted and a marked pane is present (see 2766.Ic select-pane 2767.Fl m ) , 2768the marked pane is used rather than the current pane. 2769.It Xo Ic swap-window 2770.Op Fl d 2771.Op Fl s Ar src-window 2772.Op Fl t Ar dst-window 2773.Xc 2774.D1 (alias: Ic swapw ) 2775This is similar to 2776.Ic link-window , 2777except the source and destination windows are swapped. 2778It is an error if no window exists at 2779.Ar src-window . 2780If 2781.Fl d 2782is given, the new window does not become the current window. 2783.Pp 2784If 2785.Fl s 2786is omitted and a marked pane is present (see 2787.Ic select-pane 2788.Fl m ) , 2789the window containing the marked pane is used rather than the current window. 2790.It Xo Ic unlink-window 2791.Op Fl k 2792.Op Fl t Ar target-window 2793.Xc 2794.D1 (alias: Ic unlinkw ) 2795Unlink 2796.Ar target-window . 2797Unless 2798.Fl k 2799is given, a window may be unlinked only if it is linked to multiple sessions - 2800windows may not be linked to no sessions; 2801if 2802.Fl k 2803is specified and the window is linked to only one session, it is unlinked and 2804destroyed. 2805.El 2806.Sh KEY BINDINGS 2807.Nm 2808allows a command to be bound to most keys, with or without a prefix key. 2809When specifying keys, most represent themselves (for example 2810.Ql A 2811to 2812.Ql Z ) . 2813Ctrl keys may be prefixed with 2814.Ql C- 2815or 2816.Ql ^ , 2817and Alt (meta) with 2818.Ql M- . 2819In addition, the following special key names are accepted: 2820.Em Up , 2821.Em Down , 2822.Em Left , 2823.Em Right , 2824.Em BSpace , 2825.Em BTab , 2826.Em DC 2827(Delete), 2828.Em End , 2829.Em Enter , 2830.Em Escape , 2831.Em F1 2832to 2833.Em F12 , 2834.Em Home , 2835.Em IC 2836(Insert), 2837.Em NPage/PageDown/PgDn , 2838.Em PPage/PageUp/PgUp , 2839.Em Space , 2840and 2841.Em Tab . 2842Note that to bind the 2843.Ql \&" 2844or 2845.Ql ' 2846keys, quotation marks are necessary, for example: 2847.Bd -literal -offset indent 2848bind-key '"' split-window 2849bind-key "'" new-window 2850.Ed 2851.Pp 2852A command bound to the 2853.Em Any 2854key will execute for all keys which do not have a more specific binding. 2855.Pp 2856Commands related to key bindings are as follows: 2857.Bl -tag -width Ds 2858.It Xo Ic bind-key 2859.Op Fl nr 2860.Op Fl N Ar note 2861.Op Fl T Ar key-table 2862.Ar key command Op Ar arguments 2863.Xc 2864.D1 (alias: Ic bind ) 2865Bind key 2866.Ar key 2867to 2868.Ar command . 2869Keys are bound in a key table. 2870By default (without -T), the key is bound in 2871the 2872.Em prefix 2873key table. 2874This table is used for keys pressed after the prefix key (for example, 2875by default 2876.Ql c 2877is bound to 2878.Ic new-window 2879in the 2880.Em prefix 2881table, so 2882.Ql C-b c 2883creates a new window). 2884The 2885.Em root 2886table is used for keys pressed without the prefix key: binding 2887.Ql c 2888to 2889.Ic new-window 2890in the 2891.Em root 2892table (not recommended) means a plain 2893.Ql c 2894will create a new window. 2895.Fl n 2896is an alias 2897for 2898.Fl T Ar root . 2899Keys may also be bound in custom key tables and the 2900.Ic switch-client 2901.Fl T 2902command used to switch to them from a key binding. 2903The 2904.Fl r 2905flag indicates this key may repeat, see the 2906.Ic repeat-time 2907option. 2908.Fl N 2909attaches a note to the key (shown with 2910.Ic list-keys 2911.Fl N ) . 2912.Pp 2913To view the default bindings and possible commands, see the 2914.Ic list-keys 2915command. 2916.It Xo Ic list-keys 2917.Op Fl 1aN 2918.Op Fl P Ar prefix-string Fl T Ar key-table 2919.Op Ar key 2920.Xc 2921.D1 (alias: Ic lsk ) 2922List key bindings. 2923There are two forms: the default lists keys as 2924.Ic bind-key 2925commands; 2926.Fl N 2927lists only keys with attached notes and shows only the key and note for each 2928key. 2929.Pp 2930With the default form, all key tables are listed by default. 2931.Fl T 2932lists only keys in 2933.Ar key-table . 2934.Pp 2935With the 2936.Fl N 2937form, only keys in the 2938.Em root 2939and 2940.Em prefix 2941key tables are listed by default; 2942.Fl T 2943also lists only keys in 2944.Ar key-table . 2945.Fl P 2946specifies a prefix to print before each key and 2947.Fl 1 2948lists only the first matching key. 2949.Fl a 2950lists the command for keys that do have a note rather than skipping them. 2951.It Xo Ic send-keys 2952.Op Fl FHlMRX 2953.Op Fl N Ar repeat-count 2954.Op Fl t Ar target-pane 2955.Ar key Ar ... 2956.Xc 2957.D1 (alias: Ic send ) 2958Send a key or keys to a window. 2959Each argument 2960.Ar key 2961is the name of the key (such as 2962.Ql C-a 2963or 2964.Ql NPage ) 2965to send; if the string is not recognised as a key, it is sent as a series of 2966characters. 2967All arguments are sent sequentially from first to last. 2968.Pp 2969The 2970.Fl l 2971flag disables key name lookup and processes the keys as literal UTF-8 2972characters. 2973The 2974.Fl H 2975flag expects each key to be a hexadecimal number for an ASCII character. 2976.Pp 2977The 2978.Fl R 2979flag causes the terminal state to be reset. 2980.Pp 2981.Fl M 2982passes through a mouse event (only valid if bound to a mouse key binding, see 2983.Sx MOUSE SUPPORT ) . 2984.Pp 2985.Fl X 2986is used to send a command into copy mode - see 2987the 2988.Sx WINDOWS AND PANES 2989section. 2990.Fl N 2991specifies a repeat count and 2992.Fl F 2993expands formats in arguments where appropriate. 2994.It Xo Ic send-prefix 2995.Op Fl 2 2996.Op Fl t Ar target-pane 2997.Xc 2998Send the prefix key, or with 2999.Fl 2 3000the secondary prefix key, to a window as if it was pressed. 3001.It Xo Ic unbind-key 3002.Op Fl an 3003.Op Fl T Ar key-table 3004.Ar key 3005.Xc 3006.D1 (alias: Ic unbind ) 3007Unbind the command bound to 3008.Ar key . 3009.Fl n 3010and 3011.Fl T 3012are the same as for 3013.Ic bind-key . 3014If 3015.Fl a 3016is present, all key bindings are removed. 3017.El 3018.Sh OPTIONS 3019The appearance and behaviour of 3020.Nm 3021may be modified by changing the value of various options. 3022There are four types of option: 3023.Em server options , 3024.Em session options 3025.Em window options 3026and 3027.Em pane options . 3028.Pp 3029The 3030.Nm 3031server has a set of global server options which do not apply to any particular 3032window or session or pane. 3033These are altered with the 3034.Ic set-option 3035.Fl s 3036command, or displayed with the 3037.Ic show-options 3038.Fl s 3039command. 3040.Pp 3041In addition, each individual session may have a set of session options, and 3042there is a separate set of global session options. 3043Sessions which do not have a particular option configured inherit the value 3044from the global session options. 3045Session options are set or unset with the 3046.Ic set-option 3047command and may be listed with the 3048.Ic show-options 3049command. 3050The available server and session options are listed under the 3051.Ic set-option 3052command. 3053.Pp 3054Similarly, a set of window options is attached to each window and a set of pane 3055options to each pane. 3056Pane options inherit from window options. 3057This means any pane option may be set as a window option to apply the option to 3058all panes in the window without the option set, for example these commands will 3059set the background colour to red for all panes except pane 0: 3060.Bd -literal -offset indent 3061set -w window-style bg=red 3062set -pt:.0 window-style bg=blue 3063.Ed 3064.Pp 3065There is also a set of global window options from which any unset window or 3066pane options are inherited. 3067Window and pane options are altered with 3068.Ic set-option 3069.Fl w 3070and 3071.Fl p 3072commands and displayed with 3073.Ic show-option 3074.Fl w 3075and 3076.Fl p . 3077.Pp 3078.Nm 3079also supports user options which are prefixed with a 3080.Ql \&@ . 3081User options may have any name, so long as they are prefixed with 3082.Ql \&@ , 3083and be set to any string. 3084For example: 3085.Bd -literal -offset indent 3086$ tmux set -wq @foo "abc123" 3087$ tmux show -wv @foo 3088abc123 3089.Ed 3090.Pp 3091Commands which set options are as follows: 3092.Bl -tag -width Ds 3093.It Xo Ic set-option 3094.Op Fl aFgopqsuw 3095.Op Fl t Ar target-pane 3096.Ar option Ar value 3097.Xc 3098.D1 (alias: Ic set ) 3099Set a pane option with 3100.Fl p , 3101a window option with 3102.Fl w , 3103a server option with 3104.Fl s , 3105otherwise a session option. 3106If the option is not a user option, 3107.Fl w 3108or 3109.Fl s 3110may be unnecessary - 3111.Nm 3112will infer the type from the option name, assuming 3113.Fl w 3114for pane options. 3115If 3116.Fl g 3117is given, the global session or window option is set. 3118.Pp 3119.Fl F 3120expands formats in the option value. 3121The 3122.Fl u 3123flag unsets an option, so a session inherits the option from the global 3124options (or with 3125.Fl g , 3126restores a global option to the default). 3127.Pp 3128The 3129.Fl o 3130flag prevents setting an option that is already set and the 3131.Fl q 3132flag suppresses errors about unknown or ambiguous options. 3133.Pp 3134With 3135.Fl a , 3136and if the option expects a string or a style, 3137.Ar value 3138is appended to the existing setting. 3139For example: 3140.Bd -literal -offset indent 3141set -g status-left "foo" 3142set -ag status-left "bar" 3143.Ed 3144.Pp 3145Will result in 3146.Ql foobar . 3147And: 3148.Bd -literal -offset indent 3149set -g status-style "bg=red" 3150set -ag status-style "fg=blue" 3151.Ed 3152.Pp 3153Will result in a red background 3154.Em and 3155blue foreground. 3156Without 3157.Fl a , 3158the result would be the default background and a blue foreground. 3159.It Xo Ic show-options 3160.Op Fl AgHpqsvw 3161.Op Fl t Ar target-pane 3162.Op Ar option 3163.Xc 3164.D1 (alias: Ic show ) 3165Show the pane options (or a single option if 3166.Ar option 3167is provided) with 3168.Fl p , 3169the window options with 3170.Fl w , 3171the server options with 3172.Fl s , 3173otherwise the session options. 3174If the option is not a user option, 3175.Fl w 3176or 3177.Fl s 3178may be unnecessary - 3179.Nm 3180will infer the type from the option name, assuming 3181.Fl w 3182for pane options. 3183Global session or window options are listed if 3184.Fl g 3185is used. 3186.Fl v 3187shows only the option value, not the name. 3188If 3189.Fl q 3190is set, no error will be returned if 3191.Ar option 3192is unset. 3193.Fl H 3194includes hooks (omitted by default). 3195.Fl A 3196includes options inherited from a parent set of options, such options are 3197marked with an asterisk. 3198.Ar value 3199depends on the option and may be a number, a string, or a flag (on, off, or 3200omitted to toggle). 3201.El 3202.Pp 3203Available server options are: 3204.Bl -tag -width Ds 3205.It Ic backspace Ar key 3206Set the key sent by 3207.Nm 3208for backspace. 3209.It Ic buffer-limit Ar number 3210Set the number of buffers; as new buffers are added to the top of the stack, 3211old ones are removed from the bottom if necessary to maintain this maximum 3212length. 3213.It Xo Ic command-alias[] 3214.Ar name=value 3215.Xc 3216This is an array of custom aliases for commands. 3217If an unknown command matches 3218.Ar name , 3219it is replaced with 3220.Ar value . 3221For example, after: 3222.Pp 3223.Dl set -s command-alias[100] zoom='resize-pane -Z' 3224.Pp 3225Using: 3226.Pp 3227.Dl zoom -t:.1 3228.Pp 3229Is equivalent to: 3230.Pp 3231.Dl resize-pane -Z -t:.1 3232.Pp 3233Note that aliases are expanded when a command is parsed rather than when it is 3234executed, so binding an alias with 3235.Ic bind-key 3236will bind the expanded form. 3237.It Ic default-terminal Ar terminal 3238Set the default terminal for new windows created in this session - the 3239default value of the 3240.Ev TERM 3241environment variable. 3242For 3243.Nm 3244to work correctly, this 3245.Em must 3246be set to 3247.Ql screen , 3248.Ql tmux 3249or a derivative of them. 3250.It Ic copy-command Ar shell-command 3251Give the command to pipe to if the 3252.Ic copy-pipe 3253copy mode command is used without arguments. 3254.It Ic escape-time Ar time 3255Set the time in milliseconds for which 3256.Nm 3257waits after an escape is input to determine if it is part of a function or meta 3258key sequences. 3259The default is 500 milliseconds. 3260.It Ic editor Ar shell-command 3261Set the command used when 3262.Nm 3263runs an editor. 3264.It Xo Ic exit-empty 3265.Op Ic on | off 3266.Xc 3267If enabled (the default), the server will exit when there are no active 3268sessions. 3269.It Xo Ic exit-unattached 3270.Op Ic on | off 3271.Xc 3272If enabled, the server will exit when there are no attached clients. 3273.It Xo Ic extended-keys 3274.Op Ic on | off 3275.Xc 3276When enabled, extended keys are requested from the terminal and if supported 3277are recognised by 3278.Nm . 3279.It Xo Ic focus-events 3280.Op Ic on | off 3281.Xc 3282When enabled, focus events are requested from the terminal if supported and 3283passed through to applications running in 3284.Nm . 3285Attached clients should be detached and attached again after changing this 3286option. 3287.It Ic history-file Ar path 3288If not empty, a file to which 3289.Nm 3290will write command prompt history on exit and load it from on start. 3291.It Ic message-limit Ar number 3292Set the number of error or information messages to save in the message log for 3293each client. 3294The default is 100. 3295.It Xo Ic set-clipboard 3296.Op Ic on | external | off 3297.Xc 3298Attempt to set the terminal clipboard content using the 3299.Xr xterm 1 3300escape sequence, if there is an 3301.Em \&Ms 3302entry in the 3303.Xr terminfo 5 3304description (see the 3305.Sx TERMINFO EXTENSIONS 3306section). 3307.Pp 3308If set to 3309.Ic on , 3310.Nm 3311will both accept the escape sequence to create a buffer and attempt to set 3312the terminal clipboard. 3313If set to 3314.Ic external , 3315.Nm 3316will attempt to set the terminal clipboard but ignore attempts 3317by applications to set 3318.Nm 3319buffers. 3320If 3321.Ic off , 3322.Nm 3323will neither accept the clipboard escape sequence nor attempt to set the 3324clipboard. 3325.Pp 3326Note that this feature needs to be enabled in 3327.Xr xterm 1 3328by setting the resource: 3329.Bd -literal -offset indent 3330disallowedWindowOps: 20,21,SetXprop 3331.Ed 3332.Pp 3333Or changing this property from the 3334.Xr xterm 1 3335interactive menu when required. 3336.It Ic terminal-features[] Ar string 3337Set terminal features for terminal types read from 3338.Xr terminfo 5 . 3339.Nm 3340has a set of named terminal features. 3341Each will apply appropriate changes to the 3342.Xr terminfo 5 3343entry in use. 3344.Pp 3345.Nm 3346can detect features for a few common terminals; this option can be used to 3347easily tell tmux about features supported by terminals it cannot detect. 3348The 3349.Ic terminal-overrides 3350option allows individual 3351.Xr terminfo 5 3352capabilities to be set instead, 3353.Ic terminal-features 3354is intended for classes of functionality supported in a standard way but not 3355reported by 3356.Xr terminfo 5 . 3357Care must be taken only to configure this with features the terminal actually 3358support. 3359.Pp 3360This is an array option where each entry is a colon-separated string made up 3361of a terminal type pattern (matched using 3362.Xr fnmatch 3 ) 3363followed by a list of terminal features. 3364The available features are: 3365.Bl -tag -width Ds 3366.It 256 3367Supports 256 colours with the SGR escape sequences. 3368.It clipboard 3369Allows setting the system clipboard. 3370.It ccolour 3371Allows setting the cursor colour. 3372.It cstyle 3373Allows setting the cursor style. 3374.It extkeys 3375Supports extended keys. 3376.It focus 3377Supports focus reporting. 3378.It margins 3379Supports DECSLRM margins. 3380.It overline 3381Supports the overline SGR attribute. 3382.It rectfill 3383Supports the DECFRA rectangle fill escape sequence. 3384.It RGB 3385Supports RGB colour with the SGR escape sequences. 3386.It strikethrough 3387Supports the strikethrough SGR escape sequence. 3388.It sync 3389Supports synchronized updates. 3390.It title 3391Supports 3392.Xr xterm 1 3393title setting. 3394.It usstyle 3395Allows underscore style and colour to be set. 3396.It UTF-8 3397Is able to handle UTF-8 output. 3398.El 3399.It Ic terminal-overrides[] Ar string 3400Allow terminal descriptions read using 3401.Xr terminfo 5 3402to be overridden. 3403Each entry is a colon-separated string made up of a terminal type pattern 3404(matched using 3405.Xr fnmatch 3 ) 3406and a set of 3407.Em name=value 3408entries. 3409.Pp 3410For example, to set the 3411.Ql clear 3412.Xr terminfo 5 3413entry to 3414.Ql \ee[H\ee[2J 3415for all terminal types matching 3416.Ql rxvt* : 3417.Pp 3418.Dl "rxvt*:clear=\ee[H\ee[2J" 3419.Pp 3420The terminal entry value is passed through 3421.Xr strunvis 3 3422before interpretation. 3423.It Ic user-keys[] Ar key 3424Set list of user-defined key escape sequences. 3425Each item is associated with a key named 3426.Ql User0 , 3427.Ql User1 , 3428and so on. 3429.Pp 3430For example: 3431.Bd -literal -offset indent 3432set -s user-keys[0] "\ee[5;30012~" 3433bind User0 resize-pane -L 3 3434.Ed 3435.El 3436.Pp 3437Available session options are: 3438.Bl -tag -width Ds 3439.It Xo Ic activity-action 3440.Op Ic any | none | current | other 3441.Xc 3442Set action on window activity when 3443.Ic monitor-activity 3444is on. 3445.Ic any 3446means activity in any window linked to a session causes a bell or message 3447(depending on 3448.Ic visual-activity ) 3449in the current window of that session, 3450.Ic none 3451means all activity is ignored (equivalent to 3452.Ic monitor-activity 3453being off), 3454.Ic current 3455means only activity in windows other than the current window are ignored and 3456.Ic other 3457means activity in the current window is ignored but not those in other windows. 3458.It Ic assume-paste-time Ar milliseconds 3459If keys are entered faster than one in 3460.Ar milliseconds , 3461they are assumed to have been pasted rather than typed and 3462.Nm 3463key bindings are not processed. 3464The default is one millisecond and zero disables. 3465.It Ic base-index Ar index 3466Set the base index from which an unused index should be searched when a new 3467window is created. 3468The default is zero. 3469.It Xo Ic bell-action 3470.Op Ic any | none | current | other 3471.Xc 3472Set action on a bell in a window when 3473.Ic monitor-bell 3474is on. 3475The values are the same as those for 3476.Ic activity-action . 3477.It Ic default-command Ar shell-command 3478Set the command used for new windows (if not specified when the window is 3479created) to 3480.Ar shell-command , 3481which may be any 3482.Xr sh 1 3483command. 3484The default is an empty string, which instructs 3485.Nm 3486to create a login shell using the value of the 3487.Ic default-shell 3488option. 3489.It Ic default-shell Ar path 3490Specify the default shell. 3491This is used as the login shell for new windows when the 3492.Ic default-command 3493option is set to empty, and must be the full path of the executable. 3494When started 3495.Nm 3496tries to set a default value from the first suitable of the 3497.Ev SHELL 3498environment variable, the shell returned by 3499.Xr getpwuid 3 , 3500or 3501.Pa /bin/sh . 3502This option should be configured when 3503.Nm 3504is used as a login shell. 3505.It Ic default-size Ar XxY 3506Set the default size of new windows when the 3507.Ic window-size 3508option is set to manual or when a session is created with 3509.Ic new-session 3510.Fl d . 3511The value is the width and height separated by an 3512.Ql x 3513character. 3514The default is 80x24. 3515.It Xo Ic destroy-unattached 3516.Op Ic on | off 3517.Xc 3518If enabled and the session is no longer attached to any clients, it is 3519destroyed. 3520.It Xo Ic detach-on-destroy 3521.Op Ic on | off 3522.Xc 3523If on (the default), the client is detached when the session it is attached to 3524is destroyed. 3525If off, the client is switched to the most recently active of the remaining 3526sessions. 3527.It Ic display-panes-active-colour Ar colour 3528Set the colour used by the 3529.Ic display-panes 3530command to show the indicator for the active pane. 3531.It Ic display-panes-colour Ar colour 3532Set the colour used by the 3533.Ic display-panes 3534command to show the indicators for inactive panes. 3535.It Ic display-panes-time Ar time 3536Set the time in milliseconds for which the indicators shown by the 3537.Ic display-panes 3538command appear. 3539.It Ic display-time Ar time 3540Set the amount of time for which status line messages and other on-screen 3541indicators are displayed. 3542If set to 0, messages and indicators are displayed until a key is pressed. 3543.Ar time 3544is in milliseconds. 3545.It Ic history-limit Ar lines 3546Set the maximum number of lines held in window history. 3547This setting applies only to new windows - existing window histories are not 3548resized and retain the limit at the point they were created. 3549.It Ic key-table Ar key-table 3550Set the default key table to 3551.Ar key-table 3552instead of 3553.Em root . 3554.It Ic lock-after-time Ar number 3555Lock the session (like the 3556.Ic lock-session 3557command) after 3558.Ar number 3559seconds of inactivity. 3560The default is not to lock (set to 0). 3561.It Ic lock-command Ar shell-command 3562Command to run when locking each client. 3563The default is to run 3564.Xr lock 1 3565with 3566.Fl np . 3567.It Ic message-command-style Ar style 3568Set status line message command style. 3569This is used for the command prompt with 3570.Xr vi 1 3571keys when in command mode. 3572For how to specify 3573.Ar style , 3574see the 3575.Sx STYLES 3576section. 3577.It Ic message-style Ar style 3578Set status line message style. 3579This is used for messages and for the command prompt. 3580For how to specify 3581.Ar style , 3582see the 3583.Sx STYLES 3584section. 3585.It Xo Ic mouse 3586.Op Ic on | off 3587.Xc 3588If on, 3589.Nm 3590captures the mouse and allows mouse events to be bound as key bindings. 3591See the 3592.Sx MOUSE SUPPORT 3593section for details. 3594.It Ic prefix Ar key 3595Set the key accepted as a prefix key. 3596In addition to the standard keys described under 3597.Sx KEY BINDINGS , 3598.Ic prefix 3599can be set to the special key 3600.Ql None 3601to set no prefix. 3602.It Ic prefix2 Ar key 3603Set a secondary key accepted as a prefix key. 3604Like 3605.Ic prefix , 3606.Ic prefix2 3607can be set to 3608.Ql None . 3609.It Xo Ic renumber-windows 3610.Op Ic on | off 3611.Xc 3612If on, when a window is closed in a session, automatically renumber the other 3613windows in numerical order. 3614This respects the 3615.Ic base-index 3616option if it has been set. 3617If off, do not renumber the windows. 3618.It Ic repeat-time Ar time 3619Allow multiple commands to be entered without pressing the prefix-key again 3620in the specified 3621.Ar time 3622milliseconds (the default is 500). 3623Whether a key repeats may be set when it is bound using the 3624.Fl r 3625flag to 3626.Ic bind-key . 3627Repeat is enabled for the default keys bound to the 3628.Ic resize-pane 3629command. 3630.It Xo Ic set-titles 3631.Op Ic on | off 3632.Xc 3633Attempt to set the client terminal title using the 3634.Em tsl 3635and 3636.Em fsl 3637.Xr terminfo 5 3638entries if they exist. 3639.Nm 3640automatically sets these to the \ee]0;...\e007 sequence if 3641the terminal appears to be 3642.Xr xterm 1 . 3643This option is off by default. 3644.It Ic set-titles-string Ar string 3645String used to set the client terminal title if 3646.Ic set-titles 3647is on. 3648Formats are expanded, see the 3649.Sx FORMATS 3650section. 3651.It Xo Ic silence-action 3652.Op Ic any | none | current | other 3653.Xc 3654Set action on window silence when 3655.Ic monitor-silence 3656is on. 3657The values are the same as those for 3658.Ic activity-action . 3659.It Xo Ic status 3660.Op Ic off | on | 2 | 3 | 4 | 5 3661.Xc 3662Show or hide the status line or specify its size. 3663Using 3664.Ic on 3665gives a status line one row in height; 3666.Ic 2 , 3667.Ic 3 , 3668.Ic 4 3669or 3670.Ic 5 3671more rows. 3672.It Ic status-format[] Ar format 3673Specify the format to be used for each line of the status line. 3674The default builds the top status line from the various individual status 3675options below. 3676.It Ic status-interval Ar interval 3677Update the status line every 3678.Ar interval 3679seconds. 3680By default, updates will occur every 15 seconds. 3681A setting of zero disables redrawing at interval. 3682.It Xo Ic status-justify 3683.Op Ic left | centre | right 3684.Xc 3685Set the position of the window list component of the status line: left, centre 3686or right justified. 3687.It Xo Ic status-keys 3688.Op Ic vi | emacs 3689.Xc 3690Use vi or emacs-style 3691key bindings in the status line, for example at the command prompt. 3692The default is emacs, unless the 3693.Ev VISUAL 3694or 3695.Ev EDITOR 3696environment variables are set and contain the string 3697.Ql vi . 3698.It Ic status-left Ar string 3699Display 3700.Ar string 3701(by default the session name) to the left of the status line. 3702.Ar string 3703will be passed through 3704.Xr strftime 3 . 3705Also see the 3706.Sx FORMATS 3707and 3708.Sx STYLES 3709sections. 3710.Pp 3711For details on how the names and titles can be set see the 3712.Sx "NAMES AND TITLES" 3713section. 3714.Pp 3715Examples are: 3716.Bd -literal -offset indent 3717#(sysctl vm.loadavg) 3718#[fg=yellow,bold]#(apm -l)%%#[default] [#S] 3719.Ed 3720.Pp 3721The default is 3722.Ql "[#S] " . 3723.It Ic status-left-length Ar length 3724Set the maximum 3725.Ar length 3726of the left component of the status line. 3727The default is 10. 3728.It Ic status-left-style Ar style 3729Set the style of the left part of the status line. 3730For how to specify 3731.Ar style , 3732see the 3733.Sx STYLES 3734section. 3735.It Xo Ic status-position 3736.Op Ic top | bottom 3737.Xc 3738Set the position of the status line. 3739.It Ic status-right Ar string 3740Display 3741.Ar string 3742to the right of the status line. 3743By default, the current pane title in double quotes, the date and the time 3744are shown. 3745As with 3746.Ic status-left , 3747.Ar string 3748will be passed to 3749.Xr strftime 3 3750and character pairs are replaced. 3751.It Ic status-right-length Ar length 3752Set the maximum 3753.Ar length 3754of the right component of the status line. 3755The default is 40. 3756.It Ic status-right-style Ar style 3757Set the style of the right part of the status line. 3758For how to specify 3759.Ar style , 3760see the 3761.Sx STYLES 3762section. 3763.It Ic status-style Ar style 3764Set status line style. 3765For how to specify 3766.Ar style , 3767see the 3768.Sx STYLES 3769section. 3770.It Ic update-environment[] Ar variable 3771Set list of environment variables to be copied into the session environment 3772when a new session is created or an existing session is attached. 3773Any variables that do not exist in the source environment are set to be 3774removed from the session environment (as if 3775.Fl r 3776was given to the 3777.Ic set-environment 3778command). 3779.It Xo Ic visual-activity 3780.Op Ic on | off | both 3781.Xc 3782If on, display a message instead of sending a bell when activity occurs in a 3783window for which the 3784.Ic monitor-activity 3785window option is enabled. 3786If set to both, a bell and a message are produced. 3787.It Xo Ic visual-bell 3788.Op Ic on | off | both 3789.Xc 3790If on, a message is shown on a bell in a window for which the 3791.Ic monitor-bell 3792window option is enabled instead of it being passed through to the 3793terminal (which normally makes a sound). 3794If set to both, a bell and a message are produced. 3795Also see the 3796.Ic bell-action 3797option. 3798.It Xo Ic visual-silence 3799.Op Ic on | off | both 3800.Xc 3801If 3802.Ic monitor-silence 3803is enabled, prints a message after the interval has expired on a given window 3804instead of sending a bell. 3805If set to both, a bell and a message are produced. 3806.It Ic word-separators Ar string 3807Sets the session's conception of what characters are considered word 3808separators, for the purposes of the next and previous word commands in 3809copy mode. 3810The default is 3811.Ql \ -_@ . 3812.El 3813.Pp 3814Available window options are: 3815.Pp 3816.Bl -tag -width Ds -compact 3817.It Xo Ic aggressive-resize 3818.Op Ic on | off 3819.Xc 3820Aggressively resize the chosen window. 3821This means that 3822.Nm 3823will resize the window to the size of the smallest or largest session 3824(see the 3825.Ic window-size 3826option) for which it is the current window, rather than the session to 3827which it is attached. 3828The window may resize when the current window is changed on another 3829session; this option is good for full-screen programs which support 3830.Dv SIGWINCH 3831and poor for interactive programs such as shells. 3832.Pp 3833.It Xo Ic automatic-rename 3834.Op Ic on | off 3835.Xc 3836Control automatic window renaming. 3837When this setting is enabled, 3838.Nm 3839will rename the window automatically using the format specified by 3840.Ic automatic-rename-format . 3841This flag is automatically disabled for an individual window when a name 3842is specified at creation with 3843.Ic new-window 3844or 3845.Ic new-session , 3846or later with 3847.Ic rename-window , 3848or with a terminal escape sequence. 3849It may be switched off globally with: 3850.Bd -literal -offset indent 3851set-option -wg automatic-rename off 3852.Ed 3853.Pp 3854.It Ic automatic-rename-format Ar format 3855The format (see 3856.Sx FORMATS ) 3857used when the 3858.Ic automatic-rename 3859option is enabled. 3860.Pp 3861.It Ic clock-mode-colour Ar colour 3862Set clock colour. 3863.Pp 3864.It Xo Ic clock-mode-style 3865.Op Ic 12 | 24 3866.Xc 3867Set clock hour format. 3868.Pp 3869.It Ic main-pane-height Ar height 3870.It Ic main-pane-width Ar width 3871Set the width or height of the main (left or top) pane in the 3872.Ic main-horizontal 3873or 3874.Ic main-vertical 3875layouts. 3876If suffixed by 3877.Ql % , 3878this is a percentage of the window size. 3879.Pp 3880.It Ic copy-mode-match-style Ar style 3881Set the style of search matches in copy mode. 3882For how to specify 3883.Ar style , 3884see the 3885.Sx STYLES 3886section. 3887.Pp 3888.It Ic copy-mode-mark-style Ar style 3889Set the style of the line containing the mark in copy mode. 3890For how to specify 3891.Ar style , 3892see the 3893.Sx STYLES 3894section. 3895.Pp 3896.It Ic copy-mode-current-match-style Ar style 3897Set the style of the current search match in copy mode. 3898For how to specify 3899.Ar style , 3900see the 3901.Sx STYLES 3902section. 3903.Pp 3904.It Xo Ic mode-keys 3905.Op Ic vi | emacs 3906.Xc 3907Use vi or emacs-style key bindings in copy mode. 3908The default is emacs, unless 3909.Ev VISUAL 3910or 3911.Ev EDITOR 3912contains 3913.Ql vi . 3914.Pp 3915.It Ic mode-style Ar style 3916Set window modes style. 3917For how to specify 3918.Ar style , 3919see the 3920.Sx STYLES 3921section. 3922.Pp 3923.It Xo Ic monitor-activity 3924.Op Ic on | off 3925.Xc 3926Monitor for activity in the window. 3927Windows with activity are highlighted in the status line. 3928.Pp 3929.It Xo Ic monitor-bell 3930.Op Ic on | off 3931.Xc 3932Monitor for a bell in the window. 3933Windows with a bell are highlighted in the status line. 3934.Pp 3935.It Xo Ic monitor-silence 3936.Op Ic interval 3937.Xc 3938Monitor for silence (no activity) in the window within 3939.Ic interval 3940seconds. 3941Windows that have been silent for the interval are highlighted in the 3942status line. 3943An interval of zero disables the monitoring. 3944.Pp 3945.It Ic other-pane-height Ar height 3946Set the height of the other panes (not the main pane) in the 3947.Ic main-horizontal 3948layout. 3949If this option is set to 0 (the default), it will have no effect. 3950If both the 3951.Ic main-pane-height 3952and 3953.Ic other-pane-height 3954options are set, the main pane will grow taller to make the other panes the 3955specified height, but will never shrink to do so. 3956If suffixed by 3957.Ql % , 3958this is a percentage of the window size. 3959.Pp 3960.It Ic other-pane-width Ar width 3961Like 3962.Ic other-pane-height , 3963but set the width of other panes in the 3964.Ic main-vertical 3965layout. 3966.Pp 3967.It Ic pane-active-border-style Ar style 3968Set the pane border style for the currently active pane. 3969For how to specify 3970.Ar style , 3971see the 3972.Sx STYLES 3973section. 3974Attributes are ignored. 3975.Pp 3976.It Ic pane-base-index Ar index 3977Like 3978.Ic base-index , 3979but set the starting index for pane numbers. 3980.Pp 3981.It Ic pane-border-format Ar format 3982Set the text shown in pane border status lines. 3983.Pp 3984.It Ic pane-border-lines Ar type 3985Set the type of characters used for drawing pane borders. 3986.Ar type 3987may be one of: 3988.Bl -tag -width Ds 3989.It single 3990single lines using ACS or UTF-8 characters 3991.It double 3992double lines using UTF-8 characters 3993.It heavy 3994heavy lines using UTF-8 characters 3995.It simple 3996simple ASCII characters 3997.It number 3998the pane number 3999.El 4000.Pp 4001.Ql double 4002and 4003.Ql heavy 4004will fall back to standard ACS line drawing when UTF-8 is not supported. 4005.Pp 4006.It Xo Ic pane-border-status 4007.Op Ic off | top | bottom 4008.Xc 4009Turn pane border status lines off or set their position. 4010.Pp 4011.It Ic pane-border-style Ar style 4012Set the pane border style for panes aside from the active pane. 4013For how to specify 4014.Ar style , 4015see the 4016.Sx STYLES 4017section. 4018Attributes are ignored. 4019.Pp 4020.It Xo Ic synchronize-panes 4021.Op Ic on | off 4022.Xc 4023Duplicate input to any pane to all other panes in the same window (only 4024for panes that are not in any special mode). 4025.Pp 4026.It Ic window-status-activity-style Ar style 4027Set status line style for windows with an activity alert. 4028For how to specify 4029.Ar style , 4030see the 4031.Sx STYLES 4032section. 4033.Pp 4034.It Ic window-status-bell-style Ar style 4035Set status line style for windows with a bell alert. 4036For how to specify 4037.Ar style , 4038see the 4039.Sx STYLES 4040section. 4041.Pp 4042.It Ic window-status-current-format Ar string 4043Like 4044.Ar window-status-format , 4045but is the format used when the window is the current window. 4046.Pp 4047.It Ic window-status-current-style Ar style 4048Set status line style for the currently active window. 4049For how to specify 4050.Ar style , 4051see the 4052.Sx STYLES 4053section. 4054.Pp 4055.It Ic window-status-format Ar string 4056Set the format in which the window is displayed in the status line window list. 4057See the 4058.Sx FORMATS 4059and 4060.Sx STYLES 4061sections. 4062.Pp 4063.It Ic window-status-last-style Ar style 4064Set status line style for the last active window. 4065For how to specify 4066.Ar style , 4067see the 4068.Sx STYLES 4069section. 4070.Pp 4071.It Ic window-status-separator Ar string 4072Sets the separator drawn between windows in the status line. 4073The default is a single space character. 4074.Pp 4075.It Ic window-status-style Ar style 4076Set status line style for a single window. 4077For how to specify 4078.Ar style , 4079see the 4080.Sx STYLES 4081section. 4082.Pp 4083.It Xo Ic window-size 4084.Ar largest | Ar smallest | Ar manual | Ar latest 4085.Xc 4086Configure how 4087.Nm 4088determines the window size. 4089If set to 4090.Ar largest , 4091the size of the largest attached session is used; if 4092.Ar smallest , 4093the size of the smallest. 4094If 4095.Ar manual , 4096the size of a new window is set from the 4097.Ic default-size 4098option and windows are resized automatically. 4099With 4100.Ar latest , 4101.Nm 4102uses the size of the client that had the most recent activity. 4103See also the 4104.Ic resize-window 4105command and the 4106.Ic aggressive-resize 4107option. 4108.Pp 4109.It Xo Ic wrap-search 4110.Op Ic on | off 4111.Xc 4112If this option is set, searches will wrap around the end of the pane contents. 4113The default is on. 4114.El 4115.Pp 4116Available pane options are: 4117.Pp 4118.Bl -tag -width Ds -compact 4119.It Xo Ic allow-rename 4120.Op Ic on | off 4121.Xc 4122Allow programs in the pane to change the window name using a terminal escape 4123sequence (\eek...\ee\e\e). 4124.Pp 4125.It Xo Ic alternate-screen 4126.Op Ic on | off 4127.Xc 4128This option configures whether programs running inside the pane may use the 4129terminal alternate screen feature, which allows the 4130.Em smcup 4131and 4132.Em rmcup 4133.Xr terminfo 5 4134capabilities. 4135The alternate screen feature preserves the contents of the window when an 4136interactive application starts and restores it on exit, so that any output 4137visible before the application starts reappears unchanged after it exits. 4138.Pp 4139.It Xo Ic remain-on-exit 4140.Op Ic on | off 4141.Xc 4142A pane with this flag set is not destroyed when the program running in it 4143exits. 4144The pane may be reactivated with the 4145.Ic respawn-pane 4146command. 4147.Pp 4148.It Ic window-active-style Ar style 4149Set the pane style when it is the active pane. 4150For how to specify 4151.Ar style , 4152see the 4153.Sx STYLES 4154section. 4155.Pp 4156.It Ic window-style Ar style 4157Set the pane style. 4158For how to specify 4159.Ar style , 4160see the 4161.Sx STYLES 4162section. 4163.El 4164.Sh HOOKS 4165.Nm 4166allows commands to run on various triggers, called 4167.Em hooks . 4168Most 4169.Nm 4170commands have an 4171.Em after 4172hook and there are a number of hooks not associated with commands. 4173.Pp 4174Hooks are stored as array options, members of the array are executed in 4175order when the hook is triggered. 4176Like options different hooks may be global or belong to a session, window or pane. 4177Hooks may be configured with the 4178.Ic set-hook 4179or 4180.Ic set-option 4181commands and displayed with 4182.Ic show-hooks 4183or 4184.Ic show-options 4185.Fl H . 4186The following two commands are equivalent: 4187.Bd -literal -offset indent. 4188set-hook -g pane-mode-changed[42] 'set -g status-left-style bg=red' 4189set-option -g pane-mode-changed[42] 'set -g status-left-style bg=red' 4190.Ed 4191.Pp 4192Setting a hook without specifying an array index clears the hook and sets the 4193first member of the array. 4194.Pp 4195A command's after 4196hook is run after it completes, except when the command is run as part of a hook 4197itself. 4198They are named with an 4199.Ql after- 4200prefix. 4201For example, the following command adds a hook to select the even-vertical 4202layout after every 4203.Ic split-window : 4204.Bd -literal -offset indent 4205set-hook -g after-split-window "selectl even-vertical" 4206.Ed 4207.Pp 4208All the notifications listed in the 4209.Sx CONTROL MODE 4210section are hooks (without any arguments), except 4211.Ic %exit . 4212The following additional hooks are available: 4213.Bl -tag -width "XXXXXXXXXXXXXXXXXXXXXX" 4214.It alert-activity 4215Run when a window has activity. 4216See 4217.Ic monitor-activity . 4218.It alert-bell 4219Run when a window has received a bell. 4220See 4221.Ic monitor-bell . 4222.It alert-silence 4223Run when a window has been silent. 4224See 4225.Ic monitor-silence . 4226.It client-attached 4227Run when a client is attached. 4228.It client-detached 4229Run when a client is detached 4230.It client-resized 4231Run when a client is resized. 4232.It client-session-changed 4233Run when a client's attached session is changed. 4234.It pane-died 4235Run when the program running in a pane exits, but 4236.Ic remain-on-exit 4237is on so the pane has not closed. 4238.It pane-exited 4239Run when the program running in a pane exits. 4240.It pane-focus-in 4241Run when the focus enters a pane, if the 4242.Ic focus-events 4243option is on. 4244.It pane-focus-out 4245Run when the focus exits a pane, if the 4246.Ic focus-events 4247option is on. 4248.It pane-set-clipboard 4249Run when the terminal clipboard is set using the 4250.Xr xterm 1 4251escape sequence. 4252.It session-created 4253Run when a new session created. 4254.It session-closed 4255Run when a session closed. 4256.It session-renamed 4257Run when a session is renamed. 4258.It window-linked 4259Run when a window is linked into a session. 4260.It window-renamed 4261Run when a window is renamed. 4262.It window-unlinked 4263Run when a window is unlinked from a session. 4264.El 4265.Pp 4266Hooks are managed with these commands: 4267.Bl -tag -width Ds 4268.It Xo Ic set-hook 4269.Op Fl agpRuw 4270.Op Fl t Ar target-pane 4271.Ar hook-name 4272.Ar command 4273.Xc 4274Without 4275.Fl R , 4276sets (or with 4277.Fl u 4278unsets) hook 4279.Ar hook-name 4280to 4281.Ar command . 4282The flags are the same as for 4283.Ic set-option . 4284.Pp 4285With 4286.Fl R , 4287run 4288.Ar hook-name 4289immediately. 4290.It Xo Ic show-hooks 4291.Op Fl gpw 4292.Op Fl t Ar target-pane 4293.Xc 4294Shows hooks. 4295The flags are the same as for 4296.Ic show-options . 4297.El 4298.Sh MOUSE SUPPORT 4299If the 4300.Ic mouse 4301option is on (the default is off), 4302.Nm 4303allows mouse events to be bound as keys. 4304The name of each key is made up of a mouse event (such as 4305.Ql MouseUp1 ) 4306and a location suffix, one of the following: 4307.Bl -column "XXXXXXXXXXXXX" -offset indent 4308.It Li "Pane" Ta "the contents of a pane" 4309.It Li "Border" Ta "a pane border" 4310.It Li "Status" Ta "the status line window list" 4311.It Li "StatusLeft" Ta "the left part of the status line" 4312.It Li "StatusRight" Ta "the right part of the status line" 4313.It Li "StatusDefault" Ta "any other part of the status line" 4314.El 4315.Pp 4316The following mouse events are available: 4317.Bl -column "MouseDown1" "MouseDrag1" "WheelDown" -offset indent 4318.It Li "WheelUp" Ta "WheelDown" Ta "" 4319.It Li "MouseDown1" Ta "MouseUp1" Ta "MouseDrag1" Ta "MouseDragEnd1" 4320.It Li "MouseDown2" Ta "MouseUp2" Ta "MouseDrag2" Ta "MouseDragEnd2" 4321.It Li "MouseDown3" Ta "MouseUp3" Ta "MouseDrag3" Ta "MouseDragEnd3" 4322.It Li "SecondClick1" Ta "SecondClick2" Ta "SecondClick3" 4323.It Li "DoubleClick1" Ta "DoubleClick2" Ta "DoubleClick3" 4324.It Li "TripleClick1" Ta "TripleClick2" Ta "TripleClick3" 4325.El 4326.Pp 4327The 4328.Ql SecondClick 4329events are fired for the second click of a double click, even if there may be a 4330third click which will fire 4331.Ql TripleClick 4332instead of 4333.Ql DoubleClick . 4334.Pp 4335Each should be suffixed with a location, for example 4336.Ql MouseDown1Status . 4337.Pp 4338The special token 4339.Ql {mouse} 4340or 4341.Ql = 4342may be used as 4343.Ar target-window 4344or 4345.Ar target-pane 4346in commands bound to mouse key bindings. 4347It resolves to the window or pane over which the mouse event took place 4348(for example, the window in the status line over which button 1 was released for a 4349.Ql MouseUp1Status 4350binding, or the pane over which the wheel was scrolled for a 4351.Ql WheelDownPane 4352binding). 4353.Pp 4354The 4355.Ic send-keys 4356.Fl M 4357flag may be used to forward a mouse event to a pane. 4358.Pp 4359The default key bindings allow the mouse to be used to select and resize panes, 4360to copy text and to change window using the status line. 4361These take effect if the 4362.Ic mouse 4363option is turned on. 4364.Sh FORMATS 4365Certain commands accept the 4366.Fl F 4367flag with a 4368.Ar format 4369argument. 4370This is a string which controls the output format of the command. 4371Format variables are enclosed in 4372.Ql #{ 4373and 4374.Ql } , 4375for example 4376.Ql #{session_name} . 4377The possible variables are listed in the table below, or the name of a 4378.Nm 4379option may be used for an option's value. 4380Some variables have a shorter alias such as 4381.Ql #S ; 4382.Ql ## 4383is replaced by a single 4384.Ql # , 4385.Ql #, 4386by a 4387.Ql \&, 4388and 4389.Ql #} 4390by a 4391.Ql } . 4392.Pp 4393Conditionals are available by prefixing with 4394.Ql \&? 4395and separating two alternatives with a comma; 4396if the specified variable exists and is not zero, the first alternative 4397is chosen, otherwise the second is used. 4398For example 4399.Ql #{?session_attached,attached,not attached} 4400will include the string 4401.Ql attached 4402if the session is attached and the string 4403.Ql not attached 4404if it is unattached, or 4405.Ql #{?automatic-rename,yes,no} 4406will include 4407.Ql yes 4408if 4409.Ic automatic-rename 4410is enabled, or 4411.Ql no 4412if not. 4413Conditionals can be nested arbitrarily. 4414Inside a conditional, 4415.Ql \&, 4416and 4417.Ql } 4418must be escaped as 4419.Ql #, 4420and 4421.Ql #} , 4422unless they are part of a 4423.Ql #{...} 4424replacement. 4425For example: 4426.Bd -literal -offset indent 4427#{?pane_in_mode,#[fg=white#,bg=red],#[fg=red#,bg=white]}#W . 4428.Ed 4429.Pp 4430String comparisons may be expressed by prefixing two comma-separated 4431alternatives by 4432.Ql == , 4433.Ql != , 4434.Ql < , 4435.Ql > , 4436.Ql <= 4437or 4438.Ql >= 4439and a colon. 4440For example 4441.Ql #{==:#{host},myhost} 4442will be replaced by 4443.Ql 1 4444if running on 4445.Ql myhost , 4446otherwise by 4447.Ql 0 . 4448.Ql || 4449and 4450.Ql && 4451evaluate to true if either or both of two comma-separated alternatives are 4452true, for example 4453.Ql #{||:#{pane_in_mode},#{alternate_on}} . 4454.Pp 4455An 4456.Ql m 4457specifies an 4458.Xr fnmatch 3 4459or regular expression comparison. 4460The first argument is the pattern and the second the string to compare. 4461An optional argument specifies flags: 4462.Ql r 4463means the pattern is a regular expression instead of the default 4464.Xr fnmatch 3 4465pattern, and 4466.Ql i 4467means to ignore case. 4468For example: 4469.Ql #{m:*foo*,#{host}} 4470or 4471.Ql #{m/ri:^A,MYVAR} . 4472A 4473.Ql C 4474performs a search for an 4475.Xr fnmatch 3 4476pattern or regular expression in the pane content and evaluates to zero if not 4477found, or a line number if found. 4478Like 4479.Ql m , 4480an 4481.Ql r 4482flag means search for a regular expression and 4483.Ql i 4484ignores case. 4485For example: 4486.Ql #{C/r:^Start} 4487.Pp 4488Numeric operators may be performed by prefixing two comma-separated alternatives with an 4489.Ql e 4490and an operator. 4491An optional 4492.Ql f 4493flag may be given after the operator to use floating point numbers, otherwise integers are used. 4494This may be followed by a number giving the number of decimal places to use for the result. 4495The available operators are: 4496addition 4497.Ql + , 4498subtraction 4499.Ql - , 4500multiplication 4501.Ql * , 4502division 4503.Ql / , 4504and modulus 4505.Ql m 4506or 4507.Ql % 4508(note that 4509.Ql % 4510must be escaped as 4511.Ql %% 4512in formats which are also expanded by 4513.Xr strftime 3 ) . 4514For example, 4515.Ql #{e|*|f|4:5.5,3} 4516multiplies 5.5 by 3 for a result with four decimal places and 4517.Ql #{e|%%:7,3} 4518returns the modulus of 7 and 3. 4519.Pp 4520A limit may be placed on the length of the resultant string by prefixing it 4521by an 4522.Ql = , 4523a number and a colon. 4524Positive numbers count from the start of the string and negative from the end, 4525so 4526.Ql #{=5:pane_title} 4527will include at most the first five characters of the pane title, or 4528.Ql #{=-5:pane_title} 4529the last five characters. 4530A suffix or prefix may be given as a second argument - if provided then it is 4531appended or prepended to the string if the length has been trimmed, for example 4532.Ql #{=/5/...:pane_title} 4533will append 4534.Ql ... 4535if the pane title is more than five characters. 4536Similarly, 4537.Ql p 4538pads the string to a given width, for example 4539.Ql #{p10:pane_title} 4540will result in a width of at least 10 characters. 4541A positive width pads on the left, a negative on the right. 4542.Pp 4543Prefixing a time variable with 4544.Ql t:\& 4545will convert it to a string, so if 4546.Ql #{window_activity} 4547gives 4548.Ql 1445765102 , 4549.Ql #{t:window_activity} 4550gives 4551.Ql Sun Oct 25 09:25:02 2015 . 4552Adding 4553.Ql p ( 4554.Ql `t/p` ) 4555will use shorter but less accurate time format for times in the past. 4556A custom format may be given using an 4557.Ql f 4558suffix (note that 4559.Ql % 4560must be escaped as 4561.Ql %% 4562if the format is separately being passed through 4563.Xr strftime 3 , 4564for example in the 4565.Ic status-left 4566option): 4567.Ql #{t/f/%%H#:%%M:window_activity} , 4568see 4569.Xr strftime 3 . 4570.Pp 4571The 4572.Ql b:\& 4573and 4574.Ql d:\& 4575prefixes are 4576.Xr basename 3 4577and 4578.Xr dirname 3 4579of the variable respectively. 4580.Ql q:\& 4581will escape 4582.Xr sh 1 4583special characters. 4584.Ql E:\& 4585will expand the format twice, for example 4586.Ql #{E:status-left} 4587is the result of expanding the content of the 4588.Ic status-left 4589option rather than the option itself. 4590.Ql T:\& 4591is like 4592.Ql E:\& 4593but also expands 4594.Xr strftime 3 4595specifiers. 4596.Ql S:\& , 4597.Ql W:\& 4598or 4599.Ql P:\& 4600will loop over each session, window or pane and insert the format once 4601for each. 4602For windows and panes, two comma-separated formats may be given: 4603the second is used for the current window or active pane. 4604For example, to get a list of windows formatted like the status line: 4605.Bd -literal -offset indent 4606#{W:#{E:window-status-format} ,#{E:window-status-current-format} } 4607.Ed 4608.Pp 4609A prefix of the form 4610.Ql s/foo/bar/:\& 4611will substitute 4612.Ql foo 4613with 4614.Ql bar 4615throughout. 4616The first argument may be an extended regular expression and a final argument may be 4617.Ql i 4618to ignore case, for example 4619.Ql s/a(.)/\e1x/i:\& 4620would change 4621.Ql abABab 4622into 4623.Ql bxBxbx . 4624.Pp 4625In addition, the last line of a shell command's output may be inserted using 4626.Ql #() . 4627For example, 4628.Ql #(uptime) 4629will insert the system's uptime. 4630When constructing formats, 4631.Nm 4632does not wait for 4633.Ql #() 4634commands to finish; instead, the previous result from running the same command is used, 4635or a placeholder if the command has not been run before. 4636If the command hasn't exited, the most recent line of output will be used, but the status 4637line will not be updated more than once a second. 4638Commands are executed with the 4639.Nm 4640global environment set (see the 4641.Sx GLOBAL AND SESSION ENVIRONMENT 4642section). 4643.Pp 4644An 4645.Ql l 4646specifies that a string should be interpreted literally and not expanded. 4647For example 4648.Ql #{l:#{?pane_in_mode,yes,no}} 4649will be replaced by 4650.Ql #{?pane_in_mode,yes,no} . 4651.Pp 4652The following variables are available, where appropriate: 4653.Bl -column "XXXXXXXXXXXXXXXXXXX" "XXXXX" 4654.It Sy "Variable name" Ta Sy "Alias" Ta Sy "Replaced with" 4655.It Li "alternate_on" Ta "" Ta "1 if pane is in alternate screen" 4656.It Li "alternate_saved_x" Ta "" Ta "Saved cursor X in alternate screen" 4657.It Li "alternate_saved_y" Ta "" Ta "Saved cursor Y in alternate screen" 4658.It Li "buffer_created" Ta "" Ta "Time buffer created" 4659.It Li "buffer_name" Ta "" Ta "Name of buffer" 4660.It Li "buffer_sample" Ta "" Ta "Sample of start of buffer" 4661.It Li "buffer_size" Ta "" Ta "Size of the specified buffer in bytes" 4662.It Li "client_activity" Ta "" Ta "Time client last had activity" 4663.It Li "client_cell_height" Ta "" Ta "Height of each client cell in pixels" 4664.It Li "client_cell_width" Ta "" Ta "Width of each client cell in pixels" 4665.It Li "client_control_mode" Ta "" Ta "1 if client is in control mode" 4666.It Li "client_created" Ta "" Ta "Time client created" 4667.It Li "client_discarded" Ta "" Ta "Bytes discarded when client behind" 4668.It Li "client_flags" Ta "" Ta "List of client flags" 4669.It Li "client_height" Ta "" Ta "Height of client" 4670.It Li "client_key_table" Ta "" Ta "Current key table" 4671.It Li "client_last_session" Ta "" Ta "Name of the client's last session" 4672.It Li "client_name" Ta "" Ta "Name of client" 4673.It Li "client_pid" Ta "" Ta "PID of client process" 4674.It Li "client_prefix" Ta "" Ta "1 if prefix key has been pressed" 4675.It Li "client_readonly" Ta "" Ta "1 if client is readonly" 4676.It Li "client_session" Ta "" Ta "Name of the client's session" 4677.It Li "client_termname" Ta "" Ta "Terminal name of client" 4678.It Li "client_termtype" Ta "" Ta "Terminal type of client, if available" 4679.It Li "client_termfeatures" Ta "" Ta "Terminal features of client, if any" 4680.It Li "client_tty" Ta "" Ta "Pseudo terminal of client" 4681.It Li "client_utf8" Ta "" Ta "1 if client supports UTF-8" 4682.It Li "client_width" Ta "" Ta "Width of client" 4683.It Li "client_written" Ta "" Ta "Bytes written to client" 4684.It Li "command" Ta "" Ta "Name of command in use, if any" 4685.It Li "command_list_alias" Ta "" Ta "Command alias if listing commands" 4686.It Li "command_list_name" Ta "" Ta "Command name if listing commands" 4687.It Li "command_list_usage" Ta "" Ta "Command usage if listing commands" 4688.It Li "copy_cursor_line" Ta "" Ta "Line the cursor is on in copy mode" 4689.It Li "copy_cursor_word" Ta "" Ta "Word under cursor in copy mode" 4690.It Li "copy_cursor_x" Ta "" Ta "Cursor X position in copy mode" 4691.It Li "copy_cursor_y" Ta "" Ta "Cursor Y position in copy mode" 4692.It Li "cursor_character" Ta "" Ta "Character at cursor in pane" 4693.It Li "cursor_flag" Ta "" Ta "Pane cursor flag" 4694.It Li "cursor_x" Ta "" Ta "Cursor X position in pane" 4695.It Li "cursor_y" Ta "" Ta "Cursor Y position in pane" 4696.It Li "history_bytes" Ta "" Ta "Number of bytes in window history" 4697.It Li "history_limit" Ta "" Ta "Maximum window history lines" 4698.It Li "history_size" Ta "" Ta "Size of history in lines" 4699.It Li "hook" Ta "" Ta "Name of running hook, if any" 4700.It Li "hook_pane" Ta "" Ta "ID of pane where hook was run, if any" 4701.It Li "hook_session" Ta "" Ta "ID of session where hook was run, if any" 4702.It Li "hook_session_name" Ta "" Ta "Name of session where hook was run, if any" 4703.It Li "hook_window" Ta "" Ta "ID of window where hook was run, if any" 4704.It Li "hook_window_name" Ta "" Ta "Name of window where hook was run, if any" 4705.It Li "host" Ta "#H" Ta "Hostname of local host" 4706.It Li "host_short" Ta "#h" Ta "Hostname of local host (no domain name)" 4707.It Li "insert_flag" Ta "" Ta "Pane insert flag" 4708.It Li "keypad_cursor_flag" Ta "" Ta "Pane keypad cursor flag" 4709.It Li "keypad_flag" Ta "" Ta "Pane keypad flag" 4710.It Li "line" Ta "" Ta "Line number in the list" 4711.It Li "mouse_all_flag" Ta "" Ta "Pane mouse all flag" 4712.It Li "mouse_any_flag" Ta "" Ta "Pane mouse any flag" 4713.It Li "mouse_button_flag" Ta "" Ta "Pane mouse button flag" 4714.It Li "mouse_line" Ta "" Ta "Line under mouse, if any" 4715.It Li "mouse_sgr_flag" Ta "" Ta "Pane mouse SGR flag" 4716.It Li "mouse_standard_flag" Ta "" Ta "Pane mouse standard flag" 4717.It Li "mouse_utf8_flag" Ta "" Ta "Pane mouse UTF-8 flag" 4718.It Li "mouse_word" Ta "" Ta "Word under mouse, if any" 4719.It Li "mouse_x" Ta "" Ta "Mouse X position, if any" 4720.It Li "mouse_y" Ta "" Ta "Mouse Y position, if any" 4721.It Li "origin_flag" Ta "" Ta "Pane origin flag" 4722.It Li "pane_active" Ta "" Ta "1 if active pane" 4723.It Li "pane_at_bottom" Ta "" Ta "1 if pane is at the bottom of window" 4724.It Li "pane_at_left" Ta "" Ta "1 if pane is at the left of window" 4725.It Li "pane_at_right" Ta "" Ta "1 if pane is at the right of window" 4726.It Li "pane_at_top" Ta "" Ta "1 if pane is at the top of window" 4727.It Li "pane_bottom" Ta "" Ta "Bottom of pane" 4728.It Li "pane_current_command" Ta "" Ta "Current command if available" 4729.It Li "pane_current_path" Ta "" Ta "Current path if available" 4730.It Li "pane_dead" Ta "" Ta "1 if pane is dead" 4731.It Li "pane_dead_status" Ta "" Ta "Exit status of process in dead pane" 4732.It Li "pane_format" Ta "" Ta "1 if format is for a pane" 4733.It Li "pane_height" Ta "" Ta "Height of pane" 4734.It Li "pane_id" Ta "#D" Ta "Unique pane ID" 4735.It Li "pane_in_mode" Ta "" Ta "1 if pane is in a mode" 4736.It Li "pane_index" Ta "#P" Ta "Index of pane" 4737.It Li "pane_input_off" Ta "" Ta "1 if input to pane is disabled" 4738.It Li "pane_left" Ta "" Ta "Left of pane" 4739.It Li "pane_marked" Ta "" Ta "1 if this is the marked pane" 4740.It Li "pane_marked_set" Ta "" Ta "1 if a marked pane is set" 4741.It Li "pane_mode" Ta "" Ta "Name of pane mode, if any" 4742.It Li "pane_path" Ta "" Ta "Path of pane (can be set by application)" 4743.It Li "pane_pid" Ta "" Ta "PID of first process in pane" 4744.It Li "pane_pipe" Ta "" Ta "1 if pane is being piped" 4745.It Li "pane_right" Ta "" Ta "Right of pane" 4746.It Li "pane_search_string" Ta "" Ta "Last search string in copy mode" 4747.It Li "pane_skipped" Ta "" Ta "Bytes skipped as not visible in pane" 4748.It Li "pane_start_command" Ta "" Ta "Command pane started with" 4749.It Li "pane_synchronized" Ta "" Ta "1 if pane is synchronized" 4750.It Li "pane_tabs" Ta "" Ta "Pane tab positions" 4751.It Li "pane_title" Ta "#T" Ta "Title of pane (can be set by application)" 4752.It Li "pane_top" Ta "" Ta "Top of pane" 4753.It Li "pane_tty" Ta "" Ta "Pseudo terminal of pane" 4754.It Li "pane_width" Ta "" Ta "Width of pane" 4755.It Li "pane_written" Ta "" Ta "Bytes written by pane (aside from redrawing)" 4756.It Li "pid" Ta "" Ta "Server PID" 4757.It Li "popup_key" Ta "" Ta "Key pressed in popup" 4758.It Li "popup_mouse_x" Ta "" Ta "Mouse X position in popup" 4759.It Li "popup_mouse_y" Ta "" Ta "Mouse Y position in popup" 4760.It Li "rectangle_toggle" Ta "" Ta "1 if rectangle selection is activated" 4761.It Li "scroll_position" Ta "" Ta "Scroll position in copy mode" 4762.It Li "scroll_region_lower" Ta "" Ta "Bottom of scroll region in pane" 4763.It Li "scroll_region_upper" Ta "" Ta "Top of scroll region in pane" 4764.It Li "search_present" Ta "" Ta "1 if search started in copy mode" 4765.It Li "search_match" Ta "" Ta "Search match if any" 4766.It Li "selection_active" Ta "" Ta "1 if selection started and changes with the cursor in copy mode" 4767.It Li "selection_end_x" Ta "" Ta "X position of the end of the selection" 4768.It Li "selection_end_y" Ta "" Ta "Y position of the end of the selection" 4769.It Li "selection_present" Ta "" Ta "1 if selection started in copy mode" 4770.It Li "selection_start_x" Ta "" Ta "X position of the start of the selection" 4771.It Li "selection_start_y" Ta "" Ta "Y position of the start of the selection" 4772.It Li "session_activity" Ta "" Ta "Time of session last activity" 4773.It Li "session_alerts" Ta "" Ta "List of window indexes with alerts" 4774.It Li "session_attached" Ta "" Ta "Number of clients session is attached to" 4775.It Li "session_attached_list" Ta "" Ta "List of clients session is attached to" 4776.It Li "session_created" Ta "" Ta "Time session created" 4777.It Li "session_format" Ta "" Ta "1 if format is for a session" 4778.It Li "session_group" Ta "" Ta "Name of session group" 4779.It Li "session_group_attached" Ta "" Ta "Number of clients sessions in group are attached to" 4780.It Li "session_group_attached_list" Ta "" Ta "List of clients sessions in group are attached to" 4781.It Li "session_group_list" Ta "" Ta "List of sessions in group" 4782.It Li "session_group_many_attached" Ta "" Ta "1 if multiple clients attached to sessions in group" 4783.It Li "session_group_size" Ta "" Ta "Size of session group" 4784.It Li "session_grouped" Ta "" Ta "1 if session in a group" 4785.It Li "session_id" Ta "" Ta "Unique session ID" 4786.It Li "session_last_attached" Ta "" Ta "Time session last attached" 4787.It Li "session_many_attached" Ta "" Ta "1 if multiple clients attached" 4788.It Li "session_marked" Ta "" Ta "1 if this session contains the marked pane" 4789.It Li "session_name" Ta "#S" Ta "Name of session" 4790.It Li "session_path" Ta "" Ta "Working directory of session" 4791.It Li "session_stack" Ta "" Ta "Window indexes in most recent order" 4792.It Li "session_windows" Ta "" Ta "Number of windows in session" 4793.It Li "socket_path" Ta "" Ta "Server socket path" 4794.It Li "start_time" Ta "" Ta "Server start time" 4795.It Li "version" Ta "" Ta "Server version" 4796.It Li "window_active" Ta "" Ta "1 if window active" 4797.It Li "window_active_clients" Ta "" Ta "Number of clients viewing this window" 4798.It Li "window_active_clients_list" Ta "" Ta "List of clients viewing this window" 4799.It Li "window_active_sessions" Ta "" Ta "Number of sessions on which this window is active" 4800.It Li "window_active_sessions_list" Ta "" Ta "List of sessions on which this window is active" 4801.It Li "window_activity" Ta "" Ta "Time of window last activity" 4802.It Li "window_activity_flag" Ta "" Ta "1 if window has activity" 4803.It Li "window_bell_flag" Ta "" Ta "1 if window has bell" 4804.It Li "window_bigger" Ta "" Ta "1 if window is larger than client" 4805.It Li "window_cell_height" Ta "" Ta "Height of each cell in pixels" 4806.It Li "window_cell_width" Ta "" Ta "Width of each cell in pixels" 4807.It Li "window_end_flag" Ta "" Ta "1 if window has the highest index" 4808.It Li "window_flags" Ta "#F" Ta "Window flags" 4809.It Li "window_format" Ta "" Ta "1 if format is for a window" 4810.It Li "window_height" Ta "" Ta "Height of window" 4811.It Li "window_id" Ta "" Ta "Unique window ID" 4812.It Li "window_index" Ta "#I" Ta "Index of window" 4813.It Li "window_last_flag" Ta "" Ta "1 if window is the last used" 4814.It Li "window_layout" Ta "" Ta "Window layout description, ignoring zoomed window panes" 4815.It Li "window_linked" Ta "" Ta "1 if window is linked across sessions" 4816.It Li "window_linked_sessions" Ta "" Ta "Number of sessions this window is linked to" 4817.It Li "window_linked_sessions_list" Ta "" Ta "List of sessions this window is linked to" 4818.It Li "window_marked_flag" Ta "" Ta "1 if window contains the marked pane" 4819.It Li "window_name" Ta "#W" Ta "Name of window" 4820.It Li "window_offset_x" Ta "" Ta "X offset into window if larger than client" 4821.It Li "window_offset_y" Ta "" Ta "Y offset into window if larger than client" 4822.It Li "window_panes" Ta "" Ta "Number of panes in window" 4823.It Li "window_silence_flag" Ta "" Ta "1 if window has silence alert" 4824.It Li "window_stack_index" Ta "" Ta "Index in session most recent stack" 4825.It Li "window_start_flag" Ta "" Ta "1 if window has the lowest index" 4826.It Li "window_visible_layout" Ta "" Ta "Window layout description, respecting zoomed window panes" 4827.It Li "window_width" Ta "" Ta "Width of window" 4828.It Li "window_zoomed_flag" Ta "" Ta "1 if window is zoomed" 4829.It Li "wrap_flag" Ta "" Ta "Pane wrap flag" 4830.El 4831.Sh STYLES 4832.Nm 4833offers various options to specify the colour and attributes of aspects of the 4834interface, for example 4835.Ic status-style 4836for the status line. 4837In addition, embedded styles may be specified in format options, such as 4838.Ic status-left , 4839by enclosing them in 4840.Ql #[ 4841and 4842.Ql \&] . 4843.Pp 4844A style may be the single term 4845.Ql default 4846to specify the default style (which may come from an option, for example 4847.Ic status-style 4848in the status line) or a space 4849or comma separated list of the following: 4850.Bl -tag -width Ds 4851.It Ic fg=colour 4852Set the foreground colour. 4853The colour is one of: 4854.Ic black , 4855.Ic red , 4856.Ic green , 4857.Ic yellow , 4858.Ic blue , 4859.Ic magenta , 4860.Ic cyan , 4861.Ic white ; 4862if supported the bright variants 4863.Ic brightred , 4864.Ic brightgreen , 4865.Ic brightyellow ; 4866.Ic colour0 4867to 4868.Ic colour255 4869from the 256-colour set; 4870.Ic default 4871for the default colour; 4872.Ic terminal 4873for the terminal default colour; or a hexadecimal RGB string such as 4874.Ql #ffffff . 4875.It Ic bg=colour 4876Set the background colour. 4877.It Ic none 4878Set no attributes (turn off any active attributes). 4879.It Xo Ic acs , 4880.Ic bright 4881(or 4882.Ic bold ) , 4883.Ic dim , 4884.Ic underscore , 4885.Ic blink , 4886.Ic reverse , 4887.Ic hidden , 4888.Ic italics , 4889.Ic overline , 4890.Ic strikethrough , 4891.Ic double-underscore , 4892.Ic curly-underscore , 4893.Ic dotted-underscore , 4894.Ic dashed-underscore 4895.Xc 4896Set an attribute. 4897Any of the attributes may be prefixed with 4898.Ql no 4899to unset. 4900.Ic acs 4901is the terminal alternate character set. 4902.It Xo Ic align=left 4903(or 4904.Ic noalign ) , 4905.Ic align=centre , 4906.Ic align=right 4907.Xc 4908Align text to the left, centre or right of the available space if appropriate. 4909.It Ic fill=colour 4910Fill the available space with a background colour if appropriate. 4911.It Xo Ic list=on , 4912.Ic list=focus , 4913.Ic list=left-marker , 4914.Ic list=right-marker , 4915.Ic nolist 4916.Xc 4917Mark the position of the various window list components in the 4918.Ic status-format 4919option: 4920.Ic list=on 4921marks the start of the list; 4922.Ic list=focus 4923is the part of the list that should be kept in focus if the entire list won't fit 4924in the available space (typically the current window); 4925.Ic list=left-marker 4926and 4927.Ic list=right-marker 4928mark the text to be used to mark that text has been trimmed from the left or 4929right of the list if there is not enough space. 4930.It Xo Ic push-default , 4931.Ic pop-default 4932.Xc 4933Store the current colours and attributes as the default or reset to the previous 4934default. 4935A 4936.Ic push-default 4937affects any subsequent use of the 4938.Ic default 4939term until a 4940.Ic pop-default . 4941Only one default may be pushed (each 4942.Ic push-default 4943replaces the previous saved default). 4944.It Xo Ic range=left , 4945.Ic range=right , 4946.Ic range=window|X , 4947.Ic norange 4948.Xc 4949Mark a range in the 4950.Ic status-format 4951option. 4952.Ic range=left 4953and 4954.Ic range=right 4955are the text used for the 4956.Ql StatusLeft 4957and 4958.Ql StatusRight 4959mouse keys. 4960.Ic range=window|X 4961is the range for a window passed to the 4962.Ql Status 4963mouse key, where 4964.Ql X 4965is a window index. 4966.El 4967.Pp 4968Examples are: 4969.Bd -literal -offset indent 4970fg=yellow bold underscore blink 4971bg=black,fg=default,noreverse 4972.Ed 4973.Sh NAMES AND TITLES 4974.Nm 4975distinguishes between names and titles. 4976Windows and sessions have names, which may be used to specify them in targets 4977and are displayed in the status line and various lists: the name is the 4978.Nm 4979identifier for a window or session. 4980Only panes have titles. 4981A pane's title is typically set by the program running inside the pane using 4982an escape sequence (like it would set the 4983.Xr xterm 1 4984window title in 4985.Xr X 7 ) . 4986Windows themselves do not have titles - a window's title is the title of its 4987active pane. 4988.Nm 4989itself may set the title of the terminal in which the client is running, see 4990the 4991.Ic set-titles 4992option. 4993.Pp 4994A session's name is set with the 4995.Ic new-session 4996and 4997.Ic rename-session 4998commands. 4999A window's name is set with one of: 5000.Bl -enum -width Ds 5001.It 5002A command argument (such as 5003.Fl n 5004for 5005.Ic new-window 5006or 5007.Ic new-session ) . 5008.It 5009An escape sequence (if the 5010.Ic allow-rename 5011option is turned on): 5012.Bd -literal -offset indent 5013$ printf '\e033kWINDOW_NAME\e033\e\e' 5014.Ed 5015.It 5016Automatic renaming, which sets the name to the active command in the window's 5017active pane. 5018See the 5019.Ic automatic-rename 5020option. 5021.El 5022.Pp 5023When a pane is first created, its title is the hostname. 5024A pane's title can be set via the title setting escape sequence, for example: 5025.Bd -literal -offset indent 5026$ printf '\e033]2;My Title\e033\e\e' 5027.Ed 5028.Pp 5029It can also be modified with the 5030.Ic select-pane 5031.Fl T 5032command. 5033.Sh GLOBAL AND SESSION ENVIRONMENT 5034When the server is started, 5035.Nm 5036copies the environment into the 5037.Em global environment ; 5038in addition, each session has a 5039.Em session environment . 5040When a window is created, the session and global environments are merged. 5041If a variable exists in both, the value from the session environment is used. 5042The result is the initial environment passed to the new process. 5043.Pp 5044The 5045.Ic update-environment 5046session option may be used to update the session environment from the client 5047when a new session is created or an old reattached. 5048.Nm 5049also initialises the 5050.Ev TMUX 5051variable with some internal information to allow commands to be executed 5052from inside, and the 5053.Ev TERM 5054variable with the correct terminal setting of 5055.Ql screen . 5056.Pp 5057Variables in both session and global environments may be marked as hidden. 5058Hidden variables are not passed into the environment of new processes and 5059instead can only be used by tmux itself (for example in formats, see the 5060.Sx FORMATS 5061section). 5062.Pp 5063Commands to alter and view the environment are: 5064.Bl -tag -width Ds 5065.It Xo Ic set-environment 5066.Op Fl hgru 5067.Op Fl t Ar target-session 5068.Ar name Op Ar value 5069.Xc 5070.D1 (alias: Ic setenv ) 5071Set or unset an environment variable. 5072If 5073.Fl g 5074is used, the change is made in the global environment; otherwise, it is applied 5075to the session environment for 5076.Ar target-session . 5077The 5078.Fl u 5079flag unsets a variable. 5080.Fl r 5081indicates the variable is to be removed from the environment before starting a 5082new process. 5083.Fl h 5084marks the variable as hidden. 5085.It Xo Ic show-environment 5086.Op Fl hgs 5087.Op Fl t Ar target-session 5088.Op Ar variable 5089.Xc 5090.D1 (alias: Ic showenv ) 5091Display the environment for 5092.Ar target-session 5093or the global environment with 5094.Fl g . 5095If 5096.Ar variable 5097is omitted, all variables are shown. 5098Variables removed from the environment are prefixed with 5099.Ql - . 5100If 5101.Fl s 5102is used, the output is formatted as a set of Bourne shell commands. 5103.Fl h 5104shows hidden variables (omitted by default). 5105.El 5106.Sh STATUS LINE 5107.Nm 5108includes an optional status line which is displayed in the bottom line of each 5109terminal. 5110.Pp 5111By default, the status line is enabled and one line in height (it may be 5112disabled or made multiple lines with the 5113.Ic status 5114session option) and contains, from left-to-right: the name of the current 5115session in square brackets; the window list; the title of the active pane 5116in double quotes; and the time and date. 5117.Pp 5118Each line of the status line is configured with the 5119.Ic status-format 5120option. 5121The default is made of three parts: configurable left and right sections (which 5122may contain dynamic content such as the time or output from a shell command, 5123see the 5124.Ic status-left , 5125.Ic status-left-length , 5126.Ic status-right , 5127and 5128.Ic status-right-length 5129options below), and a central window list. 5130By default, the window list shows the index, name and (if any) flag of the 5131windows present in the current session in ascending numerical order. 5132It may be customised with the 5133.Ar window-status-format 5134and 5135.Ar window-status-current-format 5136options. 5137The flag is one of the following symbols appended to the window name: 5138.Bl -column "Symbol" "Meaning" -offset indent 5139.It Sy "Symbol" Ta Sy "Meaning" 5140.It Li "*" Ta "Denotes the current window." 5141.It Li "-" Ta "Marks the last window (previously selected)." 5142.It Li "#" Ta "Window activity is monitored and activity has been detected." 5143.It Li "\&!" Ta "Window bells are monitored and a bell has occurred in the window." 5144.It Li "~" Ta "The window has been silent for the monitor-silence interval." 5145.It Li "M" Ta "The window contains the marked pane." 5146.It Li "Z" Ta "The window's active pane is zoomed." 5147.El 5148.Pp 5149The # symbol relates to the 5150.Ic monitor-activity 5151window option. 5152The window name is printed in inverted colours if an alert (bell, activity or 5153silence) is present. 5154.Pp 5155The colour and attributes of the status line may be configured, the entire 5156status line using the 5157.Ic status-style 5158session option and individual windows using the 5159.Ic window-status-style 5160window option. 5161.Pp 5162The status line is automatically refreshed at interval if it has changed, the 5163interval may be controlled with the 5164.Ic status-interval 5165session option. 5166.Pp 5167Commands related to the status line are as follows: 5168.Bl -tag -width Ds 5169.It Xo Ic command-prompt 5170.Op Fl 1ikNTW 5171.Op Fl I Ar inputs 5172.Op Fl p Ar prompts 5173.Op Fl t Ar target-client 5174.Op Ar template 5175.Xc 5176Open the command prompt in a client. 5177This may be used from inside 5178.Nm 5179to execute commands interactively. 5180.Pp 5181If 5182.Ar template 5183is specified, it is used as the command. 5184If present, 5185.Fl I 5186is a comma-separated list of the initial text for each prompt. 5187If 5188.Fl p 5189is given, 5190.Ar prompts 5191is a comma-separated list of prompts which are displayed in order; otherwise 5192a single prompt is displayed, constructed from 5193.Ar template 5194if it is present, or 5195.Ql \&: 5196if not. 5197.Pp 5198Before the command is executed, the first occurrence of the string 5199.Ql %% 5200and all occurrences of 5201.Ql %1 5202are replaced by the response to the first prompt, all 5203.Ql %2 5204are replaced with the response to the second prompt, and so on for further 5205prompts. 5206Up to nine prompt responses may be replaced 5207.Po 5208.Ql %1 5209to 5210.Ql %9 5211.Pc . 5212.Ql %%% 5213is like 5214.Ql %% 5215but any quotation marks are escaped. 5216.Pp 5217.Fl 1 5218makes the prompt only accept one key press, in this case the resulting input 5219is a single character. 5220.Fl k 5221is like 5222.Fl 1 5223but the key press is translated to a key name. 5224.Fl N 5225makes the prompt only accept numeric key presses. 5226.Fl i 5227executes the command every time the prompt input changes instead of when the 5228user exits the command prompt. 5229.Fl T 5230tells 5231.Nm 5232that the prompt is for a target which affects what completions are offered when 5233.Em Tab 5234is pressed; 5235.Fl W 5236is similar but indicates the prompt is for a window. 5237.Pp 5238The following keys have a special meaning in the command prompt, depending 5239on the value of the 5240.Ic status-keys 5241option: 5242.Bl -column "FunctionXXXXXXXXXXXXXXXXXXXXXXXXX" "viXXXX" "emacsX" -offset indent 5243.It Sy "Function" Ta Sy "vi" Ta Sy "emacs" 5244.It Li "Cancel command prompt" Ta "q" Ta "Escape" 5245.It Li "Delete from cursor to start of word" Ta "" Ta "C-w" 5246.It Li "Delete entire command" Ta "d" Ta "C-u" 5247.It Li "Delete from cursor to end" Ta "D" Ta "C-k" 5248.It Li "Execute command" Ta "Enter" Ta "Enter" 5249.It Li "Get next command from history" Ta "" Ta "Down" 5250.It Li "Get previous command from history" Ta "" Ta "Up" 5251.It Li "Insert top paste buffer" Ta "p" Ta "C-y" 5252.It Li "Look for completions" Ta "Tab" Ta "Tab" 5253.It Li "Move cursor left" Ta "h" Ta "Left" 5254.It Li "Move cursor right" Ta "l" Ta "Right" 5255.It Li "Move cursor to end" Ta "$" Ta "C-e" 5256.It Li "Move cursor to next word" Ta "w" Ta "M-f" 5257.It Li "Move cursor to previous word" Ta "b" Ta "M-b" 5258.It Li "Move cursor to start" Ta "0" Ta "C-a" 5259.It Li "Transpose characters" Ta "" Ta "C-t" 5260.El 5261.It Xo Ic confirm-before 5262.Op Fl p Ar prompt 5263.Op Fl t Ar target-client 5264.Ar command 5265.Xc 5266.D1 (alias: Ic confirm ) 5267Ask for confirmation before executing 5268.Ar command . 5269If 5270.Fl p 5271is given, 5272.Ar prompt 5273is the prompt to display; otherwise a prompt is constructed from 5274.Ar command . 5275It may contain the special character sequences supported by the 5276.Ic status-left 5277option. 5278.Pp 5279This command works only from inside 5280.Nm . 5281.It Xo Ic display-menu 5282.Op Fl c Ar target-client 5283.Op Fl t Ar target-pane 5284.Op Fl T Ar title 5285.Op Fl x Ar position 5286.Op Fl y Ar position 5287.Ar name 5288.Ar key 5289.Ar command 5290.Ar ... 5291.Xc 5292.D1 (alias: Ic menu ) 5293Display a menu on 5294.Ar target-client . 5295.Ar target-pane 5296gives the target for any commands run from the menu. 5297.Pp 5298A menu is passed as a series of arguments: first the menu item name, 5299second the key shortcut (or empty for none) and third the command 5300to run when the menu item is chosen. 5301The name and command are formats, see the 5302.Sx FORMATS 5303and 5304.Sx STYLES 5305sections. 5306If the name begins with a hyphen (-), then the item is disabled (shown dim) and 5307may not be chosen. 5308The name may be empty for a separator line, in which case both the key and 5309command should be omitted. 5310.Pp 5311.Fl T 5312is a format for the menu title (see 5313.Sx FORMATS ) . 5314.Pp 5315.Fl x 5316and 5317.Fl y 5318give the position of the menu. 5319Both may be a row or column number, or one of the following special values: 5320.Bl -column "XXXXX" "XXXX" -offset indent 5321.It Sy "Value" Ta Sy "Flag" Ta Sy "Meaning" 5322.It Li "C" Ta "Both" Ta "The centre of the terminal" 5323.It Li "R" Ta Fl x Ta "The right side of the terminal" 5324.It Li "P" Ta "Both" Ta "The bottom left of the pane" 5325.It Li "M" Ta "Both" Ta "The mouse position" 5326.It Li "W" Ta "Both" Ta "The window position on the status line" 5327.It Li "S" Ta Fl y Ta "The line above or below the status line" 5328.El 5329.Pp 5330Each menu consists of items followed by a key shortcut shown in brackets. 5331If the menu is too large to fit on the terminal, it is not displayed. 5332Pressing the key shortcut chooses the corresponding item. 5333If the mouse is enabled and the menu is opened from a mouse key binding, releasing 5334the mouse button with an item selected will choose that item. 5335The following keys are also available: 5336.Bl -column "Key" "Function" -offset indent 5337.It Sy "Key" Ta Sy "Function" 5338.It Li "Enter" Ta "Choose selected item" 5339.It Li "Up" Ta "Select previous item" 5340.It Li "Down" Ta "Select next item" 5341.It Li "q" Ta "Exit menu" 5342.El 5343.It Xo Ic display-message 5344.Op Fl aIpv 5345.Op Fl c Ar target-client 5346.Op Fl t Ar target-pane 5347.Op Ar message 5348.Xc 5349.D1 (alias: Ic display ) 5350Display a message. 5351If 5352.Fl p 5353is given, the output is printed to stdout, otherwise it is displayed in the 5354.Ar target-client 5355status line. 5356The format of 5357.Ar message 5358is described in the 5359.Sx FORMATS 5360section; information is taken from 5361.Ar target-pane 5362if 5363.Fl t 5364is given, otherwise the active pane. 5365.Pp 5366.Fl v 5367prints verbose logging as the format is parsed and 5368.Fl a 5369lists the format variables and their values. 5370.Pp 5371.Fl I 5372forwards any input read from stdin to the empty pane given by 5373.Ar target-pane . 5374.It Xo Ic display-popup 5375.Op Fl CEK 5376.Op Fl c Ar target-client 5377.Op Fl d Ar start-directory 5378.Op Fl h Ar height 5379.Op Fl R Ar shell-command 5380.Op Fl t Ar target-pane 5381.Op Fl w Ar width 5382.Op Fl x Ar position 5383.Op Fl y Ar position 5384.Op Ar command Ar line Ar ... 5385.Xc 5386.D1 (alias: Ic popup ) 5387Display a popup on 5388.Ar target-client . 5389A popup is a rectangular box drawn over the top of any panes. 5390Panes are not updated while a popup is present. 5391The popup content may be given in two ways: 5392.Bl -enum -offset Ds 5393.It 5394A set of lines as arguments. 5395Each line is a format which is expanded using 5396.Ar target-pane 5397as the target. 5398If a line contains newlines it is split into multiple lines. 5399Lines may use styles, see the 5400.Sx STYLES 5401section. 5402.It 5403A shell command given by 5404.Fl R 5405which is run and any output shown in the pane. 5406.El 5407.Pp 5408The first argument, 5409.Ar command , 5410is a 5411.Nm 5412command which is run when a key is pressed. 5413The key is available in the 5414.Ql popup_key 5415format. 5416After 5417.Ar command 5418is run, the popup is closed. 5419It may be empty to discard any key presses. 5420If 5421.Fl K 5422is given together with 5423.Fl R , 5424key presses are instead passed to the 5425.Fl R 5426shell command. 5427.Fl E 5428closes the popup automatically when 5429.Ar shell-command 5430exits. 5431Two 5432.Fl E 5433closes the popup only if 5434.Ar shell-command 5435exited with success. 5436With 5437.Fl K , 5438.Ql Escape 5439and 5440.Ql C-c 5441close the popup unless 5442.Fl E 5443is also given. 5444.Pp 5445.Fl x 5446and 5447.Fl y 5448give the position of the popup, they have the same meaning as for the 5449.Ic display-menu 5450command. 5451.Fl w 5452and 5453.Fl h 5454give the width and height - both may be a percentage (followed by 5455.Ql % ) . 5456If omitted, without 5457.Fl R 5458they are calculated from the given lines and with 5459.Fl R 5460they use half the terminal size. 5461.Pp 5462The 5463.Fl C 5464flag closes any popup on the client. 5465.El 5466.Sh BUFFERS 5467.Nm 5468maintains a set of named 5469.Em paste buffers . 5470Each buffer may be either explicitly or automatically named. 5471Explicitly named buffers are named when created with the 5472.Ic set-buffer 5473or 5474.Ic load-buffer 5475commands, or by renaming an automatically named buffer with 5476.Ic set-buffer 5477.Fl n . 5478Automatically named buffers are given a name such as 5479.Ql buffer0001 , 5480.Ql buffer0002 5481and so on. 5482When the 5483.Ic buffer-limit 5484option is reached, the oldest automatically named buffer is deleted. 5485Explicitly named buffers are not subject to 5486.Ic buffer-limit 5487and may be deleted with the 5488.Ic delete-buffer 5489command. 5490.Pp 5491Buffers may be added using 5492.Ic copy-mode 5493or the 5494.Ic set-buffer 5495and 5496.Ic load-buffer 5497commands, and pasted into a window using the 5498.Ic paste-buffer 5499command. 5500If a buffer command is used and no buffer is specified, the most 5501recently added automatically named buffer is assumed. 5502.Pp 5503A configurable history buffer is also maintained for each window. 5504By default, up to 2000 lines are kept; this can be altered with the 5505.Ic history-limit 5506option (see the 5507.Ic set-option 5508command above). 5509.Pp 5510The buffer commands are as follows: 5511.Bl -tag -width Ds 5512.It Xo 5513.Ic choose-buffer 5514.Op Fl NZr 5515.Op Fl F Ar format 5516.Op Fl f Ar filter 5517.Op Fl O Ar sort-order 5518.Op Fl t Ar target-pane 5519.Op Ar template 5520.Xc 5521Put a pane into buffer mode, where a buffer may be chosen interactively from 5522a list. 5523.Fl Z 5524zooms the pane. 5525The following keys may be used in buffer mode: 5526.Bl -column "Key" "Function" -offset indent 5527.It Sy "Key" Ta Sy "Function" 5528.It Li "Enter" Ta "Paste selected buffer" 5529.It Li "Up" Ta "Select previous buffer" 5530.It Li "Down" Ta "Select next buffer" 5531.It Li "C-s" Ta "Search by name or content" 5532.It Li "n" Ta "Repeat last search" 5533.It Li "t" Ta "Toggle if buffer is tagged" 5534.It Li "T" Ta "Tag no buffers" 5535.It Li "C-t" Ta "Tag all buffers" 5536.It Li "p" Ta "Paste selected buffer" 5537.It Li "P" Ta "Paste tagged buffers" 5538.It Li "d" Ta "Delete selected buffer" 5539.It Li "D" Ta "Delete tagged buffers" 5540.It Li "e" Ta "Open the buffer in an editor" 5541.It Li "f" Ta "Enter a format to filter items" 5542.It Li "O" Ta "Change sort field" 5543.It Li "r" Ta "Reverse sort order" 5544.It Li "v" Ta "Toggle preview" 5545.It Li "q" Ta "Exit mode" 5546.El 5547.Pp 5548After a buffer is chosen, 5549.Ql %% 5550is replaced by the buffer name in 5551.Ar template 5552and the result executed as a command. 5553If 5554.Ar template 5555is not given, "paste-buffer -b '%%'" is used. 5556.Pp 5557.Fl O 5558specifies the initial sort field: one of 5559.Ql time , 5560.Ql name 5561or 5562.Ql size . 5563.Fl r 5564reverses the sort order. 5565.Fl f 5566specifies an initial filter: the filter is a format - if it evaluates to zero, 5567the item in the list is not shown, otherwise it is shown. 5568If a filter would lead to an empty list, it is ignored. 5569.Fl F 5570specifies the format for each item in the list. 5571.Fl N 5572starts without the preview. 5573This command works only if at least one client is attached. 5574.It Ic clear-history Op Fl t Ar target-pane 5575.D1 (alias: Ic clearhist ) 5576Remove and free the history for the specified pane. 5577.It Ic delete-buffer Op Fl b Ar buffer-name 5578.D1 (alias: Ic deleteb ) 5579Delete the buffer named 5580.Ar buffer-name , 5581or the most recently added automatically named buffer if not specified. 5582.It Xo Ic list-buffers 5583.Op Fl F Ar format 5584.Op Fl f Ar filter 5585.Xc 5586.D1 (alias: Ic lsb ) 5587List the global buffers. 5588.Fl F 5589specifies the format of each line and 5590.Fl f 5591a filter. 5592Only buffers for which the filter is true are shown. 5593See the 5594.Sx FORMATS 5595section. 5596.It Xo Ic load-buffer 5597.Op Fl b Ar buffer-name 5598.Ar path 5599.Xc 5600.D1 (alias: Ic loadb ) 5601Load the contents of the specified paste buffer from 5602.Ar path . 5603.It Xo Ic paste-buffer 5604.Op Fl dpr 5605.Op Fl b Ar buffer-name 5606.Op Fl s Ar separator 5607.Op Fl t Ar target-pane 5608.Xc 5609.D1 (alias: Ic pasteb ) 5610Insert the contents of a paste buffer into the specified pane. 5611If not specified, paste into the current one. 5612With 5613.Fl d , 5614also delete the paste buffer. 5615When output, any linefeed (LF) characters in the paste buffer are replaced with 5616a separator, by default carriage return (CR). 5617A custom separator may be specified using the 5618.Fl s 5619flag. 5620The 5621.Fl r 5622flag means to do no replacement (equivalent to a separator of LF). 5623If 5624.Fl p 5625is specified, paste bracket control codes are inserted around the 5626buffer if the application has requested bracketed paste mode. 5627.It Xo Ic save-buffer 5628.Op Fl a 5629.Op Fl b Ar buffer-name 5630.Ar path 5631.Xc 5632.D1 (alias: Ic saveb ) 5633Save the contents of the specified paste buffer to 5634.Ar path . 5635The 5636.Fl a 5637option appends to rather than overwriting the file. 5638.It Xo Ic set-buffer 5639.Op Fl a 5640.Op Fl b Ar buffer-name 5641.Op Fl n Ar new-buffer-name 5642.Ar data 5643.Xc 5644.D1 (alias: Ic setb ) 5645Set the contents of the specified buffer to 5646.Ar data . 5647The 5648.Fl a 5649option appends to rather than overwriting the buffer. 5650The 5651.Fl n 5652option renames the buffer to 5653.Ar new-buffer-name . 5654.It Xo Ic show-buffer 5655.Op Fl b Ar buffer-name 5656.Xc 5657.D1 (alias: Ic showb ) 5658Display the contents of the specified buffer. 5659.El 5660.Sh MISCELLANEOUS 5661Miscellaneous commands are as follows: 5662.Bl -tag -width Ds 5663.It Ic clock-mode Op Fl t Ar target-pane 5664Display a large clock. 5665.It Xo Ic if-shell 5666.Op Fl bF 5667.Op Fl t Ar target-pane 5668.Ar shell-command command 5669.Op Ar command 5670.Xc 5671.D1 (alias: Ic if ) 5672Execute the first 5673.Ar command 5674if 5675.Ar shell-command 5676returns success or the second 5677.Ar command 5678otherwise. 5679Before being executed, 5680.Ar shell-command 5681is expanded using the rules specified in the 5682.Sx FORMATS 5683section, including those relevant to 5684.Ar target-pane . 5685With 5686.Fl b , 5687.Ar shell-command 5688is run in the background. 5689.Pp 5690If 5691.Fl F 5692is given, 5693.Ar shell-command 5694is not executed but considered success if neither empty nor zero (after formats 5695are expanded). 5696.It Ic lock-server 5697.D1 (alias: Ic lock ) 5698Lock each client individually by running the command specified by the 5699.Ic lock-command 5700option. 5701.It Xo Ic run-shell 5702.Op Fl b 5703.Op Fl d Ar delay 5704.Op Fl t Ar target-pane 5705.Op Ar shell-command 5706.Xc 5707.D1 (alias: Ic run ) 5708Execute 5709.Ar shell-command 5710in the background without creating a window. 5711Before being executed, shell-command is expanded using the rules specified in 5712the 5713.Sx FORMATS 5714section. 5715With 5716.Fl b , 5717the command is run in the background. 5718.Fl d 5719waits for 5720.Ar delay 5721seconds before starting the command. 5722After the command finishes, any output to stdout is displayed in view mode (in 5723the pane specified by 5724.Fl t 5725or the current pane if omitted). 5726If the command doesn't return success, the exit status is also displayed. 5727.It Xo Ic wait-for 5728.Op Fl L | S | U 5729.Ar channel 5730.Xc 5731.D1 (alias: Ic wait ) 5732When used without options, prevents the client from exiting until woken using 5733.Ic wait-for 5734.Fl S 5735with the same channel. 5736When 5737.Fl L 5738is used, the channel is locked and any clients that try to lock the same 5739channel are made to wait until the channel is unlocked with 5740.Ic wait-for 5741.Fl U . 5742.El 5743.Sh EXIT MESSAGES 5744When a 5745.Nm 5746client detaches, it prints a message. 5747This may be one of: 5748.Bl -tag -width Ds 5749.It detached (from session ...) 5750The client was detached normally. 5751.It detached and SIGHUP 5752The client was detached and its parent sent the 5753.Dv SIGHUP 5754signal (for example with 5755.Ic detach-client 5756.Fl P ) . 5757.It lost tty 5758The client's 5759.Xr tty 4 5760or 5761.Xr pty 4 5762was unexpectedly destroyed. 5763.It terminated 5764The client was killed with 5765.Dv SIGTERM . 5766.It too far behind 5767The client is in control mode and became unable to keep up with the data from 5768.Nm . 5769.It exited 5770The server exited when it had no sessions. 5771.It server exited 5772The server exited when it received 5773.Dv SIGTERM . 5774.It server exited unexpectedly 5775The server crashed or otherwise exited without telling the client the reason. 5776.El 5777.Sh TERMINFO EXTENSIONS 5778.Nm 5779understands some unofficial extensions to 5780.Xr terminfo 5 . 5781It is not normally necessary to set these manually, instead the 5782.Ic terminal-features 5783option should be used. 5784.Bl -tag -width Ds 5785.It Em \&AX 5786An existing extension that tells 5787.Nm 5788the terminal supports default colours. 5789.It Em \&Cs , Cr 5790Set the cursor colour. 5791The first takes a single string argument and is used to set the colour; 5792the second takes no arguments and restores the default cursor colour. 5793If set, a sequence such as this may be used 5794to change the cursor colour from inside 5795.Nm : 5796.Bd -literal -offset indent 5797$ printf '\e033]12;red\e033\e\e' 5798.Ed 5799.It Em \&Cmg, \&Clmg, \&Dsmg , \&Enmg 5800Set, clear, disable or enable DECSLRM margins. 5801These are set automatically if the terminal reports it is 5802.Em VT420 5803compatible. 5804.It Em \&Dsbp , \&Enbp 5805Disable and enable bracketed paste. 5806These are set automatically if the 5807.Em XT 5808capability is present. 5809.It Em \&Dseks , \&Eneks 5810Disable and enable extended keys. 5811.It Em \&Dsfcs , \&Enfcs 5812Disable and enable focus reporting. 5813These are set automatically if the 5814.Em XT 5815capability is present. 5816.It Em \&Smol 5817Enable the overline attribute. 5818.It Em \&Smulx 5819Set a styled underscore. 5820The single parameter is one of: 0 for no underscore, 1 for normal 5821underscore, 2 for double underscore, 3 for curly underscore, 4 for dotted 5822underscore and 5 for dashed underscore. 5823.It Em \&Setulc 5824Set the underscore colour. 5825The argument is (red * 65536) + (green * 256) + blue where each is between 0 5826and 255. 5827.It Em \&Ss , Se 5828Set or reset the cursor style. 5829If set, a sequence such as this may be used 5830to change the cursor to an underline: 5831.Bd -literal -offset indent 5832$ printf '\e033[4 q' 5833.Ed 5834.Pp 5835If 5836.Em Se 5837is not set, \&Ss with argument 0 will be used to reset the cursor style instead. 5838.It Em \&Sync 5839Start (parameter is 1) or end (parameter is 2) a synchronized update. 5840.It Em \&Tc 5841Indicate that the terminal supports the 5842.Ql direct colour 5843RGB escape sequence (for example, \ee[38;2;255;255;255m). 5844.Pp 5845If supported, this is used for the initialize colour escape sequence (which 5846may be enabled by adding the 5847.Ql initc 5848and 5849.Ql ccc 5850capabilities to the 5851.Nm 5852.Xr terminfo 5 5853entry). 5854.Pp 5855This is equivalent to the 5856.Em RGB 5857.Xr terminfo 5 5858capability. 5859.It Em \&Ms 5860Store the current buffer in the host terminal's selection (clipboard). 5861See the 5862.Em set-clipboard 5863option above and the 5864.Xr xterm 1 5865man page. 5866.It Em \&XT 5867This is an existing extension capability that tmux uses to mean that the 5868terminal supports the 5869.Xr xterm 1 5870title set sequences and to automatically set some of the capabilities above. 5871.El 5872.Sh CONTROL MODE 5873.Nm 5874offers a textual interface called 5875.Em control mode . 5876This allows applications to communicate with 5877.Nm 5878using a simple text-only protocol. 5879.Pp 5880In control mode, a client sends 5881.Nm 5882commands or command sequences terminated by newlines on standard input. 5883Each command will produce one block of output on standard output. 5884An output block consists of a 5885.Em %begin 5886line followed by the output (which may be empty). 5887The output block ends with a 5888.Em %end 5889or 5890.Em %error . 5891.Em %begin 5892and matching 5893.Em %end 5894or 5895.Em %error 5896have two arguments: an integer time (as seconds from epoch) and command number. 5897For example: 5898.Bd -literal -offset indent 5899%begin 1363006971 2 59000: ksh* (1 panes) [80x24] [layout b25f,80x24,0,0,2] @2 (active) 5901%end 1363006971 2 5902.Ed 5903.Pp 5904The 5905.Ic refresh-client 5906.Fl C 5907command may be used to set the size of a client in control mode. 5908.Pp 5909In control mode, 5910.Nm 5911outputs notifications. 5912A notification will never occur inside an output block. 5913.Pp 5914The following notifications are defined: 5915.Bl -tag -width Ds 5916.It Ic %client-session-changed Ar client session-id name 5917The client is now attached to the session with ID 5918.Ar session-id , 5919which is named 5920.Ar name . 5921.It Ic %continue Ar pane-id 5922The pane has been continued after being paused (if the 5923.Ar pause-after 5924flag is set, see 5925.Ic refresh-client 5926.Fl A ) . 5927.It Ic %exit Op Ar reason 5928The 5929.Nm 5930client is exiting immediately, either because it is not attached to any session 5931or an error occurred. 5932If present, 5933.Ar reason 5934describes why the client exited. 5935.It Ic %extended-output Ar pane-id Ar age Ar ... : Ar value 5936New form of 5937.Ic %output 5938sent when the 5939.Ar pause-after 5940flag is set. 5941.Ar age 5942is the time in milliseconds for which tmux had buffered the output before it was sent. 5943Any subsequent arguments up until a single 5944.Ql \&: 5945are for future use and should be ignored. 5946.It Ic %layout-change Ar window-id Ar window-layout Ar window-visible-layout Ar window-flags 5947The layout of a window with ID 5948.Ar window-id 5949changed. 5950The new layout is 5951.Ar window-layout . 5952The window's visible layout is 5953.Ar window-visible-layout 5954and the window flags are 5955.Ar window-flags . 5956.It Ic %output Ar pane-id Ar value 5957A window pane produced output. 5958.Ar value 5959escapes non-printable characters and backslash as octal \\xxx. 5960.It Ic %pane-mode-changed Ar pane-id 5961The pane with ID 5962.Ar pane-id 5963has changed mode. 5964.It Ic %pause Ar pane-id 5965The pane has been paused (if the 5966.Ar pause-after 5967flag is set). 5968.It Ic %session-changed Ar session-id Ar name 5969The client is now attached to the session with ID 5970.Ar session-id , 5971which is named 5972.Ar name . 5973.It Ic %session-renamed Ar name 5974The current session was renamed to 5975.Ar name . 5976.It Ic %session-window-changed Ar session-id Ar window-id 5977The session with ID 5978.Ar session-id 5979changed its active window to the window with ID 5980.Ar window-id . 5981.It Ic %sessions-changed 5982A session was created or destroyed. 5983.It Ic %unlinked-window-add Ar window-id 5984The window with ID 5985.Ar window-id 5986was created but is not linked to the current session. 5987.It Ic %window-add Ar window-id 5988The window with ID 5989.Ar window-id 5990was linked to the current session. 5991.It Ic %window-close Ar window-id 5992The window with ID 5993.Ar window-id 5994closed. 5995.It Ic %window-pane-changed Ar window-id Ar pane-id 5996The active pane in the window with ID 5997.Ar window-id 5998changed to the pane with ID 5999.Ar pane-id . 6000.It Ic %window-renamed Ar window-id Ar name 6001The window with ID 6002.Ar window-id 6003was renamed to 6004.Ar name . 6005.El 6006.Sh ENVIRONMENT 6007When 6008.Nm 6009is started, it inspects the following environment variables: 6010.Bl -tag -width LC_CTYPE 6011.It Ev EDITOR 6012If the command specified in this variable contains the string 6013.Ql vi 6014and 6015.Ev VISUAL 6016is unset, use vi-style key bindings. 6017Overridden by the 6018.Ic mode-keys 6019and 6020.Ic status-keys 6021options. 6022.It Ev HOME 6023The user's login directory. 6024If unset, the 6025.Xr passwd 5 6026database is consulted. 6027.It Ev LC_CTYPE 6028The character encoding 6029.Xr locale 1 . 6030It is used for two separate purposes. 6031For output to the terminal, UTF-8 is used if the 6032.Fl u 6033option is given or if 6034.Ev LC_CTYPE 6035contains 6036.Qq UTF-8 6037or 6038.Qq UTF8 . 6039Otherwise, only ASCII characters are written and non-ASCII characters 6040are replaced with underscores 6041.Pq Ql _ . 6042For input, 6043.Nm 6044always runs with a UTF-8 locale. 6045If en_US.UTF-8 is provided by the operating system it is used and 6046.Ev LC_CTYPE 6047is ignored for input. 6048Otherwise, 6049.Ev LC_CTYPE 6050tells 6051.Nm 6052what the UTF-8 locale is called on the current system. 6053If the locale specified by 6054.Ev LC_CTYPE 6055is not available or is not a UTF-8 locale, 6056.Nm 6057exits with an error message. 6058.It Ev LC_TIME 6059The date and time format 6060.Xr locale 1 . 6061It is used for locale-dependent 6062.Xr strftime 3 6063format specifiers. 6064.It Ev PWD 6065The current working directory to be set in the global environment. 6066This may be useful if it contains symbolic links. 6067If the value of the variable does not match the current working 6068directory, the variable is ignored and the result of 6069.Xr getcwd 3 6070is used instead. 6071.It Ev SHELL 6072The absolute path to the default shell for new windows. 6073See the 6074.Ic default-shell 6075option for details. 6076.It Ev TMUX_TMPDIR 6077The parent directory of the directory containing the server sockets. 6078See the 6079.Fl L 6080option for details. 6081.It Ev VISUAL 6082If the command specified in this variable contains the string 6083.Ql vi , 6084use vi-style key bindings. 6085Overridden by the 6086.Ic mode-keys 6087and 6088.Ic status-keys 6089options. 6090.El 6091.Sh FILES 6092.Bl -tag -width "/etc/tmux.confXXX" -compact 6093.It Pa ~/.tmux.conf 6094Default 6095.Nm 6096configuration file. 6097.It Pa /etc/tmux.conf 6098System-wide configuration file. 6099.El 6100.Sh EXAMPLES 6101To create a new 6102.Nm 6103session running 6104.Xr vi 1 : 6105.Pp 6106.Dl $ tmux new-session vi 6107.Pp 6108Most commands have a shorter form, known as an alias. 6109For new-session, this is 6110.Ic new : 6111.Pp 6112.Dl $ tmux new vi 6113.Pp 6114Alternatively, the shortest unambiguous form of a command is accepted. 6115If there are several options, they are listed: 6116.Bd -literal -offset indent 6117$ tmux n 6118ambiguous command: n, could be: new-session, new-window, next-window 6119.Ed 6120.Pp 6121Within an active session, a new window may be created by typing 6122.Ql C-b c 6123(Ctrl 6124followed by the 6125.Ql b 6126key 6127followed by the 6128.Ql c 6129key). 6130.Pp 6131Windows may be navigated with: 6132.Ql C-b 0 6133(to select window 0), 6134.Ql C-b 1 6135(to select window 1), and so on; 6136.Ql C-b n 6137to select the next window; and 6138.Ql C-b p 6139to select the previous window. 6140.Pp 6141A session may be detached using 6142.Ql C-b d 6143(or by an external event such as 6144.Xr ssh 1 6145disconnection) and reattached with: 6146.Pp 6147.Dl $ tmux attach-session 6148.Pp 6149Typing 6150.Ql C-b \&? 6151lists the current key bindings in the current window; up and down may be used 6152to navigate the list or 6153.Ql q 6154to exit from it. 6155.Pp 6156Commands to be run when the 6157.Nm 6158server is started may be placed in the 6159.Pa ~/.tmux.conf 6160configuration file. 6161Common examples include: 6162.Pp 6163Changing the default prefix key: 6164.Bd -literal -offset indent 6165set-option -g prefix C-a 6166unbind-key C-b 6167bind-key C-a send-prefix 6168.Ed 6169.Pp 6170Turning the status line off, or changing its colour: 6171.Bd -literal -offset indent 6172set-option -g status off 6173set-option -g status-style bg=blue 6174.Ed 6175.Pp 6176Setting other options, such as the default command, 6177or locking after 30 minutes of inactivity: 6178.Bd -literal -offset indent 6179set-option -g default-command "exec /bin/ksh" 6180set-option -g lock-after-time 1800 6181.Ed 6182.Pp 6183Creating new key bindings: 6184.Bd -literal -offset indent 6185bind-key b set-option status 6186bind-key / command-prompt "split-window 'exec man %%'" 6187bind-key S command-prompt "new-window -n %1 'ssh %1'" 6188.Ed 6189.Sh SEE ALSO 6190.Xr pty 4 6191.Sh AUTHORS 6192.An Nicholas Marriott Aq Mt nicholas.marriott@gmail.com 6193