-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.1
3857 lines (3851 loc) · 91.7 KB
/
tmux.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
.\" $Id$
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: March 25 2013 $
.Dt TMUX 1
.Os
.Sh NAME
.Nm tmux
.Nd terminal multiplexer
.Sh SYNOPSIS
.Nm tmux
.Bk -words
.Op Fl 2lCquvV
.Op Fl c Ar shell-command
.Op Fl f Ar file
.Op Fl L Ar socket-name
.Op Fl S Ar socket-path
.Op Ar command Op Ar flags
.Ek
.Sh DESCRIPTION
.Nm
is a terminal multiplexer:
it enables a number of terminals to be created, accessed, and
controlled from a single screen.
.Nm
may be detached from a screen
and continue running in the background,
then later reattached.
.Pp
When
.Nm
is started it creates a new
.Em session
with a single
.Em window
and displays it on screen.
A status line at the bottom of the screen
shows information on the current session
and is used to enter interactive commands.
.Pp
A session is a single collection of
.Em pseudo terminals
under the management of
.Nm .
Each session has one or more
windows linked to it.
A window occupies the entire screen
and may be split into rectangular panes,
each of which is a separate pseudo terminal
(the
.Xr pty 4
manual page documents the technical details of pseudo terminals).
Any number of
.Nm
instances may connect to the same session,
and any number of windows may be present in the same session.
Once all sessions are killed,
.Nm
exits.
.Pp
Each session is persistent and will survive accidental disconnection
(such as
.Xr ssh 1
connection timeout) or intentional detaching (with the
.Ql C-b d
key strokes).
.Nm
may be reattached using:
.Pp
.Dl $ tmux attach
.Pp
In
.Nm ,
a session is displayed on screen by a
.Em client
and all sessions are managed by a single
.Em server .
The server and each client are separate processes which communicate through a
socket in
.Pa /tmp .
.Pp
The options are as follows:
.Bl -tag -width "XXXXXXXXXXXX"
.It Fl 2
Force
.Nm
to assume the terminal supports 256 colours.
.It Fl C
Start in control mode (see the
.Sx CONTROL MODE
section).
Given twice
.Xo ( Fl CC ) Xc
disables echo.
.It Fl c Ar shell-command
Execute
.Ar shell-command
using the default shell.
If necessary, the
.Nm
server will be started to retrieve the
.Ic default-shell
option.
This option is for compatibility with
.Xr sh 1
when
.Nm
is used as a login shell.
.It Fl f Ar file
Specify an alternative configuration file.
By default,
.Nm
loads the system configuration file from
.Pa @SYSCONFDIR@/tmux.conf ,
if present, then looks for a user configuration file at
.Pa ~/.tmux.conf .
.Pp
The configuration file is a set of
.Nm
commands which are executed in sequence when the server is first started.
.Nm
loads configuration files once when the server process has started.
The
.Ic source-file
command may be used to load a file later.
.Pp
.Nm
shows any error messages from commands in configuration files in the first
session created, and continues to process the rest of the configuration file.
.It Fl L Ar socket-name
.Nm
stores the server socket in a directory under
.Ev TMUX_TMPDIR ,
.Ev TMPDIR
if it is unset, or
.Pa /tmp
if both are unset.
The default socket is named
.Em default .
This option allows a different socket name to be specified, allowing several
independent
.Nm
servers to be run.
Unlike
.Fl S
a full path is not necessary: the sockets are all created in the same
directory.
.Pp
If the socket is accidentally removed, the
.Dv SIGUSR1
signal may be sent to the
.Nm
server process to recreate it.
.It Fl l
Behave as a login shell.
This flag currently has no effect and is for compatibility with other shells
when using tmux as a login shell.
.It Fl q
Set the
.Ic quiet
server option to prevent the server sending various informational messages.
.It Fl S Ar socket-path
Specify a full alternative path to the server socket.
If
.Fl S
is specified, the default socket directory is not used and any
.Fl L
flag is ignored.
.It Fl u
.Nm
attempts to guess if the terminal is likely to support UTF-8 by checking the
first of the
.Ev LC_ALL ,
.Ev LC_CTYPE
and
.Ev LANG
environment variables to be set for the string "UTF-8".
This is not always correct: the
.Fl u
flag explicitly informs
.Nm
that UTF-8 is supported.
.Pp
If the server is started from a client passed
.Fl u
or where UTF-8 is detected, the
.Ic utf8
and
.Ic status-utf8
options are enabled in the global window and session options respectively.
.It Fl v
Request verbose logging.
This option may be specified multiple times for increasing verbosity.
Log messages will be saved into
.Pa tmux-client-PID.log
and
.Pa tmux-server-PID.log
files in the current directory, where
.Em PID
is the PID of the server or client process.
.It Fl V
Report the
.Nm
version.
.It Ar command Op Ar flags
This specifies one of a set of commands used to control
.Nm ,
as described in the following sections.
If no commands are specified, the
.Ic new-session
command is assumed.
.El
.Sh KEY BINDINGS
.Nm
may be controlled from an attached client by using a key combination of a
prefix key,
.Ql C-b
(Ctrl-b) by default, followed by a command key.
.Pp
The default command key bindings are:
.Pp
.Bl -tag -width "XXXXXXXXXX" -offset indent -compact
.It C-b
Send the prefix key (C-b) through to the application.
.It C-o
Rotate the panes in the current window forwards.
.It C-z
Suspend the
.Nm
client.
.It !
Break the current pane out of the window.
.It \&"
Split the current pane into two, top and bottom.
.It #
List all paste buffers.
.It $
Rename the current session.
.It %
Split the current pane into two, left and right.
.It &
Kill the current window.
.It '
Prompt for a window index to select.
.It ,
Rename the current window.
.It -
Delete the most recently copied buffer of text.
.It .
Prompt for an index to move the current window.
.It 0 to 9
Select windows 0 to 9.
.It :
Enter the
.Nm
command prompt.
.It ;
Move to the previously active pane.
.It =
Choose which buffer to paste interactively from a list.
.It \&?
List all key bindings.
.It D
Choose a client to detach.
.It \&[
Enter copy mode to copy text or view the history.
.It \&]
Paste the most recently copied buffer of text.
.It c
Create a new window.
.It d
Detach the current client.
.It f
Prompt to search for text in open windows.
.It i
Display some information about the current window.
.It l
Move to the previously selected window.
.It n
Change to the next window.
.It o
Select the next pane in the current window.
.It p
Change to the previous window.
.It q
Briefly display pane indexes.
.It r
Force redraw of the attached client.
.It s
Select a new session for the attached client interactively.
.It L
Switch the attached client back to the last session.
.It t
Show the time.
.It w
Choose the current window interactively.
.It x
Kill the current pane.
.It {
Swap the current pane with the previous pane.
.It }
Swap the current pane with the next pane.
.It ~
Show previous messages from
.Nm ,
if any.
.It Page Up
Enter copy mode and scroll one page up.
.It Up, Down
.It Left, Right
Change to the pane above, below, to the left, or to the right of the current
pane.
.It M-1 to M-5
Arrange panes in one of the five preset layouts: even-horizontal,
even-vertical, main-horizontal, main-vertical, or tiled.
.It M-n
Move to the next window with a bell or activity marker.
.It M-o
Rotate the panes in the current window backwards.
.It M-p
Move to the previous window with a bell or activity marker.
.It C-Up, C-Down
.It C-Left, C-Right
Resize the current pane in steps of one cell.
.It M-Up, M-Down
.It M-Left, M-Right
Resize the current pane in steps of five cells.
.El
.Pp
Key bindings may be changed with the
.Ic bind-key
and
.Ic unbind-key
commands.
.Sh COMMANDS
This section contains a list of the commands supported by
.Nm .
Most commands accept the optional
.Fl t
argument with one of
.Ar target-client ,
.Ar target-session
.Ar target-window ,
or
.Ar target-pane .
These specify the client, session, window or pane which a command should affect.
.Ar target-client
is the name of the
.Xr pty 4
file to which the client is connected, for example either of
.Pa /dev/ttyp1
or
.Pa ttyp1
for the client attached to
.Pa /dev/ttyp1 .
If no client is specified, the current client is chosen, if possible, or an
error is reported.
Clients may be listed with the
.Ic list-clients
command.
.Pp
.Ar target-session
is the session id prefixed with a $, the name of a session (as listed by the
.Ic list-sessions
command), or the name of a client with the same syntax as
.Ar target-client ,
in which case the session attached to the client is used.
When looking for the session name,
.Nm
initially searches for an exact match; if none is found, the session names
are checked for any for which
.Ar target-session
is a prefix or for which it matches as an
.Xr fnmatch 3
pattern.
If a single match is found, it is used as the target session; multiple matches
produce an error.
If a session is omitted, the current session is used if available; if no
current session is available, the most recently used is chosen.
.Pp
.Ar target-window
specifies a window in the form
.Em session Ns \&: Ns Em window .
.Em session
follows the same rules as for
.Ar target-session ,
and
.Em window
is looked for in order: as a window index, for example mysession:1;
as a window ID, such as @1;
as an exact window name, such as mysession:mywindow; then as an
.Xr fnmatch 3
pattern or the start of a window name, such as mysession:mywin* or
mysession:mywin.
An empty window name specifies the next unused index if appropriate (for
example the
.Ic new-window
and
.Ic link-window
commands)
otherwise the current window in
.Em session
is chosen.
The special character
.Ql \&!
uses the last (previously current) window,
.Ql ^
selects the highest numbered window,
.Ql $
selects the lowest numbered window, and
.Ql +
and
.Ql -
select the next window or the previous window by number.
When the argument does not contain a colon,
.Nm
first attempts to parse it as window; if that fails, an attempt is made to
match a session.
.Pp
.Ar target-pane
takes a similar form to
.Ar target-window
but with the optional addition of a period followed by a pane index, for
example: mysession:mywindow.1.
If the pane index is omitted, the currently active pane in the specified
window is used.
If neither a colon nor period appears,
.Nm
first attempts to use the argument as a pane index; if that fails, it is looked
up as for
.Ar target-window .
A
.Ql +
or
.Ql -
indicate the next or previous pane index, respectively.
One of the strings
.Em top ,
.Em bottom ,
.Em left ,
.Em right ,
.Em top-left ,
.Em top-right ,
.Em bottom-left
or
.Em bottom-right
may be used instead of a pane index.
.Pp
The special characters
.Ql +
and
.Ql -
may be followed by an offset, for example:
.Bd -literal -offset indent
select-window -t:+2
.Ed
.Pp
When dealing with a session that doesn't contain sequential window indexes,
they will be correctly skipped.
.Pp
.Nm
also gives each pane created in a server an identifier consisting of a
.Ql %
and a number, starting from zero.
A pane's identifier is unique for the life of the
.Nm
server and is passed to the child process of the pane in the
.Ev TMUX_PANE
environment variable.
It may be used alone to target a pane or the window containing it.
.Pp
.Ar shell-command
arguments are
.Xr sh 1
commands.
These must be passed as a single item, which typically means quoting them, for
example:
.Bd -literal -offset indent
new-window 'vi /etc/passwd'
.Ed
.Pp
.Ar command
.Op Ar arguments
refers to a
.Nm
command, passed with the command and arguments separately, for example:
.Bd -literal -offset indent
bind-key F1 set-window-option force-width 81
.Ed
.Pp
Or if using
.Xr sh 1 :
.Bd -literal -offset indent
$ tmux bind-key F1 set-window-option force-width 81
.Ed
.Pp
Multiple commands may be specified together as part of a
.Em command sequence .
Each command should be separated by spaces and a semicolon;
commands are executed sequentially from left to right and
lines ending with a backslash continue on to the next line,
except when escaped by another backslash.
A literal semicolon may be included by escaping it with a backslash (for
example, when specifying a command sequence to
.Ic bind-key ) .
.Pp
Example
.Nm
commands include:
.Bd -literal -offset indent
refresh-client -t/dev/ttyp2
rename-session -tfirst newname
set-window-option -t:0 monitor-activity on
new-window ; split-window -d
bind-key R source-file ~/.tmux.conf \e; \e
display-message "source-file done"
.Ed
.Pp
Or from
.Xr sh 1 :
.Bd -literal -offset indent
$ tmux kill-window -t :1
$ tmux new-window \e; split-window -d
$ tmux new-session -d 'vi /etc/passwd' \e; split-window -d \e; attach
.Ed
.Sh CLIENTS AND SESSIONS
The
.Nm
server manages clients, sessions, windows and panes.
Clients are attached to sessions to interact with them, either
when they are created with the
.Ic new-session
command, or later with the
.Ic attach-session
command.
Each session has one or more windows
.Em linked
into it.
Windows may be linked to multiple sessions and are made up of one or
more panes,
each of which contains a pseudo terminal.
Commands for creating, linking and otherwise manipulating windows
are covered
in the
.Sx WINDOWS AND PANES
section.
.Pp
The following commands are available to manage clients and sessions:
.Bl -tag -width Ds
.It Xo Ic attach-session
.Op Fl dr
.Op Fl c Ar working-directory
.Op Fl t Ar target-session
.Xc
.D1 (alias: Ic attach )
If run from outside
.Nm ,
create a new client in the current terminal and attach it to
.Ar target-session .
If used from inside, switch the current client.
If
.Fl d
is specified, any other clients attached to the session are detached.
.Fl r
signifies the client is read-only (only keys bound to the
.Ic detach-client
or
.Ic switch-client
commands have any effect)
.Pp
If no server is started,
.Ic attach-session
will attempt to start it; this will fail unless sessions are created in the
configuration file.
.Pp
The
.Ar target-session
rules for
.Ic attach-session
are slightly adjusted: if
.Nm
needs to select the most recently used session, it will prefer the most
recently used
.Em unattached
session.
.Pp
.Fl c
will set the session working directory (used for new windows) to
.Ar working-directory .
.It Xo Ic detach-client
.Op Fl P
.Op Fl a
.Op Fl s Ar target-session
.Op Fl t Ar target-client
.Xc
.D1 (alias: Ic detach )
Detach the current client if bound to a key, the client specified with
.Fl t ,
or all clients currently attached to the session specified by
.Fl s .
The
.Fl a
option kills all but the client given with
.Fl t .
If
.Fl P
is given, send SIGHUP to the parent process of the client, typically causing it
to exit.
.It Ic has-session Op Fl t Ar target-session
.D1 (alias: Ic has )
Report an error and exit with 1 if the specified session does not exist.
If it does exist, exit with 0.
.It Ic kill-server
Kill the
.Nm
server and clients and destroy all sessions.
.It Xo Ic kill-session
.Op Fl a
.Op Fl t Ar target-session
.Xc
Destroy the given session, closing any windows linked to it and no other
sessions, and detaching all clients attached to it.
If
.Fl a
is given, all sessions but the specified one is killed.
.It Xo Ic list-clients
.Op Fl F Ar format
.Op Fl t Ar target-session
.Xc
.D1 (alias: Ic lsc )
List all clients attached to the server.
For the meaning of the
.Fl F
flag, see the
.Sx FORMATS
section.
If
.Ar target-session
is specified, list only clients connected to that session.
.It Ic list-commands
.D1 (alias: Ic lscm )
List the syntax of all commands supported by
.Nm .
.It Ic list-sessions Op Fl F Ar format
.D1 (alias: Ic ls )
List all sessions managed by the server.
For the meaning of the
.Fl F
flag, see the
.Sx FORMATS
section.
.It Ic lock-client Op Fl t Ar target-client
.D1 (alias: Ic lockc )
Lock
.Ar target-client ,
see the
.Ic lock-server
command.
.It Ic lock-session Op Fl t Ar target-session
.D1 (alias: Ic locks )
Lock all clients attached to
.Ar target-session .
.It Xo Ic new-session
.Op Fl AdDP
.Op Fl c Ar start-directory
.Op Fl F Ar format
.Op Fl n Ar window-name
.Op Fl s Ar session-name
.Op Fl t Ar target-session
.Op Fl x Ar width
.Op Fl y Ar height
.Op Ar shell-command
.Xc
.D1 (alias: Ic new )
Create a new session with name
.Ar session-name .
.Pp
The new session is attached to the current terminal unless
.Fl d
is given.
.Ar window-name
and
.Ar shell-command
are the name of and shell command to execute in the initial window.
If
.Fl d
is used,
.Fl x
and
.Fl y
specify the size of the initial window (80 by 24 if not given).
.Pp
If run from a terminal, any
.Xr termios 4
special characters are saved and used for new windows in the new session.
.Pp
The
.Fl A
flag makes
.Ic new-session
behave like
.Ic attach-session
if
.Ar session-name
already exists; in the case,
.Fl D
behaves like
.Fl d
to
.Ic attach-session .
.Pp
If
.Fl t
is given, the new session is
.Em grouped
with
.Ar target-session .
This means they share the same set of windows - all windows from
.Ar target-session
are linked to the new session and any subsequent new windows or windows being
closed are applied to both sessions.
The current and previous window and any session options remain independent and
either session may be killed without affecting the other.
Giving
.Fl n
or
.Ar shell-command
are invalid if
.Fl t
is used.
.Pp
The
.Fl P
option prints information about the new session after it has been created.
By default, it uses the format
.Ql #{session_name}:
but a different format may be specified with
.Fl F .
.It Xo Ic refresh-client
.Op Fl S
.Op Fl t Ar target-client
.Xc
.D1 (alias: Ic refresh )
Refresh the current client if bound to a key, or a single client if one is given
with
.Fl t .
If
.Fl S
is specified, only update the client's status bar.
.It Xo Ic rename-session
.Op Fl t Ar target-session
.Ar new-name
.Xc
.D1 (alias: Ic rename )
Rename the session to
.Ar new-name .
.It Xo Ic show-messages
.Op Fl IJT
.Op Fl t Ar target-client
.Xc
.D1 (alias: Ic showmsgs )
Show client messages or server information.
Any messages displayed on the status line are saved in a per-client message
log, up to a maximum of the limit set by the
.Ar message-limit
session option for the session attached to that client.
With
.Fl t ,
display the log for
.Ar target-client .
.Fl I ,
.Fl J
and
.Fl T
show debugging information about the running server, jobs and terminals.
.It Ic source-file Ar path
.D1 (alias: Ic source )
Execute commands from
.Ar path .
.It Ic start-server
.D1 (alias: Ic start )
Start the
.Nm
server, if not already running, without creating any sessions.
.It Xo Ic suspend-client
.Op Fl t Ar target-client
.Xc
.D1 (alias: Ic suspendc )
Suspend a client by sending
.Dv SIGTSTP
(tty stop).
.It Xo Ic switch-client
.Op Fl lnpr
.Op Fl c Ar target-client
.Op Fl t Ar target-session
.Xc
.D1 (alias: Ic switchc )
Switch the current session for client
.Ar target-client
to
.Ar target-session .
If
.Fl l ,
.Fl n
or
.Fl p
is used, the client is moved to the last, next or previous session
respectively.
.Fl r
toggles whether a client is read-only (see the
.Ic attach-session
command).
.El
.Sh WINDOWS AND PANES
A
.Nm
window may be in one of several modes.
The default permits direct access to the terminal attached to the window.
The other is copy mode, which permits a section of a window or its
history to be copied to a
.Em paste buffer
for later insertion into another window.
This mode is entered with the
.Ic copy-mode
command, bound to
.Ql \&[
by default.
It is also entered when a command that produces output, such as
.Ic list-keys ,
is executed from a key binding.
.Pp
The keys available depend on whether emacs or vi mode is selected
(see the
.Ic mode-keys
option).
The following keys are supported as appropriate for the mode:
.Bl -column "FunctionXXXXXXXXXXXXXXXXX" "viXXXXXXXXXX" "emacs" -offset indent
.It Sy "Function" Ta Sy "vi" Ta Sy "emacs"
.It Li "Back to indentation" Ta "^" Ta "M-m"
.It Li "Bottom of history" Ta "G" Ta "M-<"
.It Li "Clear selection" Ta "Escape" Ta "C-g"
.It Li "Copy selection" Ta "Enter" Ta "M-w"
.It Li "Cursor down" Ta "j" Ta "Down"
.It Li "Cursor left" Ta "h" Ta "Left"
.It Li "Cursor right" Ta "l" Ta "Right"
.It Li "Cursor to bottom line" Ta "L" Ta ""
.It Li "Cursor to middle line" Ta "M" Ta "M-r"
.It Li "Cursor to top line" Ta "H" Ta "M-R"
.It Li "Cursor up" Ta "k" Ta "Up"
.It Li "Delete entire line" Ta "d" Ta "C-u"
.It Li "Delete/Copy to end of line" Ta "D" Ta "C-k"
.It Li "End of line" Ta "$" Ta "C-e"
.It Li "Go to line" Ta ":" Ta "g"
.It Li "Half page down" Ta "C-d" Ta "M-Down"
.It Li "Half page up" Ta "C-u" Ta "M-Up"
.It Li "Jump forward" Ta "f" Ta "f"
.It Li "Jump to forward" Ta "t" Ta ""
.It Li "Jump backward" Ta "F" Ta "F"
.It Li "Jump to backward" Ta "T" Ta ""
.It Li "Jump again" Ta ";" Ta ";"
.It Li "Jump again in reverse" Ta "," Ta ","
.It Li "Next page" Ta "C-f" Ta "Page down"
.It Li "Next space" Ta "W" Ta ""
.It Li "Next space, end of word" Ta "E" Ta ""
.It Li "Next word" Ta "w" Ta ""
.It Li "Next word end" Ta "e" Ta "M-f"
.It Li "Other end of selection" Ta "o" Ta ""
.It Li "Paste buffer" Ta "p" Ta "C-y"
.It Li "Previous page" Ta "C-b" Ta "Page up"
.It Li "Previous word" Ta "b" Ta "M-b"
.It Li "Previous space" Ta "B" Ta ""
.It Li "Quit mode" Ta "q" Ta "Escape"
.It Li "Rectangle toggle" Ta "v" Ta "R"
.It Li "Scroll down" Ta "C-Down or C-e" Ta "C-Down"
.It Li "Scroll up" Ta "C-Up or C-y" Ta "C-Up"
.It Li "Search again" Ta "n" Ta "n"
.It Li "Search again in reverse" Ta "N" Ta "N"
.It Li "Search backward" Ta "?" Ta "C-r"
.It Li "Search forward" Ta "/" Ta "C-s"
.It Li "Start of line" Ta "0" Ta "C-a"
.It Li "Start selection" Ta "Space" Ta "C-Space"
.It Li "Top of history" Ta "g" Ta "M->"
.It Li "Transpose characters" Ta "" Ta "C-t"
.El
.Pp
The next and previous word keys use space and the
.Ql - ,
.Ql _
and
.Ql @
characters as word delimiters by default, but this can be adjusted by
setting the
.Em word-separators
session option.
Next word moves to the start of the next word, next word end to the end of the
next word and previous word to the start of the previous word.
The three next and previous space keys work similarly but use a space alone as
the word separator.
.Pp
The jump commands enable quick movement within a line.
For instance, typing
.Ql f
followed by
.Ql /
will move the cursor to the next
.Ql /
character on the current line.
A
.Ql \&;
will then jump to the next occurrence.
.Pp
Commands in copy mode may be prefaced by an optional repeat count.
With vi key bindings, a prefix is entered using the number keys; with
emacs, the Alt (meta) key and a number begins prefix entry.
For example, to move the cursor forward by ten words, use
.Ql M-1 0 M-f
in emacs mode, and
.Ql 10w
in vi.
.Pp
When copying the selection, the repeat count indicates the buffer index to
replace, if used.
.Pp
Mode key bindings are defined in a set of named tables:
.Em vi-edit
and
.Em emacs-edit
for keys used when line editing at the command prompt;
.Em vi-choice
and
.Em emacs-choice
for keys used when choosing from lists (such as produced by the
.Ic choose-window
command); and
.Em vi-copy
and
.Em emacs-copy
used in copy mode.
The tables may be viewed with the
.Ic list-keys
command and keys modified or removed with
.Ic bind-key
and
.Ic unbind-key .
One command accepts an argument,
.Ic copy-pipe ,
which copies the selection and pipes it to a command.
For example the following will bind
.Ql C-q
to copy the selection into
.Pa /tmp
as well as the paste buffer:
.Bd -literal -offset indent
bind-key -temacs-copy C-q copy-pipe "cat >/tmp/out"
.Ed
.Pp
The paste buffer key pastes the first line from the top paste buffer on the
stack.
.Pp
The synopsis for the
.Ic copy-mode
command is:
.Bl -tag -width Ds
.It Xo Ic copy-mode
.Op Fl u
.Op Fl t Ar target-pane
.Xc
Enter copy mode.
The
.Fl u
option scrolls one page up.
.El
.Pp
Each window displayed by
.Nm
may be split into one or more
.Em panes ;
each pane takes up a certain area of the display and is a separate terminal.
A window may be split into panes using the
.Ic split-window
command.