tmux.1 100 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261
  1. .\" $OpenBSD$
  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: March 25 2013 $
  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 2CluvV
  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 Ar command Op Ar flags
  32. .Ek
  33. .Sh DESCRIPTION
  34. .Nm
  35. is a terminal multiplexer:
  36. it enables a number of terminals to be created, accessed, and
  37. controlled from a single screen.
  38. .Nm
  39. may be detached from a screen
  40. and continue running in the background,
  41. then later reattached.
  42. .Pp
  43. When
  44. .Nm
  45. is started it creates a new
  46. .Em session
  47. with a single
  48. .Em window
  49. and displays it on screen.
  50. A status line at the bottom of the screen
  51. shows information on the current session
  52. and is used to enter interactive commands.
  53. .Pp
  54. A session is a single collection of
  55. .Em pseudo terminals
  56. under the management of
  57. .Nm .
  58. Each session has one or more
  59. windows linked to it.
  60. A window occupies the entire screen
  61. and may be split into rectangular panes,
  62. each of which is a separate pseudo terminal
  63. (the
  64. .Xr pty 4
  65. manual page documents the technical details of pseudo terminals).
  66. Any number of
  67. .Nm
  68. instances may connect to the same session,
  69. and any number of windows may be present in the same session.
  70. Once all sessions are killed,
  71. .Nm
  72. exits.
  73. .Pp
  74. Each session is persistent and will survive accidental disconnection
  75. (such as
  76. .Xr ssh 1
  77. connection timeout) or intentional detaching (with the
  78. .Ql C-b d
  79. key strokes).
  80. .Nm
  81. may be reattached using:
  82. .Pp
  83. .Dl $ tmux attach
  84. .Pp
  85. In
  86. .Nm ,
  87. a session is displayed on screen by a
  88. .Em client
  89. and all sessions are managed by a single
  90. .Em server .
  91. The server and each client are separate processes which communicate through a
  92. socket in
  93. .Pa /tmp .
  94. .Pp
  95. The options are as follows:
  96. .Bl -tag -width "XXXXXXXXXXXX"
  97. .It Fl 2
  98. Force
  99. .Nm
  100. to assume the terminal supports 256 colours.
  101. .It Fl C
  102. Start in control mode (see the
  103. .Sx CONTROL MODE
  104. section).
  105. Given twice
  106. .Xo ( Fl CC ) Xc
  107. disables echo.
  108. .It Fl c Ar shell-command
  109. Execute
  110. .Ar shell-command
  111. using the default shell.
  112. If necessary, the
  113. .Nm
  114. server will be started to retrieve the
  115. .Ic default-shell
  116. option.
  117. This option is for compatibility with
  118. .Xr sh 1
  119. when
  120. .Nm
  121. is used as a login shell.
  122. .It Fl f Ar file
  123. Specify an alternative configuration file.
  124. By default,
  125. .Nm
  126. loads the system configuration file from
  127. .Pa @SYSCONFDIR@/tmux.conf ,
  128. if present, then looks for a user configuration file at
  129. .Pa ~/.tmux.conf .
  130. .Pp
  131. The configuration file is a set of
  132. .Nm
  133. commands which are executed in sequence when the server is first started.
  134. .Nm
  135. loads configuration files once when the server process has started.
  136. The
  137. .Ic source-file
  138. command may be used to load a file later.
  139. .Pp
  140. .Nm
  141. shows any error messages from commands in configuration files in the first
  142. session created, and continues to process the rest of the configuration file.
  143. .It Fl L Ar socket-name
  144. .Nm
  145. stores the server socket in a directory under
  146. .Ev TMUX_TMPDIR
  147. or
  148. .Pa /tmp
  149. if it is unset.
  150. The default socket is named
  151. .Em default .
  152. This option allows a different socket name to be specified, allowing several
  153. independent
  154. .Nm
  155. servers to be run.
  156. Unlike
  157. .Fl S
  158. a full path is not necessary: the sockets are all created in the same
  159. directory.
  160. .Pp
  161. If the socket is accidentally removed, the
  162. .Dv SIGUSR1
  163. signal may be sent to the
  164. .Nm
  165. server process to recreate it (note that this will fail if any parent
  166. directories are missing).
  167. .It Fl l
  168. Behave as a login shell.
  169. This flag currently has no effect and is for compatibility with other shells
  170. when using tmux as a login shell.
  171. .It Fl S Ar socket-path
  172. Specify a full alternative path to the server socket.
  173. If
  174. .Fl S
  175. is specified, the default socket directory is not used and any
  176. .Fl L
  177. flag is ignored.
  178. .It Fl u
  179. .Nm
  180. attempts to guess if the terminal is likely to support UTF-8 by checking the
  181. first of the
  182. .Ev LC_ALL ,
  183. .Ev LC_CTYPE
  184. and
  185. .Ev LANG
  186. environment variables to be set for the string "UTF-8".
  187. This is not always correct: the
  188. .Fl u
  189. flag explicitly informs
  190. .Nm
  191. that UTF-8 is supported.
  192. .Pp
  193. Note that
  194. .Nm
  195. itself always accepts UTF-8; this controls whether it will send UTF-8
  196. characters to the terminal it is running (if not, they are replaced by
  197. .Ql _ ) .
  198. .It Fl v
  199. Request verbose logging.
  200. This option may be specified multiple times for increasing verbosity.
  201. Log messages will be saved into
  202. .Pa tmux-client-PID.log
  203. and
  204. .Pa tmux-server-PID.log
  205. files in the current directory, where
  206. .Em PID
  207. is the PID of the server or client process.
  208. .It Fl V
  209. Report the
  210. .Nm
  211. version.
  212. .It Ar command Op Ar flags
  213. This specifies one of a set of commands used to control
  214. .Nm ,
  215. as described in the following sections.
  216. If no commands are specified, the
  217. .Ic new-session
  218. command is assumed.
  219. .El
  220. .Sh KEY BINDINGS
  221. .Nm
  222. may be controlled from an attached client by using a key combination of a
  223. prefix key,
  224. .Ql C-b
  225. (Ctrl-b) by default, followed by a command key.
  226. .Pp
  227. The default command key bindings are:
  228. .Pp
  229. .Bl -tag -width "XXXXXXXXXX" -offset indent -compact
  230. .It C-b
  231. Send the prefix key (C-b) through to the application.
  232. .It C-o
  233. Rotate the panes in the current window forwards.
  234. .It C-z
  235. Suspend the
  236. .Nm
  237. client.
  238. .It !
  239. Break the current pane out of the window.
  240. .It \&"
  241. Split the current pane into two, top and bottom.
  242. .It #
  243. List all paste buffers.
  244. .It $
  245. Rename the current session.
  246. .It %
  247. Split the current pane into two, left and right.
  248. .It &
  249. Kill the current window.
  250. .It '
  251. Prompt for a window index to select.
  252. .It \&(
  253. Switch the attached client to the previous session.
  254. .It \&)
  255. Switch the attached client to the next session.
  256. .It ,
  257. Rename the current window.
  258. .It -
  259. Delete the most recently copied buffer of text.
  260. .It .
  261. Prompt for an index to move the current window.
  262. .It 0 to 9
  263. Select windows 0 to 9.
  264. .It :
  265. Enter the
  266. .Nm
  267. command prompt.
  268. .It ;
  269. Move to the previously active pane.
  270. .It =
  271. Choose which buffer to paste interactively from a list.
  272. .It \&?
  273. List all key bindings.
  274. .It D
  275. Choose a client to detach.
  276. .It L
  277. Switch the attached client back to the last session.
  278. .It \&[
  279. Enter copy mode to copy text or view the history.
  280. .It \&]
  281. Paste the most recently copied buffer of text.
  282. .It c
  283. Create a new window.
  284. .It d
  285. Detach the current client.
  286. .It f
  287. Prompt to search for text in open windows.
  288. .It i
  289. Display some information about the current window.
  290. .It l
  291. Move to the previously selected window.
  292. .It n
  293. Change to the next window.
  294. .It o
  295. Select the next pane in the current window.
  296. .It p
  297. Change to the previous window.
  298. .It q
  299. Briefly display pane indexes.
  300. .It r
  301. Force redraw of the attached client.
  302. .It m
  303. Mark the current pane (see
  304. .Ic select-pane
  305. .Fl m ) .
  306. .It M
  307. Clear the marked pane.
  308. .It s
  309. Select a new session for the attached client interactively.
  310. .It t
  311. Show the time.
  312. .It w
  313. Choose the current window interactively.
  314. .It x
  315. Kill the current pane.
  316. .It z
  317. Toggle zoom state of the current pane.
  318. .It {
  319. Swap the current pane with the previous pane.
  320. .It }
  321. Swap the current pane with the next pane.
  322. .It ~
  323. Show previous messages from
  324. .Nm ,
  325. if any.
  326. .It Page Up
  327. Enter copy mode and scroll one page up.
  328. .It Up, Down
  329. .It Left, Right
  330. Change to the pane above, below, to the left, or to the right of the current
  331. pane.
  332. .It M-1 to M-5
  333. Arrange panes in one of the five preset layouts: even-horizontal,
  334. even-vertical, main-horizontal, main-vertical, or tiled.
  335. .It Space
  336. Arrange the current window in the next preset layout.
  337. .It M-n
  338. Move to the next window with a bell or activity marker.
  339. .It M-o
  340. Rotate the panes in the current window backwards.
  341. .It M-p
  342. Move to the previous window with a bell or activity marker.
  343. .It C-Up, C-Down
  344. .It C-Left, C-Right
  345. Resize the current pane in steps of one cell.
  346. .It M-Up, M-Down
  347. .It M-Left, M-Right
  348. Resize the current pane in steps of five cells.
  349. .El
  350. .Pp
  351. Key bindings may be changed with the
  352. .Ic bind-key
  353. and
  354. .Ic unbind-key
  355. commands.
  356. .Sh COMMANDS
  357. This section contains a list of the commands supported by
  358. .Nm .
  359. Most commands accept the optional
  360. .Fl t
  361. (and sometimes
  362. .Fl s )
  363. argument with one of
  364. .Ar target-client ,
  365. .Ar target-session
  366. .Ar target-window ,
  367. or
  368. .Ar target-pane .
  369. These specify the client, session, window or pane which a command should affect.
  370. .Pp
  371. .Ar target-client
  372. is the name of the
  373. .Xr pty 4
  374. file to which the client is connected, for example either of
  375. .Pa /dev/ttyp1
  376. or
  377. .Pa ttyp1
  378. for the client attached to
  379. .Pa /dev/ttyp1 .
  380. If no client is specified,
  381. .Nm
  382. attempts to work out the client currently in use; if that fails, an error is
  383. reported.
  384. Clients may be listed with the
  385. .Ic list-clients
  386. command.
  387. .Pp
  388. .Ar target-session
  389. is tried as, in order:
  390. .Bl -enum -offset Ds
  391. .It
  392. A session ID prefixed with a $.
  393. .It
  394. An exact name of a session (as listed by the
  395. .Ic list-sessions
  396. command).
  397. .It
  398. The start of a session name, for example
  399. .Ql mysess
  400. would match a session named
  401. .Ql mysession .
  402. .It
  403. An
  404. .Xr fnmatch 3
  405. pattern which is matched against the session name.
  406. .El
  407. .Pp
  408. If the session name is prefixed with an
  409. .Ql = ,
  410. only an exact match is accepted (so
  411. .Ql =mysess
  412. will only match exactly
  413. .Ql mysess ,
  414. not
  415. .Ql mysession ) .
  416. .Pp
  417. If a single session is found, it is used as the target session; multiple matches
  418. produce an error.
  419. If a session is omitted, the current session is used if available; if no
  420. current session is available, the most recently used is chosen.
  421. .Pp
  422. .Ar target-window
  423. (or
  424. .Ar src-window
  425. or
  426. .Ar dst-window )
  427. specifies a window in the form
  428. .Em session Ns \&: Ns Em window .
  429. .Em session
  430. follows the same rules as for
  431. .Ar target-session ,
  432. and
  433. .Em window
  434. is looked for in order as:
  435. .Bl -enum -offset Ds
  436. .It
  437. A special token, listed below.
  438. .It
  439. A window index, for example
  440. .Ql mysession:1
  441. is window 1 in session
  442. .Ql mysession .
  443. .It
  444. A window ID, such as @1.
  445. .It
  446. An exact window name, such as
  447. .Ql mysession:mywindow .
  448. .It
  449. The start of a window name, such as
  450. .Ql mysession:mywin .
  451. .It
  452. As an
  453. .Xr fnmatch 3
  454. pattern matched against the window name.
  455. .El
  456. .Pp
  457. Like sessions, a
  458. .Ql =
  459. prefix will do an exact match only.
  460. An empty window name specifies the next unused index if appropriate (for
  461. example the
  462. .Ic new-window
  463. and
  464. .Ic link-window
  465. commands)
  466. otherwise the current window in
  467. .Em session
  468. is chosen.
  469. .Pp
  470. The following special tokens are available to indicate particular windows.
  471. Each has a single-character alternative form.
  472. .Bl -column "XXXXXXXXXX" "X"
  473. .It Sy "Token" Ta Sy "" Ta Sy "Meaning"
  474. .It Li "{start}" Ta "^" Ta "The lowest-numbered window"
  475. .It Li "{end}" Ta "$" Ta "The highest-numbered window"
  476. .It Li "{last}" Ta "!" Ta "The last (previously current) window"
  477. .It Li "{next}" Ta "+" Ta "The next window by number"
  478. .It Li "{previous}" Ta "-" Ta "The previous window by number"
  479. .El
  480. .Pp
  481. .Ar target-pane
  482. (or
  483. .Ar src-pane
  484. or
  485. .Ar dst-pane )
  486. may be a pane ID or takes a similar form to
  487. .Ar target-window
  488. but with the optional addition of a period followed by a pane index or pane ID,
  489. for example:
  490. .Ql mysession:mywindow.1 .
  491. If the pane index is omitted, the currently active pane in the specified
  492. window is used.
  493. The following special tokens are available for the pane index:
  494. .Bl -column "XXXXXXXXXXXXXX" "X"
  495. .It Sy "Token" Ta Sy "" Ta Sy "Meaning"
  496. .It Li "{last}" Ta "!" Ta "The last (previously active) pane"
  497. .It Li "{next}" Ta "+" Ta "The next pane by number"
  498. .It Li "{previous}" Ta "-" Ta "The previous pane by number"
  499. .It Li "{top}" Ta "" Ta "The top pane"
  500. .It Li "{bottom}" Ta "" Ta "The bottom pane"
  501. .It Li "{left}" Ta "" Ta "The leftmost pane"
  502. .It Li "{right}" Ta "" Ta "The rightmost pane"
  503. .It Li "{top-left}" Ta "" Ta "The top-left pane"
  504. .It Li "{top-right}" Ta "" Ta "The top-right pane"
  505. .It Li "{bottom-left}" Ta "" Ta "The bottom-left pane"
  506. .It Li "{bottom-right}" Ta "" Ta "The bottom-right pane"
  507. .It Li "{up-of}" Ta "" Ta "The pane above the active pane"
  508. .It Li "{down-of}" Ta "" Ta "The pane below the active pane"
  509. .It Li "{left-of}" Ta "" Ta "The pane to the left of the active pane"
  510. .It Li "{right-of}" Ta "" Ta "The pane to the right of the active pane"
  511. .El
  512. .Pp
  513. The tokens
  514. .Ql +
  515. and
  516. .Ql -
  517. may be followed by an offset, for example:
  518. .Bd -literal -offset indent
  519. select-window -t:+2
  520. .Ed
  521. .Pp
  522. In addition,
  523. .Em target-session ,
  524. .Em target-window
  525. or
  526. .Em target-pane
  527. may consist entirely of the token
  528. .Ql {mouse}
  529. (alternative form
  530. .Ql = )
  531. to specify the most recent mouse event
  532. (see the
  533. .Sx MOUSE SUPPORT
  534. section)
  535. or
  536. .Ql {marked}
  537. (alternative form
  538. .Ql ~ )
  539. to specify the marked pane (see
  540. .Ic select-pane
  541. .Fl m ) .
  542. .Pp
  543. Sessions, window and panes are each numbered with a unique ID; session IDs are
  544. prefixed with a
  545. .Ql $ ,
  546. windows with a
  547. .Ql @ ,
  548. and panes with a
  549. .Ql % .
  550. These are unique and are unchanged for the life of the session, window or pane
  551. in the
  552. .Nm
  553. server.
  554. The pane ID is passed to the child process of the pane in the
  555. .Ev TMUX_PANE
  556. environment variable.
  557. IDs may be displayed using the
  558. .Ql session_id ,
  559. .Ql window_id ,
  560. or
  561. .Ql pane_id
  562. formats (see the
  563. .Sx FORMATS
  564. section) and the
  565. .Ic display-message ,
  566. .Ic list-sessions ,
  567. .Ic list-windows
  568. or
  569. .Ic list-panes
  570. commands.
  571. .Pp
  572. .Ar shell-command
  573. arguments are
  574. .Xr sh 1
  575. commands.
  576. This may be a single argument passed to the shell, for example:
  577. .Bd -literal -offset indent
  578. new-window 'vi /etc/passwd'
  579. .Ed
  580. .Pp
  581. Will run:
  582. .Bd -literal -offset indent
  583. /bin/sh -c 'vi /etc/passwd'
  584. .Ed
  585. .Pp
  586. Additionally, the
  587. .Ic new-window ,
  588. .Ic new-session ,
  589. .Ic split-window ,
  590. .Ic respawn-window
  591. and
  592. .Ic respawn-pane
  593. commands allow
  594. .Ar shell-command
  595. to be given as multiple arguments and executed directly (without
  596. .Ql sh -c ) .
  597. This can avoid issues with shell quoting.
  598. For example:
  599. .Bd -literal -offset indent
  600. $ tmux new-window vi /etc/passwd
  601. .Ed
  602. .Pp
  603. Will run
  604. .Xr vi 1
  605. directly without invoking the shell.
  606. .Pp
  607. .Ar command
  608. .Op Ar arguments
  609. refers to a
  610. .Nm
  611. command, passed with the command and arguments separately, for example:
  612. .Bd -literal -offset indent
  613. bind-key F1 set-window-option force-width 81
  614. .Ed
  615. .Pp
  616. Or if using
  617. .Xr sh 1 :
  618. .Bd -literal -offset indent
  619. $ tmux bind-key F1 set-window-option force-width 81
  620. .Ed
  621. .Pp
  622. Multiple commands may be specified together as part of a
  623. .Em command sequence .
  624. Each command should be separated by spaces and a semicolon;
  625. commands are executed sequentially from left to right and
  626. lines ending with a backslash continue on to the next line,
  627. except when escaped by another backslash.
  628. A literal semicolon may be included by escaping it with a backslash (for
  629. example, when specifying a command sequence to
  630. .Ic bind-key ) .
  631. .Pp
  632. Example
  633. .Nm
  634. commands include:
  635. .Bd -literal -offset indent
  636. refresh-client -t/dev/ttyp2
  637. rename-session -tfirst newname
  638. set-window-option -t:0 monitor-activity on
  639. new-window ; split-window -d
  640. bind-key R source-file ~/.tmux.conf \e; \e
  641. display-message "source-file done"
  642. .Ed
  643. .Pp
  644. Or from
  645. .Xr sh 1 :
  646. .Bd -literal -offset indent
  647. $ tmux kill-window -t :1
  648. $ tmux new-window \e; split-window -d
  649. $ tmux new-session -d 'vi /etc/passwd' \e; split-window -d \e; attach
  650. .Ed
  651. .Sh CLIENTS AND SESSIONS
  652. The
  653. .Nm
  654. server manages clients, sessions, windows and panes.
  655. Clients are attached to sessions to interact with them, either
  656. when they are created with the
  657. .Ic new-session
  658. command, or later with the
  659. .Ic attach-session
  660. command.
  661. Each session has one or more windows
  662. .Em linked
  663. into it.
  664. Windows may be linked to multiple sessions and are made up of one or
  665. more panes,
  666. each of which contains a pseudo terminal.
  667. Commands for creating, linking and otherwise manipulating windows
  668. are covered
  669. in the
  670. .Sx WINDOWS AND PANES
  671. section.
  672. .Pp
  673. The following commands are available to manage clients and sessions:
  674. .Bl -tag -width Ds
  675. .It Xo Ic attach-session
  676. .Op Fl dEr
  677. .Op Fl c Ar working-directory
  678. .Op Fl t Ar target-session
  679. .Xc
  680. .D1 (alias: Ic attach )
  681. If run from outside
  682. .Nm ,
  683. create a new client in the current terminal and attach it to
  684. .Ar target-session .
  685. If used from inside, switch the current client.
  686. If
  687. .Fl d
  688. is specified, any other clients attached to the session are detached.
  689. .Fl r
  690. signifies the client is read-only (only keys bound to the
  691. .Ic detach-client
  692. or
  693. .Ic switch-client
  694. commands have any effect)
  695. .Pp
  696. If no server is started,
  697. .Ic attach-session
  698. will attempt to start it; this will fail unless sessions are created in the
  699. configuration file.
  700. .Pp
  701. The
  702. .Ar target-session
  703. rules for
  704. .Ic attach-session
  705. are slightly adjusted: if
  706. .Nm
  707. needs to select the most recently used session, it will prefer the most
  708. recently used
  709. .Em unattached
  710. session.
  711. .Pp
  712. .Fl c
  713. will set the session working directory (used for new windows) to
  714. .Ar working-directory .
  715. .Pp
  716. If
  717. .Fl E
  718. is used, the
  719. .Ic update-environment
  720. option will not be applied.
  721. .It Xo Ic detach-client
  722. .Op Fl aP
  723. .Op Fl s Ar target-session
  724. .Op Fl t Ar target-client
  725. .Xc
  726. .D1 (alias: Ic detach )
  727. Detach the current client if bound to a key, the client specified with
  728. .Fl t ,
  729. or all clients currently attached to the session specified by
  730. .Fl s .
  731. The
  732. .Fl a
  733. option kills all but the client given with
  734. .Fl t .
  735. If
  736. .Fl P
  737. is given, send SIGHUP to the parent process of the client, typically causing it
  738. to exit.
  739. .It Ic has-session Op Fl t Ar target-session
  740. .D1 (alias: Ic has )
  741. Report an error and exit with 1 if the specified session does not exist.
  742. If it does exist, exit with 0.
  743. .It Ic kill-server
  744. Kill the
  745. .Nm
  746. server and clients and destroy all sessions.
  747. .It Xo Ic kill-session
  748. .Op Fl aC
  749. .Op Fl t Ar target-session
  750. .Xc
  751. Destroy the given session, closing any windows linked to it and no other
  752. sessions, and detaching all clients attached to it.
  753. If
  754. .Fl a
  755. is given, all sessions but the specified one is killed.
  756. The
  757. .Fl C
  758. flag clears alerts (bell, activity, or silence) in all windows linked to the
  759. session.
  760. .It Xo Ic list-clients
  761. .Op Fl F Ar format
  762. .Op Fl t Ar target-session
  763. .Xc
  764. .D1 (alias: Ic lsc )
  765. List all clients attached to the server.
  766. For the meaning of the
  767. .Fl F
  768. flag, see the
  769. .Sx FORMATS
  770. section.
  771. If
  772. .Ar target-session
  773. is specified, list only clients connected to that session.
  774. .It Ic list-commands
  775. .D1 (alias: Ic lscm )
  776. List the syntax of all commands supported by
  777. .Nm .
  778. .It Ic list-sessions Op Fl F Ar format
  779. .D1 (alias: Ic ls )
  780. List all sessions managed by the server.
  781. For the meaning of the
  782. .Fl F
  783. flag, see the
  784. .Sx FORMATS
  785. section.
  786. .It Ic lock-client Op Fl t Ar target-client
  787. .D1 (alias: Ic lockc )
  788. Lock
  789. .Ar target-client ,
  790. see the
  791. .Ic lock-server
  792. command.
  793. .It Ic lock-session Op Fl t Ar target-session
  794. .D1 (alias: Ic locks )
  795. Lock all clients attached to
  796. .Ar target-session .
  797. .It Xo Ic new-session
  798. .Op Fl AdDEP
  799. .Op Fl c Ar start-directory
  800. .Op Fl F Ar format
  801. .Op Fl n Ar window-name
  802. .Op Fl s Ar session-name
  803. .Op Fl t Ar target-session
  804. .Op Fl x Ar width
  805. .Op Fl y Ar height
  806. .Op Ar shell-command
  807. .Xc
  808. .D1 (alias: Ic new )
  809. Create a new session with name
  810. .Ar session-name .
  811. .Pp
  812. The new session is attached to the current terminal unless
  813. .Fl d
  814. is given.
  815. .Ar window-name
  816. and
  817. .Ar shell-command
  818. are the name of and shell command to execute in the initial window.
  819. If
  820. .Fl d
  821. is used,
  822. .Fl x
  823. and
  824. .Fl y
  825. specify the size of the initial window (80 by 24 if not given).
  826. .Pp
  827. If run from a terminal, any
  828. .Xr termios 4
  829. special characters are saved and used for new windows in the new session.
  830. .Pp
  831. The
  832. .Fl A
  833. flag makes
  834. .Ic new-session
  835. behave like
  836. .Ic attach-session
  837. if
  838. .Ar session-name
  839. already exists; in this case,
  840. .Fl D
  841. behaves like
  842. .Fl d
  843. to
  844. .Ic attach-session .
  845. .Pp
  846. If
  847. .Fl t
  848. is given, the new session is
  849. .Em grouped
  850. with
  851. .Ar target-session .
  852. This means they share the same set of windows - all windows from
  853. .Ar target-session
  854. are linked to the new session, any new windows are linked to both sessions and
  855. any windows closed removed from both sessions.
  856. The current and previous window and any session options remain independent and
  857. either session may be killed without affecting the other.
  858. .Fl n
  859. and
  860. .Ar shell-command
  861. are invalid if
  862. .Fl t
  863. is used.
  864. .Pp
  865. The
  866. .Fl P
  867. option prints information about the new session after it has been created.
  868. By default, it uses the format
  869. .Ql #{session_name}:
  870. but a different format may be specified with
  871. .Fl F .
  872. .Pp
  873. If
  874. .Fl E
  875. is used, the
  876. .Ic update-environment
  877. option will not be applied.
  878. .It Xo Ic refresh-client
  879. .Op Fl S
  880. .Op Fl t Ar target-client
  881. .Xc
  882. .D1 (alias: Ic refresh )
  883. Refresh the current client if bound to a key, or a single client if one is given
  884. with
  885. .Fl t .
  886. If
  887. .Fl S
  888. is specified, only update the client's status bar.
  889. .It Xo Ic rename-session
  890. .Op Fl t Ar target-session
  891. .Ar new-name
  892. .Xc
  893. .D1 (alias: Ic rename )
  894. Rename the session to
  895. .Ar new-name .
  896. .It Xo Ic show-messages
  897. .Op Fl JT
  898. .Op Fl t Ar target-client
  899. .Xc
  900. .D1 (alias: Ic showmsgs )
  901. Show client messages or server information.
  902. Any messages displayed on the status line are saved in a per-client message
  903. log, up to a maximum of the limit set by the
  904. .Ar message-limit
  905. server option.
  906. With
  907. .Fl t ,
  908. display the log for
  909. .Ar target-client .
  910. .Fl J
  911. and
  912. .Fl T
  913. show debugging information about jobs and terminals.
  914. .It Ic source-file Ar path
  915. .D1 (alias: Ic source )
  916. Execute commands from
  917. .Ar path .
  918. .It Ic start-server
  919. .D1 (alias: Ic start )
  920. Start the
  921. .Nm
  922. server, if not already running, without creating any sessions.
  923. .It Xo Ic suspend-client
  924. .Op Fl t Ar target-client
  925. .Xc
  926. .D1 (alias: Ic suspendc )
  927. Suspend a client by sending
  928. .Dv SIGTSTP
  929. (tty stop).
  930. .It Xo Ic switch-client
  931. .Op Fl Elnpr
  932. .Op Fl c Ar target-client
  933. .Op Fl t Ar target-session
  934. .Op Fl T Ar key-table
  935. .Xc
  936. .D1 (alias: Ic switchc )
  937. Switch the current session for client
  938. .Ar target-client
  939. to
  940. .Ar target-session .
  941. If
  942. .Fl l ,
  943. .Fl n
  944. or
  945. .Fl p
  946. is used, the client is moved to the last, next or previous session
  947. respectively.
  948. .Fl r
  949. toggles whether a client is read-only (see the
  950. .Ic attach-session
  951. command).
  952. .Pp
  953. If
  954. .Fl E
  955. is used,
  956. .Ic update-environment
  957. option will not be applied.
  958. .Pp
  959. .Fl T
  960. sets the client's key table; the next key from the client will be interpreted from
  961. .Ar key-table .
  962. This may be used to configure multiple prefix keys, or to bind commands to
  963. sequences of keys.
  964. For example, to make typing
  965. .Ql abc
  966. run the
  967. .Ic list-keys
  968. command:
  969. .Bd -literal -offset indent
  970. bind-key -Ttable2 c list-keys
  971. bind-key -Ttable1 b switch-client -Ttable2
  972. bind-key -Troot a switch-client -Ttable1
  973. .Ed
  974. .El
  975. .Sh WINDOWS AND PANES
  976. A
  977. .Nm
  978. window may be in one of several modes.
  979. The default permits direct access to the terminal attached to the window.
  980. The other is copy mode, which permits a section of a window or its
  981. history to be copied to a
  982. .Em paste buffer
  983. for later insertion into another window.
  984. This mode is entered with the
  985. .Ic copy-mode
  986. command, bound to
  987. .Ql \&[
  988. by default.
  989. It is also entered when a command that produces output, such as
  990. .Ic list-keys ,
  991. is executed from a key binding.
  992. .Pp
  993. The keys available depend on whether emacs or vi mode is selected
  994. (see the
  995. .Ic mode-keys
  996. option).
  997. The following keys are supported as appropriate for the mode:
  998. .Bl -column "FunctionXXXXXXXXXXXXXXXXX" "viXXXXXXXXXX" "emacs" -offset indent
  999. .It Sy "Function" Ta Sy "vi" Ta Sy "emacs"
  1000. .It Li "Append selection" Ta "A" Ta ""
  1001. .It Li "Back to indentation" Ta "^" Ta "M-m"
  1002. .It Li "Bottom of history" Ta "G" Ta "M-<"
  1003. .It Li "Clear selection" Ta "Escape" Ta "C-g"
  1004. .It Li "Copy selection" Ta "Enter" Ta "M-w"
  1005. .It Li "Copy to named buffer" Ta \&" Ta ""
  1006. .It Li "Cursor down" Ta "j" Ta "Down"
  1007. .It Li "Cursor left" Ta "h" Ta "Left"
  1008. .It Li "Cursor right" Ta "l" Ta "Right"
  1009. .It Li "Cursor to bottom line" Ta "L" Ta ""
  1010. .It Li "Cursor to middle line" Ta "M" Ta "M-r"
  1011. .It Li "Cursor to top line" Ta "H" Ta "M-R"
  1012. .It Li "Cursor up" Ta "k" Ta "Up"
  1013. .It Li "Delete entire line" Ta "d" Ta "C-u"
  1014. .It Li "Delete/Copy to end of line" Ta "D" Ta "C-k"
  1015. .It Li "End of line" Ta "$" Ta "C-e"
  1016. .It Li "Go to line" Ta ":" Ta "g"
  1017. .It Li "Half page down" Ta "C-d" Ta "M-Down"
  1018. .It Li "Half page up" Ta "C-u" Ta "M-Up"
  1019. .It Li "Jump again" Ta ";" Ta ";"
  1020. .It Li "Jump again in reverse" Ta "," Ta ","
  1021. .It Li "Jump backward" Ta "F" Ta "F"
  1022. .It Li "Jump forward" Ta "f" Ta "f"
  1023. .It Li "Jump to backward" Ta "T" Ta ""
  1024. .It Li "Jump to forward" Ta "t" Ta ""
  1025. .It Li "Next page" Ta "C-f" Ta "Page down"
  1026. .It Li "Next space" Ta "W" Ta ""
  1027. .It Li "Next space, end of word" Ta "E" Ta ""
  1028. .It Li "Next word" Ta "w" Ta ""
  1029. .It Li "Next word end" Ta "e" Ta "M-f"
  1030. .It Li "Other end of selection" Ta "o" Ta ""
  1031. .It Li "Paste buffer" Ta "p" Ta "C-y"
  1032. .It Li "Previous page" Ta "C-b" Ta "Page up"
  1033. .It Li "Previous space" Ta "B" Ta ""
  1034. .It Li "Previous word" Ta "b" Ta "M-b"
  1035. .It Li "Quit mode" Ta "q" Ta "Escape"
  1036. .It Li "Rectangle toggle" Ta "v" Ta "R"
  1037. .It Li "Scroll down" Ta "C-Down or C-e" Ta "C-Down"
  1038. .It Li "Scroll up" Ta "C-Up or C-y" Ta "C-Up"
  1039. .It Li "Search again" Ta "n" Ta "n"
  1040. .It Li "Search again in reverse" Ta "N" Ta "N"
  1041. .It Li "Search backward" Ta "?" Ta "C-r"
  1042. .It Li "Search forward" Ta "/" Ta "C-s"
  1043. .It Li "Select line" Ta "V" Ta ""
  1044. .It Li "Start of line" Ta "0" Ta "C-a"
  1045. .It Li "Start selection" Ta "Space" Ta "C-Space"
  1046. .It Li "Top of history" Ta "g" Ta "M->"
  1047. .It Li "Transpose characters" Ta "" Ta "C-t"
  1048. .El
  1049. .Pp
  1050. The next and previous word keys use space and the
  1051. .Ql - ,
  1052. .Ql _
  1053. and
  1054. .Ql @
  1055. characters as word delimiters by default, but this can be adjusted by
  1056. setting the
  1057. .Em word-separators
  1058. session option.
  1059. Next word moves to the start of the next word, next word end to the end of the
  1060. next word and previous word to the start of the previous word.
  1061. The three next and previous space keys work similarly but use a space alone as
  1062. the word separator.
  1063. .Pp
  1064. The jump commands enable quick movement within a line.
  1065. For instance, typing
  1066. .Ql f
  1067. followed by
  1068. .Ql /
  1069. will move the cursor to the next
  1070. .Ql /
  1071. character on the current line.
  1072. A
  1073. .Ql \&;
  1074. will then jump to the next occurrence.
  1075. .Pp
  1076. Commands in copy mode may be prefaced by an optional repeat count.
  1077. With vi key bindings, a prefix is entered using the number keys; with
  1078. emacs, the Alt (meta) key and a number begins prefix entry.
  1079. For example, to move the cursor forward by ten words, use
  1080. .Ql M-1 0 M-f
  1081. in emacs mode, and
  1082. .Ql 10w
  1083. in vi.
  1084. .Pp
  1085. Mode key bindings are defined in a set of named tables:
  1086. .Em vi-edit
  1087. and
  1088. .Em emacs-edit
  1089. for keys used when line editing at the command prompt;
  1090. .Em vi-choice
  1091. and
  1092. .Em emacs-choice
  1093. for keys used when choosing from lists (such as produced by the
  1094. .Ic choose-window
  1095. command); and
  1096. .Em vi-copy
  1097. and
  1098. .Em emacs-copy
  1099. used in copy mode.
  1100. The tables may be viewed with the
  1101. .Ic list-keys
  1102. command and keys modified or removed with
  1103. .Ic bind-key
  1104. and
  1105. .Ic unbind-key .
  1106. If
  1107. .Ic append-selection ,
  1108. .Ic copy-selection ,
  1109. or
  1110. .Ic start-named-buffer
  1111. are given the
  1112. .Fl x
  1113. flag,
  1114. .Nm
  1115. will not exit copy mode after copying.
  1116. .Ic copy-pipe
  1117. copies the selection and pipes it to a command.
  1118. For example the following will bind
  1119. .Ql C-w
  1120. not to exit after copying and
  1121. .Ql C-q
  1122. to copy the selection into
  1123. .Pa /tmp
  1124. as well as the paste buffer:
  1125. .Bd -literal -offset indent
  1126. bind-key -temacs-copy C-w copy-selection -x
  1127. bind-key -temacs-copy C-q copy-pipe "cat >/tmp/out"
  1128. .Ed
  1129. .Pp
  1130. The paste buffer key pastes the first line from the top paste buffer on the
  1131. stack.
  1132. .Pp
  1133. The synopsis for the
  1134. .Ic copy-mode
  1135. command is:
  1136. .Bl -tag -width Ds
  1137. .It Xo Ic copy-mode
  1138. .Op Fl Meu
  1139. .Op Fl t Ar target-pane
  1140. .Xc
  1141. Enter copy mode.
  1142. The
  1143. .Fl u
  1144. option scrolls one page up.
  1145. .Fl M
  1146. begins a mouse drag (only valid if bound to a mouse key binding, see
  1147. .Sx MOUSE SUPPORT ) .
  1148. .Fl e
  1149. specifies that scrolling to the bottom of the history (to the visible screen)
  1150. should exit copy mode.
  1151. While in copy mode, pressing a key other than those used for scrolling will
  1152. disable this behaviour.
  1153. This is intended to allow fast scrolling through a pane's history, for
  1154. example with:
  1155. .Bd -literal -offset indent
  1156. bind PageUp copy-mode -eu
  1157. .Ed
  1158. .El
  1159. .Pp
  1160. Each window displayed by
  1161. .Nm
  1162. may be split into one or more
  1163. .Em panes ;
  1164. each pane takes up a certain area of the display and is a separate terminal.
  1165. A window may be split into panes using the
  1166. .Ic split-window
  1167. command.
  1168. Windows may be split horizontally (with the
  1169. .Fl h
  1170. flag) or vertically.
  1171. Panes may be resized with the
  1172. .Ic resize-pane
  1173. command (bound to
  1174. .Ql C-up ,
  1175. .Ql C-down
  1176. .Ql C-left
  1177. and
  1178. .Ql C-right
  1179. by default), the current pane may be changed with the
  1180. .Ic select-pane
  1181. command and the
  1182. .Ic rotate-window
  1183. and
  1184. .Ic swap-pane
  1185. commands may be used to swap panes without changing their position.
  1186. Panes are numbered beginning from zero in the order they are created.
  1187. .Pp
  1188. A number of preset
  1189. .Em layouts
  1190. are available.
  1191. These may be selected with the
  1192. .Ic select-layout
  1193. command or cycled with
  1194. .Ic next-layout
  1195. (bound to
  1196. .Ql Space
  1197. by default); once a layout is chosen, panes within it may be moved and resized
  1198. as normal.
  1199. .Pp
  1200. The following layouts are supported:
  1201. .Bl -tag -width Ds
  1202. .It Ic even-horizontal
  1203. Panes are spread out evenly from left to right across the window.
  1204. .It Ic even-vertical
  1205. Panes are spread evenly from top to bottom.
  1206. .It Ic main-horizontal
  1207. A large (main) pane is shown at the top of the window and the remaining panes
  1208. are spread from left to right in the leftover space at the bottom.
  1209. Use the
  1210. .Em main-pane-height
  1211. window option to specify the height of the top pane.
  1212. .It Ic main-vertical
  1213. Similar to
  1214. .Ic main-horizontal
  1215. but the large pane is placed on the left and the others spread from top to
  1216. bottom along the right.
  1217. See the
  1218. .Em main-pane-width
  1219. window option.
  1220. .It Ic tiled
  1221. Panes are spread out as evenly as possible over the window in both rows and
  1222. columns.
  1223. .El
  1224. .Pp
  1225. In addition,
  1226. .Ic select-layout
  1227. may be used to apply a previously used layout - the
  1228. .Ic list-windows
  1229. command displays the layout of each window in a form suitable for use with
  1230. .Ic select-layout .
  1231. For example:
  1232. .Bd -literal -offset indent
  1233. $ tmux list-windows
  1234. 0: ksh [159x48]
  1235. layout: bb62,159x48,0,0{79x48,0,0,79x48,80,0}
  1236. $ tmux select-layout bb62,159x48,0,0{79x48,0,0,79x48,80,0}
  1237. .Ed
  1238. .Pp
  1239. .Nm
  1240. automatically adjusts the size of the layout for the current window size.
  1241. Note that a layout cannot be applied to a window with more panes than that
  1242. from which the layout was originally defined.
  1243. .Pp
  1244. Commands related to windows and panes are as follows:
  1245. .Bl -tag -width Ds
  1246. .It Xo Ic break-pane
  1247. .Op Fl dP
  1248. .Op Fl F Ar format
  1249. .Op Fl s Ar src-pane
  1250. .Op Fl t Ar dst-window
  1251. .Xc
  1252. .D1 (alias: Ic breakp )
  1253. Break
  1254. .Ar src-pane
  1255. off from its containing window to make it the only pane in
  1256. .Ar dst-window .
  1257. If
  1258. .Fl d
  1259. is given, the new window does not become the current window.
  1260. The
  1261. .Fl P
  1262. option prints information about the new window after it has been created.
  1263. By default, it uses the format
  1264. .Ql #{session_name}:#{window_index}
  1265. but a different format may be specified with
  1266. .Fl F .
  1267. .It Xo Ic capture-pane
  1268. .Op Fl aepPq
  1269. .Op Fl b Ar buffer-name
  1270. .Op Fl E Ar end-line
  1271. .Op Fl S Ar start-line
  1272. .Op Fl t Ar target-pane
  1273. .Xc
  1274. .D1 (alias: Ic capturep )
  1275. Capture the contents of a pane.
  1276. If
  1277. .Fl p
  1278. is given, the output goes to stdout, otherwise to the buffer specified with
  1279. .Fl b
  1280. or a new buffer if omitted.
  1281. If
  1282. .Fl a
  1283. is given, the alternate screen is used, and the history is not accessible.
  1284. If no alternate screen exists, an error will be returned unless
  1285. .Fl q
  1286. is given.
  1287. If
  1288. .Fl e
  1289. is given, the output includes escape sequences for text and background
  1290. attributes.
  1291. .Fl C
  1292. also escapes non-printable characters as octal \exxx.
  1293. .Fl J
  1294. joins wrapped lines and preserves trailing spaces at each line's end.
  1295. .Fl P
  1296. captures only any output that the pane has received that is the beginning of an
  1297. as-yet incomplete escape sequence.
  1298. .Pp
  1299. .Fl S
  1300. and
  1301. .Fl E
  1302. specify the starting and ending line numbers, zero is the first line of the
  1303. visible pane and negative numbers are lines in the history.
  1304. .Ql -
  1305. to
  1306. .Fl S
  1307. is the start of the history and to
  1308. .Fl E
  1309. the end of the visible pane.
  1310. The default is to capture only the visible contents of the pane.
  1311. .It Xo
  1312. .Ic choose-client
  1313. .Op Fl F Ar format
  1314. .Op Fl t Ar target-window
  1315. .Op Ar template
  1316. .Xc
  1317. Put a window into client choice mode, allowing a client to be selected
  1318. interactively from a list.
  1319. After a client is chosen,
  1320. .Ql %%
  1321. is replaced by the client
  1322. .Xr pty 4
  1323. path in
  1324. .Ar template
  1325. and the result executed as a command.
  1326. If
  1327. .Ar template
  1328. is not given, "detach-client -t '%%'" is used.
  1329. For the meaning of the
  1330. .Fl F
  1331. flag, see the
  1332. .Sx FORMATS
  1333. section.
  1334. This command works only if at least one client is attached.
  1335. .It Xo
  1336. .Ic choose-session
  1337. .Op Fl F Ar format
  1338. .Op Fl t Ar target-window
  1339. .Op Ar template
  1340. .Xc
  1341. Put a window into session choice mode, where a session may be selected
  1342. interactively from a list.
  1343. When one is chosen,
  1344. .Ql %%
  1345. is replaced by the session name in
  1346. .Ar template
  1347. and the result executed as a command.
  1348. If
  1349. .Ar template
  1350. is not given, "switch-client -t '%%'" is used.
  1351. For the meaning of the
  1352. .Fl F
  1353. flag, see the
  1354. .Sx FORMATS
  1355. section.
  1356. This command works only if at least one client is attached.
  1357. .It Xo
  1358. .Ic choose-tree
  1359. .Op Fl suw
  1360. .Op Fl b Ar session-template
  1361. .Op Fl c Ar window-template
  1362. .Op Fl S Ar format
  1363. .Op Fl W Ar format
  1364. .Op Fl t Ar target-window
  1365. .Xc
  1366. Put a window into tree choice mode, where either sessions or windows may be
  1367. selected interactively from a list.
  1368. By default, windows belonging to a session are indented to show their
  1369. relationship to a session.
  1370. .Pp
  1371. Note that the
  1372. .Ic choose-window
  1373. and
  1374. .Ic choose-session
  1375. commands are wrappers around
  1376. .Ic choose-tree .
  1377. .Pp
  1378. If
  1379. .Fl s
  1380. is given, will show sessions.
  1381. If
  1382. .Fl w
  1383. is given, will show windows.
  1384. .Pp
  1385. By default, the tree is collapsed and sessions must be expanded to windows
  1386. with the right arrow key.
  1387. The
  1388. .Fl u
  1389. option will start with all sessions expanded instead.
  1390. .Pp
  1391. If
  1392. .Fl b
  1393. is given, will override the default session command.
  1394. Note that
  1395. .Ql %%
  1396. can be used and will be replaced with the session name.
  1397. The default option if not specified is "switch-client -t '%%'".
  1398. If
  1399. .Fl c
  1400. is given, will override the default window command.
  1401. Like
  1402. .Fl b ,
  1403. .Ql %%
  1404. can be used and will be replaced with the session name and window index.
  1405. When a window is chosen from the list, the session command is run before the
  1406. window command.
  1407. .Pp
  1408. If
  1409. .Fl S
  1410. is given will display the specified format instead of the default session
  1411. format.
  1412. If
  1413. .Fl W
  1414. is given will display the specified format instead of the default window
  1415. format.
  1416. For the meaning of the
  1417. .Fl s
  1418. and
  1419. .Fl w
  1420. options, see the
  1421. .Sx FORMATS
  1422. section.
  1423. .Pp
  1424. This command works only if at least one client is attached.
  1425. .It Xo
  1426. .Ic choose-window
  1427. .Op Fl F Ar format
  1428. .Op Fl t Ar target-window
  1429. .Op Ar template
  1430. .Xc
  1431. Put a window into window choice mode, where a window may be chosen
  1432. interactively from a list.
  1433. After a window is selected,
  1434. .Ql %%
  1435. is replaced by the session name and window index in
  1436. .Ar template
  1437. and the result executed as a command.
  1438. If
  1439. .Ar template
  1440. is not given, "select-window -t '%%'" is used.
  1441. For the meaning of the
  1442. .Fl F
  1443. flag, see the
  1444. .Sx FORMATS
  1445. section.
  1446. This command works only if at least one client is attached.
  1447. .It Ic display-panes Op Fl t Ar target-client
  1448. .D1 (alias: Ic displayp )
  1449. Display a visible indicator of each pane shown by
  1450. .Ar target-client .
  1451. See the
  1452. .Ic display-panes-time ,
  1453. .Ic display-panes-colour ,
  1454. and
  1455. .Ic display-panes-active-colour
  1456. session options.
  1457. While the indicator is on screen, a pane may be selected with the
  1458. .Ql 0
  1459. to
  1460. .Ql 9
  1461. keys.
  1462. .It Xo Ic find-window
  1463. .Op Fl CNT
  1464. .Op Fl F Ar format
  1465. .Op Fl t Ar target-window
  1466. .Ar match-string
  1467. .Xc
  1468. .D1 (alias: Ic findw )
  1469. Search for the
  1470. .Xr fnmatch 3
  1471. pattern
  1472. .Ar match-string
  1473. in window names, titles, and visible content (but not history).
  1474. The flags control matching behavior:
  1475. .Fl C
  1476. matches only visible window contents,
  1477. .Fl N
  1478. matches only the window name and
  1479. .Fl T
  1480. matches only the window title.
  1481. The default is
  1482. .Fl CNT .
  1483. If only one window is matched, it'll be automatically selected,
  1484. otherwise a choice list is shown.
  1485. For the meaning of the
  1486. .Fl F
  1487. flag, see the
  1488. .Sx FORMATS
  1489. section.
  1490. This command works only if at least one client is attached.
  1491. .It Xo Ic join-pane
  1492. .Op Fl bdhv
  1493. .Oo Fl l
  1494. .Ar size |
  1495. .Fl p Ar percentage Oc
  1496. .Op Fl s Ar src-pane
  1497. .Op Fl t Ar dst-pane
  1498. .Xc
  1499. .D1 (alias: Ic joinp )
  1500. Like
  1501. .Ic split-window ,
  1502. but instead of splitting
  1503. .Ar dst-pane
  1504. and creating a new pane, split it and move
  1505. .Ar src-pane
  1506. into the space.
  1507. This can be used to reverse
  1508. .Ic break-pane .
  1509. The
  1510. .Fl b
  1511. option causes
  1512. .Ar src-pane
  1513. to be joined to left of or above
  1514. .Ar dst-pane .
  1515. .Pp
  1516. If
  1517. .Fl s
  1518. is omitted and a marked pane is present (see
  1519. .Ic select-pane
  1520. .Fl m ) ,
  1521. the marked pane is used rather than the current pane.
  1522. .It Xo Ic kill-pane
  1523. .Op Fl a
  1524. .Op Fl t Ar target-pane
  1525. .Xc
  1526. .D1 (alias: Ic killp )
  1527. Destroy the given pane.
  1528. If no panes remain in the containing window, it is also destroyed.
  1529. The
  1530. .Fl a
  1531. option kills all but the pane given with
  1532. .Fl t .
  1533. .It Xo Ic kill-window
  1534. .Op Fl a
  1535. .Op Fl t Ar target-window
  1536. .Xc
  1537. .D1 (alias: Ic killw )
  1538. Kill the current window or the window at
  1539. .Ar target-window ,
  1540. removing it from any sessions to which it is linked.
  1541. The
  1542. .Fl a
  1543. option kills all but the window given with
  1544. .Fl t .
  1545. .It Xo Ic last-pane
  1546. .Op Fl de
  1547. .Op Fl t Ar target-window
  1548. .Xc
  1549. .D1 (alias: Ic lastp )
  1550. Select the last (previously selected) pane.
  1551. .Fl e
  1552. enables or
  1553. .Fl d
  1554. disables input to the pane.
  1555. .It Ic last-window Op Fl t Ar target-session
  1556. .D1 (alias: Ic last )
  1557. Select the last (previously selected) window.
  1558. If no
  1559. .Ar target-session
  1560. is specified, select the last window of the current session.
  1561. .It Xo Ic link-window
  1562. .Op Fl adk
  1563. .Op Fl s Ar src-window
  1564. .Op Fl t Ar dst-window
  1565. .Xc
  1566. .D1 (alias: Ic linkw )
  1567. Link the window at
  1568. .Ar src-window
  1569. to the specified
  1570. .Ar dst-window .
  1571. If
  1572. .Ar dst-window
  1573. is specified and no such window exists, the
  1574. .Ar src-window
  1575. is linked there.
  1576. With
  1577. .Fl a ,
  1578. the window is moved to the next index up (following windows
  1579. are moved if necessary).
  1580. If
  1581. .Fl k
  1582. is given and
  1583. .Ar dst-window
  1584. exists, it is killed, otherwise an error is generated.
  1585. If
  1586. .Fl d
  1587. is given, the newly linked window is not selected.
  1588. .It Xo Ic list-panes
  1589. .Op Fl as
  1590. .Op Fl F Ar format
  1591. .Op Fl t Ar target
  1592. .Xc
  1593. .D1 (alias: Ic lsp )
  1594. If
  1595. .Fl a
  1596. is given,
  1597. .Ar target
  1598. is ignored and all panes on the server are listed.
  1599. If
  1600. .Fl s
  1601. is given,
  1602. .Ar target
  1603. is a session (or the current session).
  1604. If neither is given,
  1605. .Ar target
  1606. is a window (or the current window).
  1607. For the meaning of the
  1608. .Fl F
  1609. flag, see the
  1610. .Sx FORMATS
  1611. section.
  1612. .It Xo Ic list-windows
  1613. .Op Fl a
  1614. .Op Fl F Ar format
  1615. .Op Fl t Ar target-session
  1616. .Xc
  1617. .D1 (alias: Ic lsw )
  1618. If
  1619. .Fl a
  1620. is given, list all windows on the server.
  1621. Otherwise, list windows in the current session or in
  1622. .Ar target-session .
  1623. For the meaning of the
  1624. .Fl F
  1625. flag, see the
  1626. .Sx FORMATS
  1627. section.
  1628. .It Xo Ic move-pane
  1629. .Op Fl bdhv
  1630. .Oo Fl l
  1631. .Ar size |
  1632. .Fl p Ar percentage Oc
  1633. .Op Fl s Ar src-pane
  1634. .Op Fl t Ar dst-pane
  1635. .Xc
  1636. .D1 (alias: Ic movep )
  1637. Like
  1638. .Ic join-pane ,
  1639. but
  1640. .Ar src-pane
  1641. and
  1642. .Ar dst-pane
  1643. may belong to the same window.
  1644. .It Xo Ic move-window
  1645. .Op Fl ardk
  1646. .Op Fl s Ar src-window
  1647. .Op Fl t Ar dst-window
  1648. .Xc
  1649. .D1 (alias: Ic movew )
  1650. This is similar to
  1651. .Ic link-window ,
  1652. except the window at
  1653. .Ar src-window
  1654. is moved to
  1655. .Ar dst-window .
  1656. With
  1657. .Fl r ,
  1658. all windows in the session are renumbered in sequential order, respecting
  1659. the
  1660. .Ic base-index
  1661. option.
  1662. .It Xo Ic new-window
  1663. .Op Fl adkP
  1664. .Op Fl c Ar start-directory
  1665. .Op Fl F Ar format
  1666. .Op Fl n Ar window-name
  1667. .Op Fl t Ar target-window
  1668. .Op Ar shell-command
  1669. .Xc
  1670. .D1 (alias: Ic neww )
  1671. Create a new window.
  1672. With
  1673. .Fl a ,
  1674. the new window is inserted at the next index up from the specified
  1675. .Ar target-window ,
  1676. moving windows up if necessary,
  1677. otherwise
  1678. .Ar target-window
  1679. is the new window location.
  1680. .Pp
  1681. If
  1682. .Fl d
  1683. is given, the session does not make the new window the current window.
  1684. .Ar target-window
  1685. represents the window to be created; if the target already exists an error is
  1686. shown, unless the
  1687. .Fl k
  1688. flag is used, in which case it is destroyed.
  1689. .Ar shell-command
  1690. is the command to execute.
  1691. If
  1692. .Ar shell-command
  1693. is not specified, the value of the
  1694. .Ic default-command
  1695. option is used.
  1696. .Fl c
  1697. specifies the working directory in which the new window is created.
  1698. .Pp
  1699. When the shell command completes, the window closes.
  1700. See the
  1701. .Ic remain-on-exit
  1702. option to change this behaviour.
  1703. .Pp
  1704. The
  1705. .Ev TERM
  1706. environment variable must be set to
  1707. .Dq screen
  1708. for all programs running
  1709. .Em inside
  1710. .Nm .
  1711. New windows will automatically have
  1712. .Dq TERM=screen
  1713. added to their environment, but care must be taken not to reset this in shell
  1714. start-up files.
  1715. .Pp
  1716. The
  1717. .Fl P
  1718. option prints information about the new window after it has been created.
  1719. By default, it uses the format
  1720. .Ql #{session_name}:#{window_index}
  1721. but a different format may be specified with
  1722. .Fl F .
  1723. .It Ic next-layout Op Fl t Ar target-window
  1724. .D1 (alias: Ic nextl )
  1725. Move a window to the next layout and rearrange the panes to fit.
  1726. .It Xo Ic next-window
  1727. .Op Fl a
  1728. .Op Fl t Ar target-session
  1729. .Xc
  1730. .D1 (alias: Ic next )
  1731. Move to the next window in the session.
  1732. If
  1733. .Fl a
  1734. is used, move to the next window with an alert.
  1735. .It Xo Ic pipe-pane
  1736. .Op Fl o
  1737. .Op Fl t Ar target-pane
  1738. .Op Ar shell-command
  1739. .Xc
  1740. .D1 (alias: Ic pipep )
  1741. Pipe any output sent by the program in
  1742. .Ar target-pane
  1743. to a shell command.
  1744. A pane may only be piped to one command at a time, any existing pipe is
  1745. closed before
  1746. .Ar shell-command
  1747. is executed.
  1748. The
  1749. .Ar shell-command
  1750. string may contain the special character sequences supported by the
  1751. .Ic status-left
  1752. option.
  1753. If no
  1754. .Ar shell-command
  1755. is given, the current pipe (if any) is closed.
  1756. .Pp
  1757. The
  1758. .Fl o
  1759. option only opens a new pipe if no previous pipe exists, allowing a pipe to
  1760. be toggled with a single key, for example:
  1761. .Bd -literal -offset indent
  1762. bind-key C-p pipe-pane -o 'cat >>~/output.#I-#P'
  1763. .Ed
  1764. .It Xo Ic previous-layout
  1765. .Op Fl t Ar target-window
  1766. .Xc
  1767. .D1 (alias: Ic prevl )
  1768. Move to the previous layout in the session.
  1769. .It Xo Ic previous-window
  1770. .Op Fl a
  1771. .Op Fl t Ar target-session
  1772. .Xc
  1773. .D1 (alias: Ic prev )
  1774. Move to the previous window in the session.
  1775. With
  1776. .Fl a ,
  1777. move to the previous window with an alert.
  1778. .It Xo Ic rename-window
  1779. .Op Fl t Ar target-window
  1780. .Ar new-name
  1781. .Xc
  1782. .D1 (alias: Ic renamew )
  1783. Rename the current window, or the window at
  1784. .Ar target-window
  1785. if specified, to
  1786. .Ar new-name .
  1787. .It Xo Ic resize-pane
  1788. .Op Fl DLMRUZ
  1789. .Op Fl t Ar target-pane
  1790. .Op Fl x Ar width
  1791. .Op Fl y Ar height
  1792. .Op Ar adjustment
  1793. .Xc
  1794. .D1 (alias: Ic resizep )
  1795. Resize a pane, up, down, left or right by
  1796. .Ar adjustment
  1797. with
  1798. .Fl U ,
  1799. .Fl D ,
  1800. .Fl L
  1801. or
  1802. .Fl R ,
  1803. or
  1804. to an absolute size
  1805. with
  1806. .Fl x
  1807. or
  1808. .Fl y .
  1809. The
  1810. .Ar adjustment
  1811. is given in lines or cells (the default is 1).
  1812. .Pp
  1813. With
  1814. .Fl Z ,
  1815. the active pane is toggled between zoomed (occupying the whole of the window)
  1816. and unzoomed (its normal position in the layout).
  1817. .Pp
  1818. .Fl M
  1819. begins mouse resizing (only valid if bound to a mouse key binding, see
  1820. .Sx MOUSE SUPPORT ) .
  1821. .It Xo Ic respawn-pane
  1822. .Op Fl k
  1823. .Op Fl t Ar target-pane
  1824. .Op Ar shell-command
  1825. .Xc
  1826. .D1 (alias: Ic respawnp )
  1827. Reactivate a pane in which the command has exited (see the
  1828. .Ic remain-on-exit
  1829. window option).
  1830. If
  1831. .Ar shell-command
  1832. is not given, the command used when the pane was created is executed.
  1833. The pane must be already inactive, unless
  1834. .Fl k
  1835. is given, in which case any existing command is killed.
  1836. .It Xo Ic respawn-window
  1837. .Op Fl k
  1838. .Op Fl t Ar target-window
  1839. .Op Ar shell-command
  1840. .Xc
  1841. .D1 (alias: Ic respawnw )
  1842. Reactivate a window in which the command has exited (see the
  1843. .Ic remain-on-exit
  1844. window option).
  1845. If
  1846. .Ar shell-command
  1847. is not given, the command used when the window was created is executed.
  1848. The window must be already inactive, unless
  1849. .Fl k
  1850. is given, in which case any existing command is killed.
  1851. .It Xo Ic rotate-window
  1852. .Op Fl DU
  1853. .Op Fl t Ar target-window
  1854. .Xc
  1855. .D1 (alias: Ic rotatew )
  1856. Rotate the positions of the panes within a window, either upward (numerically
  1857. lower) with
  1858. .Fl U
  1859. or downward (numerically higher).
  1860. .It Xo Ic select-layout
  1861. .Op Fl nop
  1862. .Op Fl t Ar target-window
  1863. .Op Ar layout-name
  1864. .Xc
  1865. .D1 (alias: Ic selectl )
  1866. Choose a specific layout for a window.
  1867. If
  1868. .Ar layout-name
  1869. is not given, the last preset layout used (if any) is reapplied.
  1870. .Fl n
  1871. and
  1872. .Fl p
  1873. are equivalent to the
  1874. .Ic next-layout
  1875. and
  1876. .Ic previous-layout
  1877. commands.
  1878. .Fl o
  1879. applies the last set layout if possible (undoes the most recent layout change).
  1880. .It Xo Ic select-pane
  1881. .Op Fl DdegLlMmRU
  1882. .Op Fl P Ar style
  1883. .Op Fl t Ar target-pane
  1884. .Xc
  1885. .D1 (alias: Ic selectp )
  1886. Make pane
  1887. .Ar target-pane
  1888. the active pane in window
  1889. .Ar target-window ,
  1890. or set its style (with
  1891. .Fl P ) .
  1892. If one of
  1893. .Fl D ,
  1894. .Fl L ,
  1895. .Fl R ,
  1896. or
  1897. .Fl U
  1898. is used, respectively the pane below, to the left, to the right, or above the
  1899. target pane is used.
  1900. .Fl l
  1901. is the same as using the
  1902. .Ic last-pane
  1903. command.
  1904. .Fl e
  1905. enables or
  1906. .Fl d
  1907. disables input to the pane.
  1908. .Pp
  1909. .Fl m
  1910. and
  1911. .Fl M
  1912. are used to set and clear the
  1913. .Em marked pane .
  1914. There is one marked pane at a time, setting a new marked pane clears the last.
  1915. The marked pane is the default target for
  1916. .Fl s
  1917. to
  1918. .Ic join-pane ,
  1919. .Ic swap-pane
  1920. and
  1921. .Ic swap-window .
  1922. .Pp
  1923. Each pane has a style: by default the
  1924. .Ic window-style
  1925. and
  1926. .Ic window-active-style
  1927. options are used,
  1928. .Ic select-pane
  1929. .Fl P
  1930. sets the style for a single pane.
  1931. For example, to set the pane 1 background to red:
  1932. .Bd -literal -offset indent
  1933. select-pane -t:.1 -P 'bg=red'
  1934. .Ed
  1935. .Pp
  1936. .Fl g
  1937. shows the current pane style.
  1938. .It Xo Ic select-window
  1939. .Op Fl lnpT
  1940. .Op Fl t Ar target-window
  1941. .Xc
  1942. .D1 (alias: Ic selectw )
  1943. Select the window at
  1944. .Ar target-window .
  1945. .Fl l ,
  1946. .Fl n
  1947. and
  1948. .Fl p
  1949. are equivalent to the
  1950. .Ic last-window ,
  1951. .Ic next-window
  1952. and
  1953. .Ic previous-window
  1954. commands.
  1955. If
  1956. .Fl T
  1957. is given and the selected window is already the current window,
  1958. the command behaves like
  1959. .Ic last-window .
  1960. .It Xo Ic split-window
  1961. .Op Fl bdhvP
  1962. .Op Fl c Ar start-directory
  1963. .Oo Fl l
  1964. .Ar size |
  1965. .Fl p Ar percentage Oc
  1966. .Op Fl t Ar target-pane
  1967. .Op Ar shell-command
  1968. .Op Fl F Ar format
  1969. .Xc
  1970. .D1 (alias: Ic splitw )
  1971. Create a new pane by splitting
  1972. .Ar target-pane :
  1973. .Fl h
  1974. does a horizontal split and
  1975. .Fl v
  1976. a vertical split; if neither is specified,
  1977. .Fl v
  1978. is assumed.
  1979. The
  1980. .Fl l
  1981. and
  1982. .Fl p
  1983. options specify the size of the new pane in lines (for vertical split) or in
  1984. cells (for horizontal split), or as a percentage, respectively.
  1985. The
  1986. .Fl b
  1987. option causes the new pane to be created to the left of or above
  1988. .Ar target-pane .
  1989. All other options have the same meaning as for the
  1990. .Ic new-window
  1991. command.
  1992. .It Xo Ic swap-pane
  1993. .Op Fl dDU
  1994. .Op Fl s Ar src-pane
  1995. .Op Fl t Ar dst-pane
  1996. .Xc
  1997. .D1 (alias: Ic swapp )
  1998. Swap two panes.
  1999. If
  2000. .Fl U
  2001. is used and no source pane is specified with
  2002. .Fl s ,
  2003. .Ar dst-pane
  2004. is swapped with the previous pane (before it numerically);
  2005. .Fl D
  2006. swaps with the next pane (after it numerically).
  2007. .Fl d
  2008. instructs
  2009. .Nm
  2010. not to change the active pane.
  2011. .Pp
  2012. If
  2013. .Fl s
  2014. is omitted and a marked pane is present (see
  2015. .Ic select-pane
  2016. .Fl m ) ,
  2017. the marked pane is used rather than the current pane.
  2018. .It Xo Ic swap-window
  2019. .Op Fl d
  2020. .Op Fl s Ar src-window
  2021. .Op Fl t Ar dst-window
  2022. .Xc
  2023. .D1 (alias: Ic swapw )
  2024. This is similar to
  2025. .Ic link-window ,
  2026. except the source and destination windows are swapped.
  2027. It is an error if no window exists at
  2028. .Ar src-window .
  2029. .Pp
  2030. Like
  2031. .Ic swap-pane ,
  2032. if
  2033. .Fl s
  2034. is omitted and a marked pane is present (see
  2035. .Ic select-pane
  2036. .Fl m ) ,
  2037. the window containing the marked pane is used rather than the current window.
  2038. .It Xo Ic unlink-window
  2039. .Op Fl k
  2040. .Op Fl t Ar target-window
  2041. .Xc
  2042. .D1 (alias: Ic unlinkw )
  2043. Unlink
  2044. .Ar target-window .
  2045. Unless
  2046. .Fl k
  2047. is given, a window may be unlinked only if it is linked to multiple sessions -
  2048. windows may not be linked to no sessions;
  2049. if
  2050. .Fl k
  2051. is specified and the window is linked to only one session, it is unlinked and
  2052. destroyed.
  2053. .El
  2054. .Sh KEY BINDINGS
  2055. .Nm
  2056. allows a command to be bound to most keys, with or without a prefix key.
  2057. When specifying keys, most represent themselves (for example
  2058. .Ql A
  2059. to
  2060. .Ql Z ) .
  2061. Ctrl keys may be prefixed with
  2062. .Ql C-
  2063. or
  2064. .Ql ^ ,
  2065. and Alt (meta) with
  2066. .Ql M- .
  2067. In addition, the following special key names are accepted:
  2068. .Em Up ,
  2069. .Em Down ,
  2070. .Em Left ,
  2071. .Em Right ,
  2072. .Em BSpace ,
  2073. .Em BTab ,
  2074. .Em DC
  2075. (Delete),
  2076. .Em End ,
  2077. .Em Enter ,
  2078. .Em Escape ,
  2079. .Em F1
  2080. to
  2081. .Em F12 ,
  2082. .Em Home ,
  2083. .Em IC
  2084. (Insert),
  2085. .Em NPage/PageDown/PgDn ,
  2086. .Em PPage/PageUp/PgUp ,
  2087. .Em Space ,
  2088. and
  2089. .Em Tab .
  2090. Note that to bind the
  2091. .Ql \&"
  2092. or
  2093. .Ql '
  2094. keys, quotation marks are necessary, for example:
  2095. .Bd -literal -offset indent
  2096. bind-key '"' split-window
  2097. bind-key "'" new-window
  2098. .Ed
  2099. .Pp
  2100. Commands related to key bindings are as follows:
  2101. .Bl -tag -width Ds
  2102. .It Xo Ic bind-key
  2103. .Op Fl cnr
  2104. .Op Fl t Ar mode-table
  2105. .Op Fl T Ar key-table
  2106. .Ar key Ar command Op Ar arguments
  2107. .Xc
  2108. .D1 (alias: Ic bind )
  2109. Bind key
  2110. .Ar key
  2111. to
  2112. .Ar command .
  2113. Keys are bound in a key table.
  2114. By default (without -T), the key is bound in
  2115. the
  2116. .Em prefix
  2117. key table.
  2118. This table is used for keys pressed after the prefix key (for example,
  2119. by default
  2120. .Ql c
  2121. is bound to
  2122. .Ic new-window
  2123. in the
  2124. .Em prefix
  2125. table, so
  2126. .Ql C-b c
  2127. creates a new window).
  2128. The
  2129. .Em root
  2130. table is used for keys pressed without the prefix key: binding
  2131. .Ql c
  2132. to
  2133. .Ic new-window
  2134. in the
  2135. .Em root
  2136. table (not recommended) means a plain
  2137. .Ql c
  2138. will create a new window.
  2139. .Fl n
  2140. is an alias
  2141. for
  2142. .Fl T Ar root .
  2143. Keys may also be bound in custom key tables and the
  2144. .Ic switch-client
  2145. .Fl T
  2146. command used to switch to them from a key binding.
  2147. The
  2148. .Fl r
  2149. flag indicates this key may repeat, see the
  2150. .Ic repeat-time
  2151. option.
  2152. .Pp
  2153. If
  2154. .Fl t
  2155. is present,
  2156. .Ar key
  2157. is bound in
  2158. .Ar mode-table :
  2159. the binding for command mode with
  2160. .Fl c
  2161. or for normal mode without.
  2162. See the
  2163. .Sx WINDOWS AND PANES
  2164. section and the
  2165. .Ic list-keys
  2166. command for information on mode key bindings.
  2167. .Pp
  2168. To view the default bindings and possible commands, see the
  2169. .Ic list-keys
  2170. command.
  2171. .It Xo Ic list-keys
  2172. .Op Fl t Ar mode-table
  2173. .Op Fl T Ar key-table
  2174. .Xc
  2175. .D1 (alias: Ic lsk )
  2176. List all key bindings.
  2177. Without
  2178. .Fl T
  2179. all key tables are printed.
  2180. With
  2181. .Fl T
  2182. only
  2183. .Ar key-table .
  2184. .Pp
  2185. With
  2186. .Fl t ,
  2187. the key bindings in
  2188. .Ar mode-table
  2189. are listed; this may be one of:
  2190. .Em vi-edit ,
  2191. .Em emacs-edit ,
  2192. .Em vi-choice ,
  2193. .Em emacs-choice ,
  2194. .Em vi-copy
  2195. or
  2196. .Em emacs-copy .
  2197. .It Xo Ic send-keys
  2198. .Op Fl lMR
  2199. .Op Fl t Ar target-pane
  2200. .Ar key Ar ...
  2201. .Xc
  2202. .D1 (alias: Ic send )
  2203. Send a key or keys to a window.
  2204. Each argument
  2205. .Ar key
  2206. is the name of the key (such as
  2207. .Ql C-a
  2208. or
  2209. .Ql npage
  2210. ) to send; if the string is not recognised as a key, it is sent as a series of
  2211. characters.
  2212. The
  2213. .Fl l
  2214. flag disables key name lookup and sends the keys literally.
  2215. All arguments are sent sequentially from first to last.
  2216. The
  2217. .Fl R
  2218. flag causes the terminal state to be reset.
  2219. .Pp
  2220. .Fl M
  2221. passes through a mouse event (only valid if bound to a mouse key binding, see
  2222. .Sx MOUSE SUPPORT ) .
  2223. .It Xo Ic send-prefix
  2224. .Op Fl 2
  2225. .Op Fl t Ar target-pane
  2226. .Xc
  2227. Send the prefix key, or with
  2228. .Fl 2
  2229. the secondary prefix key, to a window as if it was pressed.
  2230. .It Xo Ic unbind-key
  2231. .Op Fl acn
  2232. .Op Fl t Ar mode-table
  2233. .Op Fl T Ar key-table
  2234. .Ar key
  2235. .Xc
  2236. .D1 (alias: Ic unbind )
  2237. Unbind the command bound to
  2238. .Ar key .
  2239. .Fl c ,
  2240. .Fl n ,
  2241. .Fl T
  2242. and
  2243. .Fl t
  2244. are the same as for
  2245. .Ic bind-key .
  2246. If
  2247. .Fl a
  2248. is present, all key bindings are removed.
  2249. .El
  2250. .Sh OPTIONS
  2251. The appearance and behaviour of
  2252. .Nm
  2253. may be modified by changing the value of various options.
  2254. There are three types of option:
  2255. .Em server options ,
  2256. .Em session options
  2257. and
  2258. .Em window options .
  2259. .Pp
  2260. The
  2261. .Nm
  2262. server has a set of global options which do not apply to any particular
  2263. window or session.
  2264. These are altered with the
  2265. .Ic set-option
  2266. .Fl s
  2267. command, or displayed with the
  2268. .Ic show-options
  2269. .Fl s
  2270. command.
  2271. .Pp
  2272. In addition, each individual session may have a set of session options, and
  2273. there is a separate set of global session options.
  2274. Sessions which do not have a particular option configured inherit the value
  2275. from the global session options.
  2276. Session options are set or unset with the
  2277. .Ic set-option
  2278. command and may be listed with the
  2279. .Ic show-options
  2280. command.
  2281. The available server and session options are listed under the
  2282. .Ic set-option
  2283. command.
  2284. .Pp
  2285. Similarly, a set of window options is attached to each window, and there is
  2286. a set of global window options from which any unset options are inherited.
  2287. Window options are altered with the
  2288. .Ic set-window-option
  2289. command and can be listed with the
  2290. .Ic show-window-options
  2291. command.
  2292. All window options are documented with the
  2293. .Ic set-window-option
  2294. command.
  2295. .Pp
  2296. .Nm
  2297. also supports user options which are prefixed with a
  2298. .Ql \&@ .
  2299. User options may have any name, so long as they are prefixed with
  2300. .Ql \&@ ,
  2301. and be set to any string.
  2302. For example:
  2303. .Bd -literal -offset indent
  2304. $ tmux setw -q @foo "abc123"
  2305. $ tmux showw -v @foo
  2306. abc123
  2307. .Ed
  2308. .Pp
  2309. Commands which set options are as follows:
  2310. .Bl -tag -width Ds
  2311. .It Xo Ic set-option
  2312. .Op Fl agoqsuw
  2313. .Op Fl t Ar target-session | Ar target-window
  2314. .Ar option Ar value
  2315. .Xc
  2316. .D1 (alias: Ic set )
  2317. Set a window option with
  2318. .Fl w
  2319. (equivalent to the
  2320. .Ic set-window-option
  2321. command),
  2322. a server option with
  2323. .Fl s ,
  2324. otherwise a session option.
  2325. If
  2326. .Fl g
  2327. is given, the global session or window option is set.
  2328. The
  2329. .Fl u
  2330. flag unsets an option, so a session inherits the option from the global
  2331. options (or with
  2332. .Fl g ,
  2333. restores a global option to the default).
  2334. .Pp
  2335. The
  2336. .Fl o
  2337. flag prevents setting an option that is already set and the
  2338. .Fl q
  2339. flag suppresses errors about unknown or ambiguous options.
  2340. .Pp
  2341. With
  2342. .Fl a ,
  2343. and if the option expects a string or a style,
  2344. .Ar value
  2345. is appended to the existing setting.
  2346. For example:
  2347. .Bd -literal -offset indent
  2348. set -g status-left "foo"
  2349. set -ag status-left "bar"
  2350. .Ed
  2351. .Pp
  2352. Will result in
  2353. .Ql foobar .
  2354. And:
  2355. .Bd -literal -offset indent
  2356. set -g status-style "bg=red"
  2357. set -ag status-style "fg=blue"
  2358. .Ed
  2359. .Pp
  2360. Will result in a red background
  2361. .Em and
  2362. blue foreground.
  2363. Without
  2364. .Fl a ,
  2365. the result would be the default background and a blue foreground.
  2366. .Pp
  2367. Available window options are listed under
  2368. .Ic set-window-option .
  2369. .Pp
  2370. .Ar value
  2371. depends on the option and may be a number, a string, or a flag (on, off, or
  2372. omitted to toggle).
  2373. .Pp
  2374. Available server options are:
  2375. .Bl -tag -width Ds
  2376. .It Ic buffer-limit Ar number
  2377. Set the number of buffers; as new buffers are added to the top of the stack,
  2378. old ones are removed from the bottom if necessary to maintain this maximum
  2379. length.
  2380. .It Ic default-terminal Ar terminal
  2381. Set the default terminal for new windows created in this session - the
  2382. default value of the
  2383. .Ev TERM
  2384. environment variable.
  2385. For
  2386. .Nm
  2387. to work correctly, this
  2388. .Em must
  2389. be set to
  2390. .Ql screen ,
  2391. .Ql tmux
  2392. or a derivative of them.
  2393. .It Ic escape-time Ar time
  2394. Set the time in milliseconds for which
  2395. .Nm
  2396. waits after an escape is input to determine if it is part of a function or meta
  2397. key sequences.
  2398. The default is 500 milliseconds.
  2399. .It Xo Ic exit-unattached
  2400. .Op Ic on | off
  2401. .Xc
  2402. If enabled, the server will exit when there are no attached clients.
  2403. .It Xo Ic focus-events
  2404. .Op Ic on | off
  2405. .Xc
  2406. When enabled, focus events are requested from the terminal if supported and
  2407. passed through to applications running in
  2408. .Nm .
  2409. Attached clients should be detached and attached again after changing this
  2410. option.
  2411. .It Ic history-file Ar path
  2412. If not empty, a file to which
  2413. .Nm
  2414. will write command prompt history on exit and load it from on start.
  2415. .It Ic message-limit Ar number
  2416. Set the number of error or information messages to save in the message log for
  2417. each client.
  2418. The default is 100.
  2419. .It Xo Ic set-clipboard
  2420. .Op Ic on | off
  2421. .Xc
  2422. Attempt to set the terminal clipboard content using the
  2423. \ee]52;...\e007
  2424. .Xr xterm 1
  2425. escape sequences.
  2426. This option is on by default if there is an
  2427. .Em \&Ms
  2428. entry in the
  2429. .Xr terminfo 5
  2430. description for the client terminal.
  2431. Note that this feature needs to be enabled in
  2432. .Xr xterm 1
  2433. by setting the resource:
  2434. .Bd -literal -offset indent
  2435. disallowedWindowOps: 20,21,SetXprop
  2436. .Ed
  2437. .Pp
  2438. Or changing this property from the
  2439. .Xr xterm 1
  2440. interactive menu when required.
  2441. .It Ic terminal-overrides Ar string
  2442. Contains a list of entries which override terminal descriptions read using
  2443. .Xr terminfo 5 .
  2444. .Ar string
  2445. is a comma-separated list of items each a colon-separated string made up of a
  2446. terminal type pattern (matched using
  2447. .Xr fnmatch 3 )
  2448. and a set of
  2449. .Em name=value
  2450. entries.
  2451. .Pp
  2452. For example, to set the
  2453. .Ql clear
  2454. .Xr terminfo 5
  2455. entry to
  2456. .Ql \ee[H\ee[2J
  2457. for all terminal types and the
  2458. .Ql dch1
  2459. entry to
  2460. .Ql \ee[P
  2461. for the
  2462. .Ql rxvt
  2463. terminal type, the option could be set to the string:
  2464. .Bd -literal -offset indent
  2465. "*:clear=\ee[H\ee[2J,rxvt:dch1=\ee[P"
  2466. .Ed
  2467. .Pp
  2468. The terminal entry value is passed through
  2469. .Xr strunvis 3
  2470. before interpretation.
  2471. The default value forcibly corrects the
  2472. .Ql colors
  2473. entry for terminals which support 256 colours:
  2474. .Bd -literal -offset indent
  2475. "*256col*:colors=256,xterm*:XT"
  2476. .Ed
  2477. .El
  2478. .Pp
  2479. Available session options are:
  2480. .Bl -tag -width Ds
  2481. .It Ic assume-paste-time Ar milliseconds
  2482. If keys are entered faster than one in
  2483. .Ar milliseconds ,
  2484. they are assumed to have been pasted rather than typed and
  2485. .Nm
  2486. key bindings are not processed.
  2487. The default is one millisecond and zero disables.
  2488. .It Ic base-index Ar index
  2489. Set the base index from which an unused index should be searched when a new
  2490. window is created.
  2491. The default is zero.
  2492. .It Xo Ic bell-action
  2493. .Op Ic any | none | current | other
  2494. .Xc
  2495. Set action on window bell.
  2496. .Ic any
  2497. means a bell in any window linked to a session causes a bell in the current
  2498. window of that session,
  2499. .Ic none
  2500. means all bells are ignored,
  2501. .Ic current
  2502. means only bells in windows other than the current window are ignored and
  2503. .Ic other
  2504. means bells in the current window are ignored but not those in other windows.
  2505. .It Xo Ic bell-on-alert
  2506. .Op Ic on | off
  2507. .Xc
  2508. If on, ring the terminal bell when an alert
  2509. occurs.
  2510. .It Ic default-command Ar shell-command
  2511. Set the command used for new windows (if not specified when the window is
  2512. created) to
  2513. .Ar shell-command ,
  2514. which may be any
  2515. .Xr sh 1
  2516. command.
  2517. The default is an empty string, which instructs
  2518. .Nm
  2519. to create a login shell using the value of the
  2520. .Ic default-shell
  2521. option.
  2522. .It Ic default-shell Ar path
  2523. Specify the default shell.
  2524. This is used as the login shell for new windows when the
  2525. .Ic default-command
  2526. option is set to empty, and must be the full path of the executable.
  2527. When started
  2528. .Nm
  2529. tries to set a default value from the first suitable of the
  2530. .Ev SHELL
  2531. environment variable, the shell returned by
  2532. .Xr getpwuid 3 ,
  2533. or
  2534. .Pa /bin/sh .
  2535. This option should be configured when
  2536. .Nm
  2537. is used as a login shell.
  2538. .It Xo Ic destroy-unattached
  2539. .Op Ic on | off
  2540. .Xc
  2541. If enabled and the session is no longer attached to any clients, it is
  2542. destroyed.
  2543. .It Xo Ic detach-on-destroy
  2544. .Op Ic on | off
  2545. .Xc
  2546. If on (the default), the client is detached when the session it is attached to
  2547. is destroyed.
  2548. If off, the client is switched to the most recently active of the remaining
  2549. sessions.
  2550. .It Ic display-panes-active-colour Ar colour
  2551. Set the colour used by the
  2552. .Ic display-panes
  2553. command to show the indicator for the active pane.
  2554. .It Ic display-panes-colour Ar colour
  2555. Set the colour used by the
  2556. .Ic display-panes
  2557. command to show the indicators for inactive panes.
  2558. .It Ic display-panes-time Ar time
  2559. Set the time in milliseconds for which the indicators shown by the
  2560. .Ic display-panes
  2561. command appear.
  2562. .It Ic display-time Ar time
  2563. Set the amount of time for which status line messages and other on-screen
  2564. indicators are displayed.
  2565. If set to 0, messages and indicators are displayed until a key is pressed.
  2566. .Ar time
  2567. is in milliseconds.
  2568. .It Ic history-limit Ar lines
  2569. Set the maximum number of lines held in window history.
  2570. This setting applies only to new windows - existing window histories are not
  2571. resized and retain the limit at the point they were created.
  2572. .It Ic key-table Ar key-table
  2573. Set the default key table to
  2574. .Ar key-table
  2575. instead of
  2576. .Em root .
  2577. .It Ic lock-after-time Ar number
  2578. Lock the session (like the
  2579. .Ic lock-session
  2580. command) after
  2581. .Ar number
  2582. seconds of inactivity.
  2583. The default is not to lock (set to 0).
  2584. .It Ic lock-command Ar shell-command
  2585. Command to run when locking each client.
  2586. The default is to run
  2587. .Xr lock 1
  2588. with
  2589. .Fl np .
  2590. .It Ic message-command-style Ar style
  2591. Set status line message command style, where
  2592. .Ar style
  2593. is a comma-separated list of characteristics to be specified.
  2594. .Pp
  2595. These may be
  2596. .Ql bg=colour
  2597. to set the background colour,
  2598. .Ql fg=colour
  2599. to set the foreground colour, and a list of attributes as specified below.
  2600. .Pp
  2601. The colour is one of:
  2602. .Ic black ,
  2603. .Ic red ,
  2604. .Ic green ,
  2605. .Ic yellow ,
  2606. .Ic blue ,
  2607. .Ic magenta ,
  2608. .Ic cyan ,
  2609. .Ic white ,
  2610. aixterm bright variants (if supported:
  2611. .Ic brightred ,
  2612. .Ic brightgreen ,
  2613. and so on),
  2614. .Ic colour0
  2615. to
  2616. .Ic colour255
  2617. from the 256-colour set,
  2618. .Ic default ,
  2619. or a hexadecimal RGB string such as
  2620. .Ql #ffffff ,
  2621. which chooses the closest match from the default 256-colour set.
  2622. .Pp
  2623. The attributes is either
  2624. .Ic none
  2625. or a comma-delimited list of one or more of:
  2626. .Ic bright
  2627. (or
  2628. .Ic bold ) ,
  2629. .Ic dim ,
  2630. .Ic underscore ,
  2631. .Ic blink ,
  2632. .Ic reverse ,
  2633. .Ic hidden ,
  2634. or
  2635. .Ic italics ,
  2636. to turn an attribute on, or an attribute prefixed with
  2637. .Ql no
  2638. to turn one off.
  2639. .Pp
  2640. Examples are:
  2641. .Bd -literal -offset indent
  2642. fg=yellow,bold,underscore,blink
  2643. bg=black,fg=default,noreverse
  2644. .Ed
  2645. .Pp
  2646. With the
  2647. .Fl a
  2648. flag to the
  2649. .Ic set-option
  2650. command the new style is added otherwise the existing style is replaced.
  2651. .It Ic message-style Ar style
  2652. Set status line message style.
  2653. For how to specify
  2654. .Ar style ,
  2655. see the
  2656. .Ic message-command-style
  2657. option.
  2658. .It Xo Ic mouse
  2659. .Op Ic on | off
  2660. .Xc
  2661. If on,
  2662. .Nm
  2663. captures the mouse and allows mouse events to be bound as key bindings.
  2664. See the
  2665. .Sx MOUSE SUPPORT
  2666. section for details.
  2667. .It Ic prefix Ar key
  2668. Set the key accepted as a prefix key.
  2669. In addition to the standard keys described under
  2670. .Sx KEY BINDINGS ,
  2671. .Ic prefix
  2672. can be set to the special key
  2673. .Ql None
  2674. to set no prefix.
  2675. .It Ic prefix2 Ar key
  2676. Set a secondary key accepted as a prefix key.
  2677. Like
  2678. .Ic prefix ,
  2679. .Ic prefix2
  2680. can be set to
  2681. .Ql None .
  2682. .It Xo Ic renumber-windows
  2683. .Op Ic on | off
  2684. .Xc
  2685. If on, when a window is closed in a session, automatically renumber the other
  2686. windows in numerical order.
  2687. This respects the
  2688. .Ic base-index
  2689. option if it has been set.
  2690. If off, do not renumber the windows.
  2691. .It Ic repeat-time Ar time
  2692. Allow multiple commands to be entered without pressing the prefix-key again
  2693. in the specified
  2694. .Ar time
  2695. milliseconds (the default is 500).
  2696. Whether a key repeats may be set when it is bound using the
  2697. .Fl r
  2698. flag to
  2699. .Ic bind-key .
  2700. Repeat is enabled for the default keys bound to the
  2701. .Ic resize-pane
  2702. command.
  2703. .It Xo Ic set-remain-on-exit
  2704. .Op Ic on | off
  2705. .Xc
  2706. Set the
  2707. .Ic remain-on-exit
  2708. window option for any windows first created in this session.
  2709. When this option is true, windows in which the running program has
  2710. exited do not close, instead remaining open but inactivate.
  2711. Use the
  2712. .Ic respawn-window
  2713. command to reactivate such a window, or the
  2714. .Ic kill-window
  2715. command to destroy it.
  2716. .It Xo Ic set-titles
  2717. .Op Ic on | off
  2718. .Xc
  2719. Attempt to set the client terminal title using the
  2720. .Em tsl
  2721. and
  2722. .Em fsl
  2723. .Xr terminfo 5
  2724. entries if they exist.
  2725. .Nm
  2726. automatically sets these to the \ee]0;...\e007 sequence if
  2727. the terminal appears to be
  2728. .Xr xterm 1 .
  2729. This option is off by default.
  2730. .It Ic set-titles-string Ar string
  2731. String used to set the window title if
  2732. .Ic set-titles
  2733. is on.
  2734. Formats are expanded, see the
  2735. .Sx FORMATS
  2736. section.
  2737. .It Xo Ic status
  2738. .Op Ic on | off
  2739. .Xc
  2740. Show or hide the status line.
  2741. .It Ic status-interval Ar interval
  2742. Update the status bar every
  2743. .Ar interval
  2744. seconds.
  2745. By default, updates will occur every 15 seconds.
  2746. A setting of zero disables redrawing at interval.
  2747. .It Xo Ic status-justify
  2748. .Op Ic left | centre | right
  2749. .Xc
  2750. Set the position of the window list component of the status line: left, centre
  2751. or right justified.
  2752. .It Xo Ic status-keys
  2753. .Op Ic vi | emacs
  2754. .Xc
  2755. Use vi or emacs-style
  2756. key bindings in the status line, for example at the command prompt.
  2757. The default is emacs, unless the
  2758. .Ev VISUAL
  2759. or
  2760. .Ev EDITOR
  2761. environment variables are set and contain the string
  2762. .Ql vi .
  2763. .It Ic status-left Ar string
  2764. Display
  2765. .Ar string
  2766. (by default the session name) to the left of the status bar.
  2767. .Ar string
  2768. will be passed through
  2769. .Xr strftime 3
  2770. and formats (see
  2771. .Sx FORMATS )
  2772. will be expanded.
  2773. It may also contain any of the following special character sequences:
  2774. .Bl -column "Character pair" "Replaced with" -offset indent
  2775. .It Sy "Character pair" Ta Sy "Replaced with"
  2776. .It Li "#[attributes]" Ta "Colour or attribute change"
  2777. .It Li "##" Ta "A literal" Ql #
  2778. .El
  2779. .Pp
  2780. For details on how the names and titles can be set see the
  2781. .Sx "NAMES AND TITLES"
  2782. section.
  2783. For a list of allowed attributes see the
  2784. .Ic message-command-style
  2785. option.
  2786. .Pp
  2787. Examples are:
  2788. .Bd -literal -offset indent
  2789. #(sysctl vm.loadavg)
  2790. #[fg=yellow,bold]#(apm -l)%%#[default] [#S]
  2791. .Ed
  2792. .Pp
  2793. The default is
  2794. .Ql "[#S] " .
  2795. .It Ic status-left-length Ar length
  2796. Set the maximum
  2797. .Ar length
  2798. of the left component of the status bar.
  2799. The default is 10.
  2800. .It Ic status-left-style Ar style
  2801. Set the style of the left part of the status line.
  2802. For how to specify
  2803. .Ar style ,
  2804. see the
  2805. .Ic message-command-style
  2806. option.
  2807. .It Xo Ic status-position
  2808. .Op Ic top | bottom
  2809. .Xc
  2810. Set the position of the status line.
  2811. .It Ic status-right Ar string
  2812. Display
  2813. .Ar string
  2814. to the right of the status bar.
  2815. By default, the current window title in double quotes, the date and the time
  2816. are shown.
  2817. As with
  2818. .Ic status-left ,
  2819. .Ar string
  2820. will be passed to
  2821. .Xr strftime 3
  2822. and character pairs are replaced.
  2823. .It Ic status-right-length Ar length
  2824. Set the maximum
  2825. .Ar length
  2826. of the right component of the status bar.
  2827. The default is 40.
  2828. .It Ic status-right-style Ar style
  2829. Set the style of the right part of the status line.
  2830. For how to specify
  2831. .Ar style ,
  2832. see the
  2833. .Ic message-command-style
  2834. option.
  2835. .It Ic status-style Ar style
  2836. Set status line style.
  2837. For how to specify
  2838. .Ar style ,
  2839. see the
  2840. .Ic message-command-style
  2841. option.
  2842. .It Ic update-environment Ar variables
  2843. Set a space-separated string containing a list of environment variables to be
  2844. copied into the session environment when a new session is created or an
  2845. existing session is attached.
  2846. Any variables that do not exist in the source environment are set to be
  2847. removed from the session environment (as if
  2848. .Fl r
  2849. was given to the
  2850. .Ic set-environment
  2851. command).
  2852. The default is
  2853. "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID
  2854. XAUTHORITY".
  2855. .It Xo Ic visual-activity
  2856. .Op Ic on | off
  2857. .Xc
  2858. If on, display a status line message when activity occurs in a window
  2859. for which the
  2860. .Ic monitor-activity
  2861. window option is enabled.
  2862. .It Xo Ic visual-bell
  2863. .Op Ic on | off
  2864. .Xc
  2865. If this option is on, a message is shown on a bell instead of it being passed
  2866. through to the terminal (which normally makes a sound).
  2867. Also see the
  2868. .Ic bell-action
  2869. option.
  2870. .It Xo Ic visual-silence
  2871. .Op Ic on | off
  2872. .Xc
  2873. If
  2874. .Ic monitor-silence
  2875. is enabled, prints a message after the interval has expired on a given window.
  2876. .It Ic word-separators Ar string
  2877. Sets the session's conception of what characters are considered word
  2878. separators, for the purposes of the next and previous word commands in
  2879. copy mode.
  2880. The default is
  2881. .Ql \ -_@ .
  2882. .El
  2883. .It Xo Ic set-window-option
  2884. .Op Fl agoqu
  2885. .Op Fl t Ar target-window
  2886. .Ar option Ar value
  2887. .Xc
  2888. .D1 (alias: Ic setw )
  2889. Set a window option.
  2890. The
  2891. .Fl a ,
  2892. .Fl g ,
  2893. .Fl o ,
  2894. .Fl q
  2895. and
  2896. .Fl u
  2897. flags work similarly to the
  2898. .Ic set-option
  2899. command.
  2900. .Pp
  2901. Supported window options are:
  2902. .Pp
  2903. .Bl -tag -width Ds -compact
  2904. .It Xo Ic aggressive-resize
  2905. .Op Ic on | off
  2906. .Xc
  2907. Aggressively resize the chosen window.
  2908. This means that
  2909. .Nm
  2910. will resize the window to the size of the smallest session for which it is the
  2911. current window, rather than the smallest session to which it is attached.
  2912. The window may resize when the current window is changed on another sessions;
  2913. this option is good for full-screen programs which support
  2914. .Dv SIGWINCH
  2915. and poor for interactive programs such as shells.
  2916. .Pp
  2917. .It Xo Ic allow-rename
  2918. .Op Ic on | off
  2919. .Xc
  2920. Allow programs to change the window name using a terminal escape
  2921. sequence (\eek...\ee\e\e).
  2922. The default is on.
  2923. .Pp
  2924. .It Xo Ic alternate-screen
  2925. .Op Ic on | off
  2926. .Xc
  2927. This option configures whether programs running inside
  2928. .Nm
  2929. may use the terminal alternate screen feature, which allows the
  2930. .Em smcup
  2931. and
  2932. .Em rmcup
  2933. .Xr terminfo 5
  2934. capabilities.
  2935. The alternate screen feature preserves the contents of the window when an
  2936. interactive application starts and restores it on exit, so that any output
  2937. visible before the application starts reappears unchanged after it exits.
  2938. The default is on.
  2939. .Pp
  2940. .It Xo Ic automatic-rename
  2941. .Op Ic on | off
  2942. .Xc
  2943. Control automatic window renaming.
  2944. When this setting is enabled,
  2945. .Nm
  2946. will rename the window automatically using the format specified by
  2947. .Ic automatic-rename-format .
  2948. This flag is automatically disabled for an individual window when a name
  2949. is specified at creation with
  2950. .Ic new-window
  2951. or
  2952. .Ic new-session ,
  2953. or later with
  2954. .Ic rename-window ,
  2955. or with a terminal escape sequence.
  2956. It may be switched off globally with:
  2957. .Bd -literal -offset indent
  2958. set-window-option -g automatic-rename off
  2959. .Ed
  2960. .Pp
  2961. .It Ic automatic-rename-format Ar format
  2962. The format (see
  2963. .Sx FORMATS )
  2964. used when the
  2965. .Ic automatic-rename
  2966. option is enabled.
  2967. .Pp
  2968. .It Ic clock-mode-colour Ar colour
  2969. Set clock colour.
  2970. .Pp
  2971. .It Xo Ic clock-mode-style
  2972. .Op Ic 12 | 24
  2973. .Xc
  2974. Set clock hour format.
  2975. .Pp
  2976. .It Ic force-height Ar height
  2977. .It Ic force-width Ar width
  2978. Prevent
  2979. .Nm
  2980. from resizing a window to greater than
  2981. .Ar width
  2982. or
  2983. .Ar height .
  2984. A value of zero restores the default unlimited setting.
  2985. .Pp
  2986. .It Ic main-pane-height Ar height
  2987. .It Ic main-pane-width Ar width
  2988. Set the width or height of the main (left or top) pane in the
  2989. .Ic main-horizontal
  2990. or
  2991. .Ic main-vertical
  2992. layouts.
  2993. .Pp
  2994. .It Xo Ic mode-keys
  2995. .Op Ic vi | emacs
  2996. .Xc
  2997. Use vi or emacs-style key bindings in copy and choice modes.
  2998. As with the
  2999. .Ic status-keys
  3000. option, the default is emacs, unless
  3001. .Ev VISUAL
  3002. or
  3003. .Ev EDITOR
  3004. contains
  3005. .Ql vi .
  3006. .Pp
  3007. .It Ic mode-style Ar style
  3008. Set window modes style.
  3009. For how to specify
  3010. .Ar style ,
  3011. see the
  3012. .Ic message-command-style
  3013. option.
  3014. .Pp
  3015. .It Xo Ic monitor-activity
  3016. .Op Ic on | off
  3017. .Xc
  3018. Monitor for activity in the window.
  3019. Windows with activity are highlighted in the status line.
  3020. .Pp
  3021. .It Xo Ic monitor-silence
  3022. .Op Ic interval
  3023. .Xc
  3024. Monitor for silence (no activity) in the window within
  3025. .Ic interval
  3026. seconds.
  3027. Windows that have been silent for the interval are highlighted in the
  3028. status line.
  3029. An interval of zero disables the monitoring.
  3030. .Pp
  3031. .It Ic other-pane-height Ar height
  3032. Set the height of the other panes (not the main pane) in the
  3033. .Ic main-horizontal
  3034. layout.
  3035. If this option is set to 0 (the default), it will have no effect.
  3036. If both the
  3037. .Ic main-pane-height
  3038. and
  3039. .Ic other-pane-height
  3040. options are set, the main pane will grow taller to make the other panes the
  3041. specified height, but will never shrink to do so.
  3042. .Pp
  3043. .It Ic other-pane-width Ar width
  3044. Like
  3045. .Ic other-pane-height ,
  3046. but set the width of other panes in the
  3047. .Ic main-vertical
  3048. layout.
  3049. .Pp
  3050. .It Ic pane-active-border-style Ar style
  3051. Set the pane border style for the currently active pane.
  3052. For how to specify
  3053. .Ar style ,
  3054. see the
  3055. .Ic message-command-style
  3056. option.
  3057. Attributes are ignored.
  3058. .Pp
  3059. .It Ic pane-base-index Ar index
  3060. Like
  3061. .Ic base-index ,
  3062. but set the starting index for pane numbers.
  3063. .Pp
  3064. .It Ic pane-border-style Ar style
  3065. Set the pane border style for panes aside from the active pane.
  3066. For how to specify
  3067. .Ar style ,
  3068. see the
  3069. .Ic message-command-style
  3070. option.
  3071. Attributes are ignored.
  3072. .Pp
  3073. .It Xo Ic remain-on-exit
  3074. .Op Ic on | off
  3075. .Xc
  3076. A window with this flag set is not destroyed when the program running in it
  3077. exits.
  3078. The window may be reactivated with the
  3079. .Ic respawn-window
  3080. command.
  3081. .Pp
  3082. .It Xo Ic synchronize-panes
  3083. .Op Ic on | off
  3084. .Xc
  3085. Duplicate input to any pane to all other panes in the same window (only
  3086. for panes that are not in any special mode).
  3087. .Pp
  3088. .It Ic window-active-style Ar style
  3089. Set the style for the window's active pane.
  3090. For how to specify
  3091. .Ar style ,
  3092. see the
  3093. .Ic message-command-style
  3094. option.
  3095. .Pp
  3096. .It Ic window-status-activity-style Ar style
  3097. Set status line style for windows with an activity alert.
  3098. For how to specify
  3099. .Ar style ,
  3100. see the
  3101. .Ic message-command-style
  3102. option.
  3103. .Pp
  3104. .It Ic window-status-bell-style Ar style
  3105. Set status line style for windows with a bell alert.
  3106. For how to specify
  3107. .Ar style ,
  3108. see the
  3109. .Ic message-command-style
  3110. option.
  3111. .Pp
  3112. .It Ic window-status-current-format Ar string
  3113. Like
  3114. .Ar window-status-format ,
  3115. but is the format used when the window is the current window.
  3116. .Pp
  3117. .It Ic window-status-current-style Ar style
  3118. Set status line style for the currently active window.
  3119. For how to specify
  3120. .Ar style ,
  3121. see the
  3122. .Ic message-command-style
  3123. option.
  3124. .Pp
  3125. .It Ic window-status-format Ar string
  3126. Set the format in which the window is displayed in the status line window list.
  3127. See the
  3128. .Ar status-left
  3129. option for details of special character sequences available.
  3130. The default is
  3131. .Ql #I:#W#F .
  3132. .Pp
  3133. .It Ic window-status-last-style Ar style
  3134. Set status line style for the last active window.
  3135. For how to specify
  3136. .Ar style ,
  3137. see the
  3138. .Ic message-command-style
  3139. option.
  3140. .Pp
  3141. .It Ic window-status-separator Ar string
  3142. Sets the separator drawn between windows in the status line.
  3143. The default is a single space character.
  3144. .Pp
  3145. .It Ic window-status-style Ar style
  3146. Set status line style for a single window.
  3147. For how to specify
  3148. .Ar style ,
  3149. see the
  3150. .Ic message-command-style
  3151. option.
  3152. .Pp
  3153. .It Ic window-style Ar style
  3154. Set the default window style.
  3155. For how to specify
  3156. .Ar style ,
  3157. see the
  3158. .Ic message-command-style
  3159. option.
  3160. .Pp
  3161. .It Xo Ic xterm-keys
  3162. .Op Ic on | off
  3163. .Xc
  3164. If this option is set,
  3165. .Nm
  3166. will generate
  3167. .Xr xterm 1 -style
  3168. function key sequences; these have a number included to indicate modifiers such
  3169. as Shift, Alt or Ctrl.
  3170. The default is off.
  3171. .Pp
  3172. .It Xo Ic wrap-search
  3173. .Op Ic on | off
  3174. .Xc
  3175. If this option is set, searches will wrap around the end of the pane contents.
  3176. The default is on.
  3177. .El
  3178. .It Xo Ic show-options
  3179. .Op Fl gqsvw
  3180. .Op Fl t Ar target-session | Ar target-window
  3181. .Op Ar option
  3182. .Xc
  3183. .D1 (alias: Ic show )
  3184. Show the window options (or a single window option if given) with
  3185. .Fl w
  3186. (equivalent to
  3187. .Ic show-window-options ) ,
  3188. the server options with
  3189. .Fl s ,
  3190. otherwise the session options for
  3191. .Ar target session .
  3192. Global session or window options are listed if
  3193. .Fl g
  3194. is used.
  3195. .Fl v
  3196. shows only the option value, not the name.
  3197. If
  3198. .Fl q
  3199. is set, no error will be returned if
  3200. .Ar option
  3201. is unset.
  3202. .It Xo Ic show-window-options
  3203. .Op Fl gv
  3204. .Op Fl t Ar target-window
  3205. .Op Ar option
  3206. .Xc
  3207. .D1 (alias: Ic showw )
  3208. List the window options or a single option for
  3209. .Ar target-window ,
  3210. or the global window options if
  3211. .Fl g
  3212. is used.
  3213. .Fl v
  3214. shows only the option value, not the name.
  3215. .El
  3216. .Sh HOOKS
  3217. .Nm
  3218. allows commands to run on various triggers, called
  3219. .Em hooks .
  3220. Each hook has a
  3221. .Em name .
  3222. The following hooks are available:
  3223. .Bl -tag -width "XXXXXXXXXXXXXXXX"
  3224. .It alert-activity
  3225. Run when a window has activity.
  3226. See
  3227. .Ic monitor-activity .
  3228. .It alert-bell
  3229. Run when a window has received a bell.
  3230. .It alert-silence
  3231. Run when a window has been silent.
  3232. See
  3233. .Ic monitor-silence .
  3234. .It client-attached
  3235. Run when a client is attached.
  3236. .It client-detached
  3237. Run when a client is detached
  3238. .It client-resized
  3239. Run when a client is resized.
  3240. .It pane-died
  3241. Run when the program running in a pane exits, but
  3242. .Ic remain-on-exit
  3243. is on so the pane has not closed.
  3244. .It pane-exited
  3245. Run when the program running in a pane exits.
  3246. .El
  3247. .Pp
  3248. Hooks are managed with these commands:
  3249. .Bl -tag -width Ds
  3250. .It Xo Ic set-hook
  3251. .Op Fl g
  3252. .Op Fl t Ar target-session
  3253. .Ar hook-name
  3254. .Ar command
  3255. .Xc
  3256. Sets hook
  3257. .Ar hook-name
  3258. to
  3259. .Ar command .
  3260. If
  3261. .Fl g
  3262. is given,
  3263. .Em hook-name
  3264. is added to the global list of hooks, otherwise it is added to the session
  3265. hooks (for
  3266. .Ar target-session
  3267. with
  3268. .Fl t ) .
  3269. Like options, session hooks inherit from the global ones.
  3270. .It Xo Ic show-hooks
  3271. .Op Fl g
  3272. .Op Fl t Ar target-session
  3273. .Xc
  3274. Shows the global list of hooks with
  3275. .Fl g ,
  3276. otherwise the session hooks.
  3277. .El
  3278. .Sh MOUSE SUPPORT
  3279. If the
  3280. .Ic mouse
  3281. option is on (the default is off),
  3282. .Nm
  3283. allows mouse events to be bound as keys.
  3284. The name of each key is made up of a mouse event (such as
  3285. .Ql MouseUp1 )
  3286. and a location suffix (one of
  3287. .Ql Pane
  3288. for the contents of a pane,
  3289. .Ql Border
  3290. for a pane border or
  3291. .Ql Status
  3292. for the status line).
  3293. The following mouse events are available:
  3294. .Bl -column "MouseDown1" "MouseDrag1" "WheelDown" -offset indent
  3295. .It Li "MouseDown1" Ta "MouseUp1" Ta "MouseDrag1" Ta "MouseDragEnd1"
  3296. .It Li "MouseDown2" Ta "MouseUp2" Ta "MouseDrag2" Ta "MouseDragEnd2"
  3297. .It Li "MouseDown3" Ta "MouseUp3" Ta "MouseDrag3" Ta "MouseDragEnd3"
  3298. .It Li "WheelUp" Ta "WheelDown" Ta "" Ta ""
  3299. .El
  3300. .Pp
  3301. Each should be suffixed with a location, for example
  3302. .Ql MouseDown1Status .
  3303. .Pp
  3304. The special token
  3305. .Ql {mouse}
  3306. or
  3307. .Ql =
  3308. may be used as
  3309. .Ar target-window
  3310. or
  3311. .Ar target-pane
  3312. in commands bound to mouse key bindings.
  3313. It resolves to the window or pane over which the mouse event took place
  3314. (for example, the window in the status line over which button 1 was released for a
  3315. .Ql MouseUp1Status
  3316. binding, or the pane over which the wheel was scrolled for a
  3317. .Ql WheelDownPane
  3318. binding).
  3319. .Pp
  3320. The
  3321. .Ic send-keys
  3322. .Fl M
  3323. flag may be used to forward a mouse event to a pane.
  3324. .Pp
  3325. The default key bindings allow the mouse to be used to select and resize panes,
  3326. to copy text and to change window using the status line.
  3327. These take effect if the
  3328. .Ic mouse
  3329. option is turned on.
  3330. .Sh FORMATS
  3331. Certain commands accept the
  3332. .Fl F
  3333. flag with a
  3334. .Ar format
  3335. argument.
  3336. This is a string which controls the output format of the command.
  3337. Replacement variables are enclosed in
  3338. .Ql #{
  3339. and
  3340. .Ql } ,
  3341. for example
  3342. .Ql #{session_name} .
  3343. The possible variables are listed in the table below, or the name of a
  3344. .Nm
  3345. option may be used for an option's value.
  3346. Some variables have a shorter alias such as
  3347. .Ql #S ,
  3348. and
  3349. .Ql ##
  3350. is replaced by a single
  3351. .Ql # .
  3352. .Pp
  3353. Conditionals are available by prefixing with
  3354. .Ql \&?
  3355. and separating two alternatives with a comma;
  3356. if the specified variable exists and is not zero, the first alternative
  3357. is chosen, otherwise the second is used.
  3358. For example
  3359. .Ql #{?session_attached,attached,not attached}
  3360. will include the string
  3361. .Ql attached
  3362. if the session is attached and the string
  3363. .Ql not attached
  3364. if it is unattached, or
  3365. .Ql #{?automatic-rename,yes,no}
  3366. will include
  3367. .Ql yes
  3368. if
  3369. .Ic automatic-rename
  3370. is enabled, or
  3371. .Ql no
  3372. if not.
  3373. .Pp
  3374. A limit may be placed on the length of the resultant string by prefixing it
  3375. by an
  3376. .Ql = ,
  3377. a number and a colon.
  3378. Positive numbers count from the start of the string and negative from the end,
  3379. so
  3380. .Ql #{=5:pane_title}
  3381. will include at most the first 5 characters of the pane title, or
  3382. .Ql #{=-5:pane_title}
  3383. the last 5 characters.
  3384. Prefixing a time variable with
  3385. .Ql t:
  3386. will convert it to a string, so if
  3387. .Ql #{window_activity}
  3388. gives
  3389. .Ql 1445765102 ,
  3390. .Ql #{t:window_activity}
  3391. gives
  3392. .Ql Sun Oct 25 09:25:02 2015 .
  3393. The
  3394. .Ql b:
  3395. and
  3396. .Ql d:
  3397. prefixes are
  3398. .Xr basename 3
  3399. and
  3400. .Xr dirname 3
  3401. of the variable respectively.
  3402. A prefix of the form
  3403. .Ql s/foo/bar/:
  3404. will substitute
  3405. .Ql foo
  3406. with
  3407. .Ql bar
  3408. throughout.
  3409. .Pp
  3410. In addition, the first line of a shell command's output may be inserted using
  3411. .Ql #() .
  3412. For example,
  3413. .Ql #(uptime)
  3414. will insert the system's uptime.
  3415. When constructing formats,
  3416. .Nm
  3417. does not wait for
  3418. .Ql #()
  3419. commands to finish; instead, the previous result from running the same command is used,
  3420. or a placeholder if the command has not been run before.
  3421. Commands are executed with the
  3422. .Nm
  3423. global environment set (see the
  3424. .Sx ENVIRONMENT
  3425. section).
  3426. .Pp
  3427. The following variables are available, where appropriate:
  3428. .Bl -column "XXXXXXXXXXXXXXXXXXX" "XXXXX"
  3429. .It Sy "Variable name" Ta Sy "Alias" Ta Sy "Replaced with"
  3430. .It Li "alternate_on" Ta "" Ta "If pane is in alternate screen"
  3431. .It Li "alternate_saved_x" Ta "" Ta "Saved cursor X in alternate screen"
  3432. .It Li "alternate_saved_y" Ta "" Ta "Saved cursor Y in alternate screen"
  3433. .It Li "buffer_sample" Ta "" Ta "Sample of start of buffer"
  3434. .It Li "buffer_size" Ta "" Ta "Size of the specified buffer in bytes"
  3435. .It Li "client_activity" Ta "" Ta "Integer time client last had activity"
  3436. .It Li "client_created" Ta "" Ta "Integer time client created"
  3437. .It Li "client_control_mode" Ta "" Ta "1 if client is in control mode"
  3438. .It Li "client_height" Ta "" Ta "Height of client"
  3439. .It Li "client_key_table" Ta "" Ta "Current key table"
  3440. .It Li "client_last_session" Ta "" Ta "Name of the client's last session"
  3441. .It Li "client_pid" Ta "" Ta "PID of client process"
  3442. .It Li "client_prefix" Ta "" Ta "1 if prefix key has been pressed"
  3443. .It Li "client_readonly" Ta "" Ta "1 if client is readonly"
  3444. .It Li "client_session" Ta "" Ta "Name of the client's session"
  3445. .It Li "client_termname" Ta "" Ta "Terminal name of client"
  3446. .It Li "client_tty" Ta "" Ta "Pseudo terminal of client"
  3447. .It Li "client_utf8" Ta "" Ta "1 if client supports utf8"
  3448. .It Li "client_width" Ta "" Ta "Width of client"
  3449. .It Li "command_name" Ta "" Ta "Name of command in use, if any"
  3450. .It Li "cursor_flag" Ta "" Ta "Pane cursor flag"
  3451. .It Li "cursor_x" Ta "" Ta "Cursor X position in pane"
  3452. .It Li "cursor_y" Ta "" Ta "Cursor Y position in pane"
  3453. .It Li "history_bytes" Ta "" Ta "Number of bytes in window history"
  3454. .It Li "history_limit" Ta "" Ta "Maximum window history lines"
  3455. .It Li "history_size" Ta "" Ta "Size of history in bytes"
  3456. .It Li "host" Ta "#H" Ta "Hostname of local host"
  3457. .It Li "host_short" Ta "#h" Ta "Hostname of local host (no domain name)"
  3458. .It Li "insert_flag" Ta "" Ta "Pane insert flag"
  3459. .It Li "keypad_cursor_flag" Ta "" Ta "Pane keypad cursor flag"
  3460. .It Li "keypad_flag" Ta "" Ta "Pane keypad flag"
  3461. .It Li "line" Ta "" Ta "Line number in the list"
  3462. .It Li "mouse_any_flag" Ta "" Ta "Pane mouse any flag"
  3463. .It Li "mouse_button_flag" Ta "" Ta "Pane mouse button flag"
  3464. .It Li "mouse_standard_flag" Ta "" Ta "Pane mouse standard flag"
  3465. .It Li "pane_active" Ta "" Ta "1 if active pane"
  3466. .It Li "pane_bottom" Ta "" Ta "Bottom of pane"
  3467. .It Li "pane_current_command" Ta "" Ta "Current command if available"
  3468. .It Li "pane_current_path" Ta "" Ta "Current path if available"
  3469. .It Li "pane_dead" Ta "" Ta "1 if pane is dead"
  3470. .It Li "pane_dead_status" Ta "" Ta "Exit status of process in dead pane"
  3471. .It Li "pane_height" Ta "" Ta "Height of pane"
  3472. .It Li "pane_id" Ta "#D" Ta "Unique pane ID"
  3473. .It Li "pane_in_mode" Ta "" Ta "If pane is in a mode"
  3474. .It Li "pane_input_off" Ta "" Ta "If input to pane is disabled"
  3475. .It Li "pane_index" Ta "#P" Ta "Index of pane"
  3476. .It Li "pane_left" Ta "" Ta "Left of pane"
  3477. .It Li "pane_pid" Ta "" Ta "PID of first process in pane"
  3478. .It Li "pane_right" Ta "" Ta "Right of pane"
  3479. .It Li "pane_start_command" Ta "" Ta "Command pane started with"
  3480. .It Li "pane_synchronized" Ta "" Ta "If pane is synchronized"
  3481. .It Li "pane_tabs" Ta "" Ta "Pane tab positions"
  3482. .It Li "pane_title" Ta "#T" Ta "Title of pane"
  3483. .It Li "pane_top" Ta "" Ta "Top of pane"
  3484. .It Li "pane_tty" Ta "" Ta "Pseudo terminal of pane"
  3485. .It Li "pane_width" Ta "" Ta "Width of pane"
  3486. .It Li "pid" Ta "" Ta "Server PID"
  3487. .It Li "scroll_region_lower" Ta "" Ta "Bottom of scroll region in pane"
  3488. .It Li "scroll_region_upper" Ta "" Ta "Top of scroll region in pane"
  3489. .It Li "scroll_position" Ta "" Ta "Scroll position in copy mode"
  3490. .It Li "session_alerts" Ta "" Ta "List of window indexes with alerts"
  3491. .It Li "session_attached" Ta "" Ta "Number of clients session is attached to"
  3492. .It Li "session_activity" Ta "" Ta "Integer time of session last activity"
  3493. .It Li "session_created" Ta "" Ta "Integer time session created"
  3494. .It Li "session_last_attached" Ta "" Ta "Integer time session last attached"
  3495. .It Li "session_group" Ta "" Ta "Number of session group"
  3496. .It Li "session_grouped" Ta "" Ta "1 if session in a group"
  3497. .It Li "session_height" Ta "" Ta "Height of session"
  3498. .It Li "session_id" Ta "" Ta "Unique session ID"
  3499. .It Li "session_many_attached" Ta "" Ta "1 if multiple clients attached"
  3500. .It Li "session_name" Ta "#S" Ta "Name of session"
  3501. .It Li "session_width" Ta "" Ta "Width of session"
  3502. .It Li "session_windows" Ta "" Ta "Number of windows in session"
  3503. .It Li "socket_path" Ta "" "Server socket path"
  3504. .It Li "start_time" Ta "" Ta "Server start time"
  3505. .It Li "window_activity" Ta "" Ta "Integer time of window last activity"
  3506. .It Li "window_active" Ta "" Ta "1 if window active"
  3507. .It Li "window_bell_flag" Ta "" Ta "1 if window has bell"
  3508. .It Li "window_find_matches" Ta "" Ta "Matched data from the find-window"
  3509. .It Li "window_flags" Ta "#F" Ta "Window flags"
  3510. .It Li "window_height" Ta "" Ta "Height of window"
  3511. .It Li "window_id" Ta "" Ta "Unique window ID"
  3512. .It Li "window_index" Ta "#I" Ta "Index of window"
  3513. .It Li "window_last_flag" Ta "" Ta "1 if window is the last used"
  3514. .It Li "window_layout" Ta "" Ta "Window layout description, ignoring zoomed window panes"
  3515. .It Li "window_linked" Ta "" Ta "1 if window is linked across sessions"
  3516. .It Li "window_name" Ta "#W" Ta "Name of window"
  3517. .It Li "window_panes" Ta "" Ta "Number of panes in window"
  3518. .It Li "window_silence_flag" Ta "" Ta "1 if window has silence alert"
  3519. .It Li "window_visible_layout" Ta "" Ta "Window layout description, respecting zoomed window panes"
  3520. .It Li "window_width" Ta "" Ta "Width of window"
  3521. .It Li "window_zoomed_flag" Ta "" Ta "1 if window is zoomed"
  3522. .It Li "wrap_flag" Ta "" Ta "Pane wrap flag"
  3523. .El
  3524. .Sh NAMES AND TITLES
  3525. .Nm
  3526. distinguishes between names and titles.
  3527. Windows and sessions have names, which may be used to specify them in targets
  3528. and are displayed in the status line and various lists: the name is the
  3529. .Nm
  3530. identifier for a window or session.
  3531. Only panes have titles.
  3532. A pane's title is typically set by the program running inside the pane and
  3533. is not modified by
  3534. .Nm .
  3535. It is the same mechanism used to set for example the
  3536. .Xr xterm 1
  3537. window title in an
  3538. .Xr X 7
  3539. window manager.
  3540. Windows themselves do not have titles - a window's title is the title of its
  3541. active pane.
  3542. .Nm
  3543. itself may set the title of the terminal in which the client is running, see
  3544. the
  3545. .Ic set-titles
  3546. option.
  3547. .Pp
  3548. A session's name is set with the
  3549. .Ic new-session
  3550. and
  3551. .Ic rename-session
  3552. commands.
  3553. A window's name is set with one of:
  3554. .Bl -enum -width Ds
  3555. .It
  3556. A command argument (such as
  3557. .Fl n
  3558. for
  3559. .Ic new-window
  3560. or
  3561. .Ic new-session ) .
  3562. .It
  3563. An escape sequence:
  3564. .Bd -literal -offset indent
  3565. $ printf '\e033kWINDOW_NAME\e033\e\e'
  3566. .Ed
  3567. .It
  3568. Automatic renaming, which sets the name to the active command in the window's
  3569. active pane.
  3570. See the
  3571. .Ic automatic-rename
  3572. option.
  3573. .El
  3574. .Pp
  3575. When a pane is first created, its title is the hostname.
  3576. A pane's title can be set via the OSC title setting sequence, for example:
  3577. .Bd -literal -offset indent
  3578. $ printf '\e033]2;My Title\e033\e\e'
  3579. .Ed
  3580. .Sh ENVIRONMENT
  3581. When the server is started,
  3582. .Nm
  3583. copies the environment into the
  3584. .Em global environment ;
  3585. in addition, each session has a
  3586. .Em session environment .
  3587. When a window is created, the session and global environments are merged.
  3588. If a variable exists in both, the value from the session environment is used.
  3589. The result is the initial environment passed to the new process.
  3590. .Pp
  3591. The
  3592. .Ic update-environment
  3593. session option may be used to update the session environment from the client
  3594. when a new session is created or an old reattached.
  3595. .Nm
  3596. also initialises the
  3597. .Ev TMUX
  3598. variable with some internal information to allow commands to be executed
  3599. from inside, and the
  3600. .Ev TERM
  3601. variable with the correct terminal setting of
  3602. .Ql screen .
  3603. .Pp
  3604. Commands to alter and view the environment are:
  3605. .Bl -tag -width Ds
  3606. .It Xo Ic set-environment
  3607. .Op Fl gru
  3608. .Op Fl t Ar target-session
  3609. .Ar name Op Ar value
  3610. .Xc
  3611. .D1 (alias: Ic setenv )
  3612. Set or unset an environment variable.
  3613. If
  3614. .Fl g
  3615. is used, the change is made in the global environment; otherwise, it is applied
  3616. to the session environment for
  3617. .Ar target-session .
  3618. The
  3619. .Fl u
  3620. flag unsets a variable.
  3621. .Fl r
  3622. indicates the variable is to be removed from the environment before starting a
  3623. new process.
  3624. .It Xo Ic show-environment
  3625. .Op Fl gs
  3626. .Op Fl t Ar target-session
  3627. .Op Ar variable
  3628. .Xc
  3629. .D1 (alias: Ic showenv )
  3630. Display the environment for
  3631. .Ar target-session
  3632. or the global environment with
  3633. .Fl g .
  3634. If
  3635. .Ar variable
  3636. is omitted, all variables are shown.
  3637. Variables removed from the environment are prefixed with
  3638. .Ql - .
  3639. If
  3640. .Fl s
  3641. is used, the output is formatted as a set of Bourne shell commands.
  3642. .El
  3643. .Sh STATUS LINE
  3644. .Nm
  3645. includes an optional status line which is displayed in the bottom line of each
  3646. terminal.
  3647. By default, the status line is enabled (it may be disabled with the
  3648. .Ic status
  3649. session option) and contains, from left-to-right: the name of the current
  3650. session in square brackets; the window list; the title of the active pane
  3651. in double quotes; and the time and date.
  3652. .Pp
  3653. The status line is made of three parts: configurable left and right sections
  3654. (which may contain dynamic content such as the time or output from a shell
  3655. command, see the
  3656. .Ic status-left ,
  3657. .Ic status-left-length ,
  3658. .Ic status-right ,
  3659. and
  3660. .Ic status-right-length
  3661. options below), and a central window list.
  3662. By default, the window list shows the index, name and (if any) flag of the
  3663. windows present in the current session in ascending numerical order.
  3664. It may be customised with the
  3665. .Ar window-status-format
  3666. and
  3667. .Ar window-status-current-format
  3668. options.
  3669. The flag is one of the following symbols appended to the window name:
  3670. .Bl -column "Symbol" "Meaning" -offset indent
  3671. .It Sy "Symbol" Ta Sy "Meaning"
  3672. .It Li "*" Ta "Denotes the current window."
  3673. .It Li "-" Ta "Marks the last window (previously selected)."
  3674. .It Li "#" Ta "Window is monitored and activity has been detected."
  3675. .It Li "!" Ta "A bell has occurred in the window."
  3676. .It Li "~" Ta "The window has been silent for the monitor-silence interval."
  3677. .It Li "M" Ta "The window contains the marked pane."
  3678. .It Li "Z" Ta "The window's active pane is zoomed."
  3679. .El
  3680. .Pp
  3681. The # symbol relates to the
  3682. .Ic monitor-activity
  3683. window option.
  3684. The window name is printed in inverted colours if an alert (bell, activity or
  3685. silence) is present.
  3686. .Pp
  3687. The colour and attributes of the status line may be configured, the entire
  3688. status line using the
  3689. .Ic status-style
  3690. session option and individual windows using the
  3691. .Ic window-status-style
  3692. window option.
  3693. .Pp
  3694. The status line is automatically refreshed at interval if it has changed, the
  3695. interval may be controlled with the
  3696. .Ic status-interval
  3697. session option.
  3698. .Pp
  3699. Commands related to the status line are as follows:
  3700. .Bl -tag -width Ds
  3701. .It Xo Ic command-prompt
  3702. .Op Fl I Ar inputs
  3703. .Op Fl p Ar prompts
  3704. .Op Fl t Ar target-client
  3705. .Op Ar template
  3706. .Xc
  3707. Open the command prompt in a client.
  3708. This may be used from inside
  3709. .Nm
  3710. to execute commands interactively.
  3711. .Pp
  3712. If
  3713. .Ar template
  3714. is specified, it is used as the command.
  3715. If present,
  3716. .Fl I
  3717. is a comma-separated list of the initial text for each prompt.
  3718. If
  3719. .Fl p
  3720. is given,
  3721. .Ar prompts
  3722. is a comma-separated list of prompts which are displayed in order; otherwise
  3723. a single prompt is displayed, constructed from
  3724. .Ar template
  3725. if it is present, or
  3726. .Ql \&:
  3727. if not.
  3728. .Pp
  3729. Both
  3730. .Ar inputs
  3731. and
  3732. .Ar prompts
  3733. may contain the special character sequences supported by the
  3734. .Ic status-left
  3735. option.
  3736. .Pp
  3737. Before the command is executed, the first occurrence of the string
  3738. .Ql %%
  3739. and all occurrences of
  3740. .Ql %1
  3741. are replaced by the response to the first prompt, the second
  3742. .Ql %%
  3743. and all
  3744. .Ql %2
  3745. are replaced with the response to the second prompt, and so on for further
  3746. prompts.
  3747. Up to nine prompt responses may be replaced
  3748. .Po
  3749. .Ql %1
  3750. to
  3751. .Ql %9
  3752. .Pc .
  3753. .It Xo Ic confirm-before
  3754. .Op Fl p Ar prompt
  3755. .Op Fl t Ar target-client
  3756. .Ar command
  3757. .Xc
  3758. .D1 (alias: Ic confirm )
  3759. Ask for confirmation before executing
  3760. .Ar command .
  3761. If
  3762. .Fl p
  3763. is given,
  3764. .Ar prompt
  3765. is the prompt to display; otherwise a prompt is constructed from
  3766. .Ar command .
  3767. It may contain the special character sequences supported by the
  3768. .Ic status-left
  3769. option.
  3770. .Pp
  3771. This command works only from inside
  3772. .Nm .
  3773. .It Xo Ic display-message
  3774. .Op Fl p
  3775. .Op Fl c Ar target-client
  3776. .Op Fl t Ar target-pane
  3777. .Op Ar message
  3778. .Xc
  3779. .D1 (alias: Ic display )
  3780. Display a message.
  3781. If
  3782. .Fl p
  3783. is given, the output is printed to stdout, otherwise it is displayed in the
  3784. .Ar target-client
  3785. status line.
  3786. The format of
  3787. .Ar message
  3788. is described in the
  3789. .Sx FORMATS
  3790. section; information is taken from
  3791. .Ar target-pane
  3792. if
  3793. .Fl t
  3794. is given, otherwise the active pane for the session attached to
  3795. .Ar target-client .
  3796. .El
  3797. .Sh BUFFERS
  3798. .Nm
  3799. maintains a set of named
  3800. .Em paste buffers .
  3801. Each buffer may be either explicitly or automatically named.
  3802. Explicitly named buffers are named when created with the
  3803. .Ic set-buffer
  3804. or
  3805. .Ic load-buffer
  3806. commands, or by renaming an automatically named buffer with
  3807. .Ic set-buffer
  3808. .Fl n .
  3809. Automatically named buffers are given a name such as
  3810. .Ql buffer0001 ,
  3811. .Ql buffer0002
  3812. and so on.
  3813. When the
  3814. .Ic buffer-limit
  3815. option is reached, the oldest automatically named buffer is deleted.
  3816. Explicitly named are not subject to
  3817. .Ic buffer-limit
  3818. and may be deleted with
  3819. .Ic delete-buffer
  3820. command.
  3821. .Pp
  3822. Buffers may be added using
  3823. .Ic copy-mode
  3824. or the
  3825. .Ic set-buffer
  3826. and
  3827. .Ic load-buffer
  3828. commands, and pasted into a window using the
  3829. .Ic paste-buffer
  3830. command.
  3831. If a buffer command is used and no buffer is specified, the most
  3832. recently added automatically named buffer is assumed.
  3833. .Pp
  3834. A configurable history buffer is also maintained for each window.
  3835. By default, up to 2000 lines are kept; this can be altered with the
  3836. .Ic history-limit
  3837. option (see the
  3838. .Ic set-option
  3839. command above).
  3840. .Pp
  3841. The buffer commands are as follows:
  3842. .Bl -tag -width Ds
  3843. .It Xo
  3844. .Ic choose-buffer
  3845. .Op Fl F Ar format
  3846. .Op Fl t Ar target-window
  3847. .Op Ar template
  3848. .Xc
  3849. Put a window into buffer choice mode, where a buffer may be chosen
  3850. interactively from a list.
  3851. After a buffer is selected,
  3852. .Ql %%
  3853. is replaced by the buffer name in
  3854. .Ar template
  3855. and the result executed as a command.
  3856. If
  3857. .Ar template
  3858. is not given, "paste-buffer -b '%%'" is used.
  3859. For the meaning of the
  3860. .Fl F
  3861. flag, see the
  3862. .Sx FORMATS
  3863. section.
  3864. This command works only if at least one client is attached.
  3865. .It Ic clear-history Op Fl t Ar target-pane
  3866. .D1 (alias: Ic clearhist )
  3867. Remove and free the history for the specified pane.
  3868. .It Ic delete-buffer Op Fl b Ar buffer-name
  3869. .D1 (alias: Ic deleteb )
  3870. Delete the buffer named
  3871. .Ar buffer-name ,
  3872. or the most recently added automatically named buffer if not specified.
  3873. .It Xo Ic list-buffers
  3874. .Op Fl F Ar format
  3875. .Xc
  3876. .D1 (alias: Ic lsb )
  3877. List the global buffers.
  3878. For the meaning of the
  3879. .Fl F
  3880. flag, see the
  3881. .Sx FORMATS
  3882. section.
  3883. .It Xo Ic load-buffer
  3884. .Op Fl b Ar buffer-name
  3885. .Ar path
  3886. .Xc
  3887. .D1 (alias: Ic loadb )
  3888. Load the contents of the specified paste buffer from
  3889. .Ar path .
  3890. .It Xo Ic paste-buffer
  3891. .Op Fl dpr
  3892. .Op Fl b Ar buffer-name
  3893. .Op Fl s Ar separator
  3894. .Op Fl t Ar target-pane
  3895. .Xc
  3896. .D1 (alias: Ic pasteb )
  3897. Insert the contents of a paste buffer into the specified pane.
  3898. If not specified, paste into the current one.
  3899. With
  3900. .Fl d ,
  3901. also delete the paste buffer.
  3902. When output, any linefeed (LF) characters in the paste buffer are replaced with
  3903. a separator, by default carriage return (CR).
  3904. A custom separator may be specified using the
  3905. .Fl s
  3906. flag.
  3907. The
  3908. .Fl r
  3909. flag means to do no replacement (equivalent to a separator of LF).
  3910. If
  3911. .Fl p
  3912. is specified, paste bracket control codes are inserted around the
  3913. buffer if the application has requested bracketed paste mode.
  3914. .It Xo Ic save-buffer
  3915. .Op Fl a
  3916. .Op Fl b Ar buffer-name
  3917. .Ar path
  3918. .Xc
  3919. .D1 (alias: Ic saveb )
  3920. Save the contents of the specified paste buffer to
  3921. .Ar path .
  3922. The
  3923. .Fl a
  3924. option appends to rather than overwriting the file.
  3925. .It Xo Ic set-buffer
  3926. .Op Fl a
  3927. .Op Fl b Ar buffer-name
  3928. .Op Fl n Ar new-buffer-name
  3929. .Ar data
  3930. .Xc
  3931. .D1 (alias: Ic setb )
  3932. Set the contents of the specified buffer to
  3933. .Ar data .
  3934. The
  3935. .Fl a
  3936. option appends to rather than overwriting the buffer.
  3937. The
  3938. .Fl n
  3939. option renames the buffer to
  3940. .Ar new-buffer-name .
  3941. .It Xo Ic show-buffer
  3942. .Op Fl b Ar buffer-name
  3943. .Xc
  3944. .D1 (alias: Ic showb )
  3945. Display the contents of the specified buffer.
  3946. .El
  3947. .Sh MISCELLANEOUS
  3948. Miscellaneous commands are as follows:
  3949. .Bl -tag -width Ds
  3950. .It Ic clock-mode Op Fl t Ar target-pane
  3951. Display a large clock.
  3952. .It Xo Ic if-shell
  3953. .Op Fl bF
  3954. .Op Fl t Ar target-pane
  3955. .Ar shell-command command
  3956. .Op Ar command
  3957. .Xc
  3958. .D1 (alias: Ic if )
  3959. Execute the first
  3960. .Ar command
  3961. if
  3962. .Ar shell-command
  3963. returns success or the second
  3964. .Ar command
  3965. otherwise.
  3966. Before being executed,
  3967. .Ar shell-command
  3968. is expanded using the rules specified in the
  3969. .Sx FORMATS
  3970. section, including those relevant to
  3971. .Ar target-pane .
  3972. With
  3973. .Fl b ,
  3974. .Ar shell-command
  3975. is run in the background.
  3976. .Pp
  3977. If
  3978. .Fl F
  3979. is given,
  3980. .Ar shell-command
  3981. is not executed but considered success if neither empty nor zero (after formats
  3982. are expanded).
  3983. .It Ic lock-server
  3984. .D1 (alias: Ic lock )
  3985. Lock each client individually by running the command specified by the
  3986. .Ic lock-command
  3987. option.
  3988. .It Xo Ic run-shell
  3989. .Op Fl b
  3990. .Op Fl t Ar target-pane
  3991. .Ar shell-command
  3992. .Xc
  3993. .D1 (alias: Ic run )
  3994. Execute
  3995. .Ar shell-command
  3996. in the background without creating a window.
  3997. Before being executed, shell-command is expanded using the rules specified in
  3998. the
  3999. .Sx FORMATS
  4000. section.
  4001. With
  4002. .Fl b ,
  4003. the command is run in the background.
  4004. After it finishes, any output to stdout is displayed in copy mode (in the pane
  4005. specified by
  4006. .Fl t
  4007. or the current pane if omitted).
  4008. If the command doesn't return success, the exit status is also displayed.
  4009. .It Xo Ic wait-for
  4010. .Op Fl L | S | U
  4011. .Ar channel
  4012. .Xc
  4013. .D1 (alias: Ic wait )
  4014. When used without options, prevents the client from exiting until woken using
  4015. .Ic wait-for
  4016. .Fl S
  4017. with the same channel.
  4018. When
  4019. .Fl L
  4020. is used, the channel is locked and any clients that try to lock the same
  4021. channel are made to wait until the channel is unlocked with
  4022. .Ic wait-for
  4023. .Fl U .
  4024. This command only works from outside
  4025. .Nm .
  4026. .El
  4027. .Sh TERMINFO EXTENSIONS
  4028. .Nm
  4029. understands some unofficial extensions to
  4030. .Xr terminfo 5 :
  4031. .Bl -tag -width Ds
  4032. .It Em Cs , Cr
  4033. Set the cursor colour.
  4034. The first takes a single string argument and is used to set the colour;
  4035. the second takes no arguments and restores the default cursor colour.
  4036. If set, a sequence such as this may be used
  4037. to change the cursor colour from inside
  4038. .Nm :
  4039. .Bd -literal -offset indent
  4040. $ printf '\e033]12;red\e033\e\e'
  4041. .Ed
  4042. .It Em \&Ss , Se
  4043. Set or reset the cursor style.
  4044. If set, a sequence such as this may be used
  4045. to change the cursor to an underline:
  4046. .Bd -literal -offset indent
  4047. $ printf '\e033[4 q'
  4048. .Ed
  4049. .Pp
  4050. If
  4051. .Em Se
  4052. is not set, \&Ss with argument 0 will be used to reset the cursor style instead.
  4053. .It Em \&Tc
  4054. Indicate that the terminal supports the
  4055. .Ql direct colour
  4056. RGB escape sequence (for example, \ee[38;2;255;255;255m).
  4057. .It Em \&Ms
  4058. Store the current buffer in the host terminal's selection (clipboard).
  4059. See the
  4060. .Em set-clipboard
  4061. option above and the
  4062. .Xr xterm 1
  4063. man page.
  4064. .El
  4065. .Sh CONTROL MODE
  4066. .Nm
  4067. offers a textual interface called
  4068. .Em control mode .
  4069. This allows applications to communicate with
  4070. .Nm
  4071. using a simple text-only protocol.
  4072. .Pp
  4073. In control mode, a client sends
  4074. .Nm
  4075. commands or command sequences terminated by newlines on standard input.
  4076. Each command will produce one block of output on standard output.
  4077. An output block consists of a
  4078. .Em %begin
  4079. line followed by the output (which may be empty).
  4080. The output block ends with a
  4081. .Em %end
  4082. or
  4083. .Em %error .
  4084. .Em %begin
  4085. and matching
  4086. .Em %end
  4087. or
  4088. .Em %error
  4089. have two arguments: an integer time (as seconds from epoch) and command number.
  4090. For example:
  4091. .Bd -literal -offset indent
  4092. %begin 1363006971 2
  4093. 0: ksh* (1 panes) [80x24] [layout b25f,80x24,0,0,2] @2 (active)
  4094. %end 1363006971 2
  4095. .Ed
  4096. .Pp
  4097. In control mode,
  4098. .Nm
  4099. outputs notifications.
  4100. A notification will never occur inside an output block.
  4101. .Pp
  4102. The following notifications are defined:
  4103. .Bl -tag -width Ds
  4104. .It Ic %exit Op Ar reason
  4105. The
  4106. .Nm
  4107. client is exiting immediately, either because it is not attached to any session
  4108. or an error occurred.
  4109. If present,
  4110. .Ar reason
  4111. describes why the client exited.
  4112. .It Ic %layout-change Ar window-id Ar window-layout Ar window-visible-layout Ar window-flags
  4113. The layout of a window with ID
  4114. .Ar window-id
  4115. changed.
  4116. The new layout is
  4117. .Ar window-layout .
  4118. The window's visible layout is
  4119. .Ar window-visible-layout
  4120. and the window flags are
  4121. .Ar window-flags .
  4122. .It Ic %output Ar pane-id Ar value
  4123. A window pane produced output.
  4124. .Ar value
  4125. escapes non-printable characters and backslash as octal \\xxx.
  4126. .It Ic %session-changed Ar session-id Ar name
  4127. The client is now attached to the session with ID
  4128. .Ar session-id ,
  4129. which is named
  4130. .Ar name .
  4131. .It Ic %session-renamed Ar name
  4132. The current session was renamed to
  4133. .Ar name .
  4134. .It Ic %sessions-changed
  4135. A session was created or destroyed.
  4136. .It Ic %unlinked-window-add Ar window-id
  4137. The window with ID
  4138. .Ar window-id
  4139. was created but is not linked to the current session.
  4140. .It Ic %window-add Ar window-id
  4141. The window with ID
  4142. .Ar window-id
  4143. was linked to the current session.
  4144. .It Ic %window-close Ar window-id
  4145. The window with ID
  4146. .Ar window-id
  4147. closed.
  4148. .It Ic %window-renamed Ar window-id Ar name
  4149. The window with ID
  4150. .Ar window-id
  4151. was renamed to
  4152. .Ar name .
  4153. .El
  4154. .Sh FILES
  4155. .Bl -tag -width "@SYSCONFDIR@/tmux.confXXX" -compact
  4156. .It Pa ~/.tmux.conf
  4157. Default
  4158. .Nm
  4159. configuration file.
  4160. .It Pa @SYSCONFDIR@/tmux.conf
  4161. System-wide configuration file.
  4162. .El
  4163. .Sh EXAMPLES
  4164. To create a new
  4165. .Nm
  4166. session running
  4167. .Xr vi 1 :
  4168. .Pp
  4169. .Dl $ tmux new-session vi
  4170. .Pp
  4171. Most commands have a shorter form, known as an alias.
  4172. For new-session, this is
  4173. .Ic new :
  4174. .Pp
  4175. .Dl $ tmux new vi
  4176. .Pp
  4177. Alternatively, the shortest unambiguous form of a command is accepted.
  4178. If there are several options, they are listed:
  4179. .Bd -literal -offset indent
  4180. $ tmux n
  4181. ambiguous command: n, could be: new-session, new-window, next-window
  4182. .Ed
  4183. .Pp
  4184. Within an active session, a new window may be created by typing
  4185. .Ql C-b c
  4186. (Ctrl
  4187. followed by the
  4188. .Ql b
  4189. key
  4190. followed by the
  4191. .Ql c
  4192. key).
  4193. .Pp
  4194. Windows may be navigated with:
  4195. .Ql C-b 0
  4196. (to select window 0),
  4197. .Ql C-b 1
  4198. (to select window 1), and so on;
  4199. .Ql C-b n
  4200. to select the next window; and
  4201. .Ql C-b p
  4202. to select the previous window.
  4203. .Pp
  4204. A session may be detached using
  4205. .Ql C-b d
  4206. (or by an external event such as
  4207. .Xr ssh 1
  4208. disconnection) and reattached with:
  4209. .Pp
  4210. .Dl $ tmux attach-session
  4211. .Pp
  4212. Typing
  4213. .Ql C-b \&?
  4214. lists the current key bindings in the current window; up and down may be used
  4215. to navigate the list or
  4216. .Ql q
  4217. to exit from it.
  4218. .Pp
  4219. Commands to be run when the
  4220. .Nm
  4221. server is started may be placed in the
  4222. .Pa ~/.tmux.conf
  4223. configuration file.
  4224. Common examples include:
  4225. .Pp
  4226. Changing the default prefix key:
  4227. .Bd -literal -offset indent
  4228. set-option -g prefix C-a
  4229. unbind-key C-b
  4230. bind-key C-a send-prefix
  4231. .Ed
  4232. .Pp
  4233. Turning the status line off, or changing its colour:
  4234. .Bd -literal -offset indent
  4235. set-option -g status off
  4236. set-option -g status-style bg=blue
  4237. .Ed
  4238. .Pp
  4239. Setting other options, such as the default command,
  4240. or locking after 30 minutes of inactivity:
  4241. .Bd -literal -offset indent
  4242. set-option -g default-command "exec /bin/ksh"
  4243. set-option -g lock-after-time 1800
  4244. .Ed
  4245. .Pp
  4246. Creating new key bindings:
  4247. .Bd -literal -offset indent
  4248. bind-key b set-option status
  4249. bind-key / command-prompt "split-window 'exec man %%'"
  4250. bind-key S command-prompt "new-window -n %1 'ssh %1'"
  4251. .Ed
  4252. .Sh SEE ALSO
  4253. .Xr pty 4
  4254. .Sh AUTHORS
  4255. .An Nicholas Marriott Aq Mt nicholas.marriott@gmail.com