From 982354765bc6f0bfb225d7c1f96e5b73f9880533 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 27 Mar 2013 11:17:12 +0000 Subject: Remove tmux's (already minimal) 88 colour support. Such terminals are few and unnecessary. --- colour.c | 26 -------------------------- options-table.c | 2 +- server-client.c | 2 -- tmux.h | 6 ++---- tty-term.c | 4 +--- tty.c | 32 ++++---------------------------- 6 files changed, 8 insertions(+), 64 deletions(-) diff --git a/colour.c b/colour.c index ff492687..9e90596f 100644 --- a/colour.c +++ b/colour.c @@ -287,29 +287,3 @@ colour_256to16(u_char c) return (table[c]); } - -/* Convert 256 colour palette to 88. */ -u_char -colour_256to88(u_char c) -{ - static const u_char table[256] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 17, 18, 18, 19, 20, 21, 21, 22, 22, 23, 20, 21, 21, 22, - 22, 23, 24, 25, 25, 26, 26, 27, 24, 25, 25, 26, 26, 27, 28, 29, - 29, 30, 30, 31, 32, 33, 33, 34, 34, 35, 36, 37, 37, 38, 38, 39, - 36, 37, 37, 38, 38, 39, 40, 41, 41, 42, 42, 43, 40, 41, 41, 42, - 42, 43, 44, 45, 45, 46, 46, 47, 32, 33, 33, 34, 34, 35, 36, 37, - 37, 38, 38, 39, 36, 37, 37, 38, 38, 39, 40, 41, 41, 42, 42, 43, - 40, 41, 41, 42, 42, 43, 44, 45, 45, 46, 46, 47, 48, 49, 49, 50, - 50, 51, 52, 53, 53, 54, 54, 55, 52, 53, 53, 54, 54, 55, 56, 57, - 57, 58, 58, 59, 56, 57, 57, 58, 58, 59, 60, 61, 61, 62, 62, 63, - 48, 49, 49, 50, 50, 51, 52, 53, 53, 54, 54, 55, 52, 53, 53, 54, - 54, 55, 56, 57, 57, 58, 58, 59, 56, 57, 57, 58, 58, 59, 60, 61, - 61, 62, 62, 63, 64, 65, 65, 66, 66, 67, 68, 69, 69, 70, 70, 71, - 68, 69, 69, 70, 70, 71, 72, 73, 73, 74, 74, 75, 72, 73, 73, 74, - 74, 75, 76, 77, 77, 78, 78, 79, 0, 0, 80, 80, 80, 81, 81, 81, - 82, 82, 82, 83, 83, 83, 84, 84, 84, 85, 85, 85, 86, 86, 86, 87 - }; - - return (table[c]); -} diff --git a/options-table.c b/options-table.c index ae711882..c4ada1f2 100644 --- a/options-table.c +++ b/options-table.c @@ -414,7 +414,7 @@ const struct options_table_entry session_options_table[] = { { .name = "terminal-overrides", .type = OPTIONS_TABLE_STRING, - .default_str = "*88col*:colors=88,*256col*:colors=256" + .default_str = "*256col*:colors=256" ",xterm*:XT:Ms=\\E]52;%p1%s;%p2%s\\007" ":Cc=\\E]12;%p1%s\\007:Cr=\\E]112\\007" ":Cs=\\E[%p1%d q:Csr=\\E[2 q,screen*:XT" diff --git a/server-client.c b/server-client.c index f61912bc..ac4ecf29 100644 --- a/server-client.c +++ b/server-client.c @@ -981,8 +981,6 @@ server_client_msg_identify( c->tty.flags |= TTY_UTF8; if (data->flags & IDENTIFY_256COLOURS) c->tty.term_flags |= TERM_256COLOURS; - else if (data->flags & IDENTIFY_88COLOURS) - c->tty.term_flags |= TERM_88COLOURS; tty_resize(&c->tty); diff --git a/tmux.h b/tmux.h index 10da2bee..053b574e 100644 --- a/tmux.h +++ b/tmux.h @@ -481,7 +481,7 @@ struct msg_identify_data { #define IDENTIFY_UTF8 0x1 #define IDENTIFY_256COLOURS 0x2 -#define IDENTIFY_88COLOURS 0x4 +/* 0x4 unused */ #define IDENTIFY_CONTROL 0x8 #define IDENTIFY_TERMIOS 0x10 int flags; @@ -1141,8 +1141,7 @@ struct tty_term { struct tty_code codes[NTTYCODE]; #define TERM_256COLOURS 0x1 -#define TERM_88COLOURS 0x2 -#define TERM_EARLYWRAP 0x4 +#define TERM_EARLYWRAP 0x2 int flags; LIST_ENTRY(tty_term) entry; @@ -1986,7 +1985,6 @@ void colour_set_bg(struct grid_cell *, int); const char *colour_tostring(int); int colour_fromstring(const char *); u_char colour_256to16(u_char); -u_char colour_256to88(u_char); /* attributes.c */ const char *attributes_tostring(u_char); diff --git a/tty-term.c b/tty-term.c index c827a444..254569f6 100644 --- a/tty-term.c +++ b/tty-term.c @@ -404,11 +404,9 @@ tty_term_find(char *name, int fd, const char *overrides, char **cause) goto error; } - /* Figure out if we have 256 or 88 colours. */ + /* Figure out if we have 256. */ if (tty_term_number(term, TTYC_COLORS) == 256) term->flags |= TERM_256COLOURS; - if (tty_term_number(term, TTYC_COLORS) == 88) - term->flags |= TERM_88COLOURS; /* * Terminals without xenl (eat newline glitch) wrap at at $COLUMNS - 1 diff --git a/tty.c b/tty.c index 75a2f657..bffddac6 100644 --- a/tty.c +++ b/tty.c @@ -35,7 +35,6 @@ void tty_read_callback(struct bufferevent *, void *); void tty_error_callback(struct bufferevent *, short, void *); int tty_try_256(struct tty *, u_char, const char *); -int tty_try_88(struct tty *, u_char, const char *); void tty_colours(struct tty *, const struct grid_cell *); void tty_check_fg(struct tty *, struct grid_cell *); @@ -1446,9 +1445,7 @@ tty_check_fg(struct tty *tty, struct grid_cell *gc) /* Is this a 256-colour colour? */ if (gc->flags & GRID_FLAG_FG256) { /* And not a 256 colour mode? */ - if (!(tty->term->flags & TERM_88COLOURS) && - !(tty->term_flags & TERM_88COLOURS) && - !(tty->term->flags & TERM_256COLOURS) && + if (!(tty->term->flags & TERM_256COLOURS) && !(tty->term_flags & TERM_256COLOURS)) { gc->fg = colour_256to16(gc->fg); if (gc->fg & 8) { @@ -1481,9 +1478,7 @@ tty_check_bg(struct tty *tty, struct grid_cell *gc) * palette. Bold background doesn't exist portably, so just * discard the bold bit if set. */ - if (!(tty->term->flags & TERM_88COLOURS) && - !(tty->term_flags & TERM_88COLOURS) && - !(tty->term->flags & TERM_256COLOURS) && + if (!(tty->term->flags & TERM_256COLOURS) && !(tty->term_flags & TERM_256COLOURS)) { gc->bg = colour_256to16(gc->bg); if (gc->bg & 8) @@ -1511,11 +1506,9 @@ tty_colours_fg(struct tty *tty, const struct grid_cell *gc) /* Is this a 256-colour colour? */ if (gc->flags & GRID_FLAG_FG256) { - /* Try as 256 colours or translating to 88. */ + /* Try as 256 colours. */ if (tty_try_256(tty, fg, "38") == 0) goto save_fg; - if (tty_try_88(tty, fg, "38") == 0) - goto save_fg; /* Else already handled by tty_check_fg. */ return; } @@ -1546,11 +1539,9 @@ tty_colours_bg(struct tty *tty, const struct grid_cell *gc) /* Is this a 256-colour colour? */ if (gc->flags & GRID_FLAG_BG256) { - /* Try as 256 colours or translating to 88. */ + /* Try as 256 colours. */ if (tty_try_256(tty, bg, "48") == 0) goto save_bg; - if (tty_try_88(tty, bg, "48") == 0) - goto save_bg; /* Else already handled by tty_check_bg. */ return; } @@ -1591,21 +1582,6 @@ tty_try_256(struct tty *tty, u_char colour, const char *type) return (0); } -int -tty_try_88(struct tty *tty, u_char colour, const char *type) -{ - char s[32]; - - if (!(tty->term->flags & TERM_88COLOURS) && - !(tty->term_flags & TERM_88COLOURS)) - return (-1); - colour = colour_256to88(colour); - - xsnprintf(s, sizeof s, "\033[%s;5;%hhum", type, colour); - tty_puts(tty, s); - return (0); -} - void tty_bell(struct tty *tty) { -- cgit From 5e4d9a3197a229ecb30d51f5b7e6756ef31dc1d2 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 27 Mar 2013 11:19:19 +0000 Subject: Move the cursor back into the last column on CUU/CUD to match xterm behaviour. From George Nachman. --- screen-write.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/screen-write.c b/screen-write.c index 348065c6..c0935c95 100644 --- a/screen-write.c +++ b/screen-write.c @@ -488,6 +488,8 @@ screen_write_cursorup(struct screen_write_ctx *ctx, u_int ny) if (ny > s->cy - s->rupper) ny = s->cy - s->rupper; } + if (s->cx == screen_size_x(s)) + s->cx--; if (ny == 0) return; @@ -512,6 +514,8 @@ screen_write_cursordown(struct screen_write_ctx *ctx, u_int ny) if (ny > s->rlower - s->cy) ny = s->rlower - s->cy; } + if (s->cx == screen_size_x(s)) + s->cx--; if (ny == 0) return; -- cgit From 7f636587098593c6c0efd3feaecb970aa7170116 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 27 Mar 2013 11:24:18 +0000 Subject: Add TMUX_TMPDIR variable to put the socket directory outside TMPDIR. From Ben Boeckel. --- tmux.1 | 13 +++++-------- tmux.c | 15 ++++++--------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/tmux.1 b/tmux.1 index 0dc68bfe..9b1488fc 100644 --- a/tmux.1 +++ b/tmux.1 @@ -98,10 +98,6 @@ The options are as follows: Force .Nm to assume the terminal supports 256 colours. -.It Fl 8 -Like -.Fl 2 , -but indicates that the terminal supports 88 colours. .It Fl C Start in control mode. Given twice @@ -145,11 +141,12 @@ session created, and continues to process the rest of the configuration file. .It Fl L Ar socket-name .Nm stores the server socket in a directory under -.Pa /tmp -(or +.Ev TMUX_TMPDIR , .Ev TMPDIR -if set); -the default socket is named +if it is unset, or +.Pa /tmp +if both are unset. +The default socket is named .Em default . This option allows a different socket name to be specified, allowing several independent diff --git a/tmux.c b/tmux.c index 368562f8..1f4057dc 100644 --- a/tmux.c +++ b/tmux.c @@ -164,10 +164,12 @@ makesocketpath(const char *label) u_int uid; uid = getuid(); - if ((s = getenv("TMPDIR")) == NULL || *s == '\0') - xsnprintf(base, sizeof base, "%s/tmux-%u", _PATH_TMP, uid); - else + if ((s = getenv("TMUX_TMPDIR")) != NULL && *s != '\0') + xsnprintf(base, sizeof base, "%s/", s); + else if ((s = getenv("TMPDIR")) != NULL && *s != '\0') xsnprintf(base, sizeof base, "%s/tmux-%u", s, uid); + else + xsnprintf(base, sizeof base, "%s/tmux-%u", _PATH_TMP, uid); if (mkdir(base, S_IRWXU) != 0 && errno != EEXIST) return (NULL); @@ -244,15 +246,10 @@ main(int argc, char **argv) quiet = flags = 0; label = path = NULL; login_shell = (**argv == '-'); - while ((opt = getopt(argc, argv, "28c:Cdf:lL:qS:uUv")) != -1) { + while ((opt = getopt(argc, argv, "2c:Cdf:lL:qS:uUv")) != -1) { switch (opt) { case '2': flags |= IDENTIFY_256COLOURS; - flags &= ~IDENTIFY_88COLOURS; - break; - case '8': - flags |= IDENTIFY_88COLOURS; - flags &= ~IDENTIFY_256COLOURS; break; case 'c': free(shell_cmd); -- cgit From 66afcf5be092ed0ab86d1d4059426823e72c63d5 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 28 Mar 2013 15:07:42 +0000 Subject: Make copy-mode -u still scroll up if already in copy mode, handy for people who bind it with -n. --- cmd-copy-mode.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd-copy-mode.c b/cmd-copy-mode.c index 59b5a9e5..883a9376 100644 --- a/cmd-copy-mode.c +++ b/cmd-copy-mode.c @@ -54,9 +54,11 @@ cmd_copy_mode_exec(struct cmd *self, struct cmd_q *cmdq) if (cmd_find_pane(cmdq, args_get(args, 't'), NULL, &wp) == NULL) return (CMD_RETURN_ERROR); - if (window_pane_set_mode(wp, &window_copy_mode) != 0) - return (CMD_RETURN_NORMAL); - window_copy_init_from_pane(wp); + if (wp->mode != &window_copy_mode) { + if (window_pane_set_mode(wp, &window_copy_mode) != 0) + return (CMD_RETURN_NORMAL); + window_copy_init_from_pane(wp); + } if (wp->mode == &window_copy_mode && args_has(self->args, 'u')) window_copy_pageup(wp); -- cgit From 738e789dbd7712ab94073036cf4e903abc68447f Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 28 Mar 2013 15:08:12 +0000 Subject: If -s to swap-pane is not given, use the current pane. --- cmd-swap-pane.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd-swap-pane.c b/cmd-swap-pane.c index e7ea6242..e6b46d67 100644 --- a/cmd-swap-pane.c +++ b/cmd-swap-pane.c @@ -75,8 +75,12 @@ cmd_swap_pane_exec(struct cmd *self, struct cmd_q *cmdq) src_wp = TAILQ_PREV(dst_wp, window_panes, entry); if (src_wp == NULL) src_wp = TAILQ_LAST(&dst_w->panes, window_panes); - } else - return (CMD_RETURN_NORMAL); + } else { + src_wl = cmd_find_pane(cmdq, NULL, NULL, &src_wp); + if (src_wl == NULL) + return (CMD_RETURN_ERROR); + src_w = src_wl->window; + } } else { src_wl = cmd_find_pane(cmdq, args_get(args, 's'), NULL, &src_wp); if (src_wl == NULL) -- cgit From 69c86379e39476013205fce627951dd733d647b3 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 10 Apr 2013 11:51:16 +0000 Subject: Remove some code not needed on OpenBSD. --- server-client.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/server-client.c b/server-client.c index ac4ecf29..6cacefa7 100644 --- a/server-client.c +++ b/server-client.c @@ -534,18 +534,8 @@ server_client_check_resize(struct window_pane *wp) ws.ws_col = wp->sx; ws.ws_row = wp->sy; - if (ioctl(wp->fd, TIOCSWINSZ, &ws) == -1) { -#ifdef __sun - /* - * Some versions of Solaris apparently can return an error when - * resizing; don't know why this happens, can't reproduce on - * other platforms and ignoring it doesn't seem to cause any - * issues. - */ - if (errno != EINVAL) -#endif + if (ioctl(wp->fd, TIOCSWINSZ, &ws) == -1) fatal("ioctl failed"); - } wp->flags &= ~PANE_RESIZE; } -- cgit From e312db140868754358d40ec17595327a8fbbf180 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 10 Apr 2013 13:04:19 +0100 Subject: Add wait-for to tmux.vim from Ben Boeckel. --- examples/tmux.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tmux.vim b/examples/tmux.vim index 076115c1..e85f8ff6 100644 --- a/examples/tmux.vim +++ b/examples/tmux.vim @@ -56,7 +56,7 @@ syn keyword tmuxCmds \ list-buffers loadb load-buffer pasteb paste-buffer saveb save-buffer \ setb set-buffer showb show-buffer \ clock-mode if[-shell] lock[-server] run[-shell] server-info info - \ choose-list + \ choose-list wait-for syn keyword tmuxOptsSet \ buffer-limit escape-time exit-unattached exit-unattached quiet -- cgit From 20f0d917beb0f774af2628ed7efe2a33cf59f42a Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 10 Apr 2013 12:07:18 +0000 Subject: Missed -o from set-window-option, from Ben Boeckel. --- tmux.1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tmux.1 b/tmux.1 index 9b1488fc..b38b43bb 100644 --- a/tmux.1 +++ b/tmux.1 @@ -2645,7 +2645,7 @@ The default is .Ql \ -_@ . .El .It Xo Ic set-window-option -.Op Fl agqu +.Op Fl agoqu .Op Fl t Ar target-window .Ar option Ar value .Xc @@ -2654,6 +2654,7 @@ Set a window option. The .Fl a , .Fl g , +.Fl o , .Fl q and .Fl u -- cgit From 7ada64d5f8a0df39229c41b992c0ee8ac9f0a1d7 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 10 Apr 2013 12:15:36 +0000 Subject: Fix bug where end guard in control mode was not printed after session destroyed, from George Nachman. --- cmd-queue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd-queue.c b/cmd-queue.c index b1c0a4eb..a64d332c 100644 --- a/cmd-queue.c +++ b/cmd-queue.c @@ -158,7 +158,7 @@ cmdq_guard(struct cmd_q *cmdq, const char *guard) { struct client *c = cmdq->client; - if (c == NULL || c->session == NULL) + if (c == NULL) return 0; if (!(c->flags & CLIENT_CONTROL)) return 0; -- cgit From 9fcda95a6f55f017536cdf24366754a2304c1059 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 10 Apr 2013 12:20:35 +0000 Subject: Set EV_WRITE for jobs or run/if-shell jobs can hang. From Chris Johnsen. --- job.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/job.c b/job.c index b76b3345..291e000e 100644 --- a/job.c +++ b/job.c @@ -109,7 +109,7 @@ job_run(const char *cmd, struct session *s, job->event = bufferevent_new(job->fd, NULL, job_write_callback, job_callback, job); - bufferevent_enable(job->event, EV_READ); + bufferevent_enable(job->event, EV_READ|EV_WRITE); log_debug("run job %p: %s, pid %ld", job, job->cmd, (long) job->pid); return (job); -- cgit From cbee283c26968304b473e2191d2bb5f52208b58d Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 11 Apr 2013 07:27:27 +0000 Subject: Send an SGR0 after turning on modifyOtherKeys to fix Terminal.app which treats \033[>4;1m and \033[4;1m (bold+underline). Reported & tested by otto@. --- tty.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tty.c b/tty.c index bffddac6..74988eb3 100644 --- a/tty.c +++ b/tty.c @@ -220,7 +220,7 @@ tty_start_tty(struct tty *tty) tty_puts(tty, "\033[?1000l\033[?1006l\033[?1005l"); if (tty_term_has(tty->term, TTYC_XT)) - tty_puts(tty, "\033[c\033[>4;1m\033[?1004h"); + tty_puts(tty, "\033[c\033[>4;1m\033[?1004h\033[m"); tty->cx = UINT_MAX; tty->cy = UINT_MAX; @@ -283,7 +283,7 @@ tty_stop_tty(struct tty *tty) tty_raw(tty, "\033[?1000l\033[?1006l\033[?1005l"); if (tty_term_has(tty->term, TTYC_XT)) - tty_raw(tty, "\033[>4m\033[?1004l"); + tty_raw(tty, "\033[>4m\033[?1004l\033[m"); tty_raw(tty, tty_term_string(tty->term, TTYC_RMCUP)); -- cgit From 4ccb2e2c218a10a8039ca801231aaf09b6bf3bce Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 11 Apr 2013 22:45:05 +0100 Subject: TODO tweaks. --- TODO | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TODO b/TODO index d3e3b46b..92b60a9a 100644 --- a/TODO +++ b/TODO @@ -47,7 +47,7 @@ - hooks! - warts on current naming: - * display-time but message-fg/bg/attr + * display-time but message-fg/bg/attr * list-* vs show-* * server-info * split-window -> split-pane?? @@ -55,6 +55,7 @@ - way to keep a job running just read its last line of output for #() - better UTF-8 support: + * #22T can split in the middle of UTF-8 characters! * window names and titles * message display * prompt input -- cgit From 7f9b225cc269211b86a4c4d2168146c217d63118 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 11 Apr 2013 21:52:18 +0000 Subject: Call setlocale(LC_TIME) at startup. --- clock.c | 15 +++++++++++---- tmux.c | 3 +++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/clock.c b/clock.c index 00d818be..283a4a1e 100644 --- a/clock.c +++ b/clock.c @@ -103,13 +103,20 @@ clock_draw(struct screen_write_ctx *ctx, int colour, int style) struct grid_cell gc; char tim[64], *ptr; time_t t; + struct tm *tm; u_int i, j, x, y, idx; t = time(NULL); - if (style == 0) - strftime(tim, sizeof tim, "%l:%M %p", localtime(&t)); - else - strftime(tim, sizeof tim, "%H:%M", localtime(&t)); + tm = localtime(&t); + if (style == 0) { + strftime(tim, sizeof tim, "%l:%M ", localtime(&t)); + if (tm->tm_hour >= 12) + strlcat(tim, "PM", sizeof tim); + else + strlcat(tim, "AM", sizeof tim); + } else + strftime(tim, sizeof tim, "%H:%M", tm); + screen_write_clearscreen(ctx); diff --git a/tmux.c b/tmux.c index 1f4057dc..e9b28d7e 100644 --- a/tmux.c +++ b/tmux.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -243,6 +244,8 @@ main(int argc, char **argv) malloc_options = (char *) "AFGJPX"; #endif + setlocale(LC_TIME, ""); + quiet = flags = 0; label = path = NULL; login_shell = (**argv == '-'); -- cgit From caa8290510244990b26106e027aa253237ada629 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Fri, 12 Apr 2013 12:44:31 +0000 Subject: Copy the client into the new cmdq in source-file so commands that work on it (such as new-session) can work. Fixes issue reported by oss-adv at users dot sf dot net. --- cmd-source-file.c | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd-source-file.c b/cmd-source-file.c index 1bd2bb0a..f50efbe3 100644 --- a/cmd-source-file.c +++ b/cmd-source-file.c @@ -49,6 +49,7 @@ cmd_source_file_exec(struct cmd *self, struct cmd_q *cmdq) char *cause; cmdq1 = cmdq_new(NULL); + cmdq1->client = cmdq->client; cmdq1->emptyfn = cmd_source_file_done; cmdq1->data = cmdq; -- cgit From 27dcf470dc4aa5901ac7f01b3a9f971e02f2229e Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Fri, 12 Apr 2013 12:50:36 +0000 Subject: Remove some Korean characters from the zero-width list that apparently shouldn't be there, from Jeong Mok Cho. --- utf8.c | 1 - 1 file changed, 1 deletion(-) diff --git a/utf8.c b/utf8.c index b276d872..1c81392b 100644 --- a/utf8.c +++ b/utf8.c @@ -171,7 +171,6 @@ struct utf8_width_entry utf8_width_table[] = { { 0x30000, 0x3fffd, 2, NULL, NULL }, { 0x00711, 0x00711, 0, NULL, NULL }, { 0x0fe00, 0x0fe0f, 0, NULL, NULL }, - { 0x01160, 0x011ff, 0, NULL, NULL }, { 0x0180b, 0x0180d, 0, NULL, NULL }, { 0x10a3f, 0x10a3f, 0, NULL, NULL }, { 0x00981, 0x00981, 0, NULL, NULL }, -- cgit From 2c4543b9e9bd38bcc45393dad94930bcde872e6c Mon Sep 17 00:00:00 2001 From: Thomas Adam Date: Sun, 14 Apr 2013 18:07:08 +0100 Subject: Add back missing -V flag This went walkies from a previous git commit. --- tmux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmux.c b/tmux.c index e8fd98b2..e6de5cfe 100644 --- a/tmux.c +++ b/tmux.c @@ -253,7 +253,7 @@ main(int argc, char **argv) quiet = flags = 0; label = path = NULL; login_shell = (**argv == '-'); - while ((opt = getopt(argc, argv, "2c:Cdf:lL:qS:uUv")) != -1) { + while ((opt = getopt(argc, argv, "2c:Cdf:lL:qS:uUVv")) != -1) { switch (opt) { case '2': flags |= IDENTIFY_256COLOURS; -- cgit From c24b58e2ee8691870736959deb252c225b205b4d Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 16 Apr 2013 11:33:53 +0100 Subject: Generate tmux.1 using mdoc2man.awk on Solaris, issue brought up and changes tested by Dagobert Michelsen. --- .gitignore | 1 + Makefile.am | 14 +- configure.ac | 5 + mdoc2man.awk | 370 ++++++ tmux.1 | 3808 ---------------------------------------------------------- tmux.1.in | 3808 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 4196 insertions(+), 3810 deletions(-) create mode 100644 mdoc2man.awk delete mode 100644 tmux.1 create mode 100644 tmux.1.in diff --git a/.gitignore b/.gitignore index c3906ada..3b400861 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ tmux Makefile Makefile.in configure +tmux.1 diff --git a/Makefile.am b/Makefile.am index 2ce54b1a..b85eae0c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,12 +2,14 @@ # Obvious program stuff. bin_PROGRAMS = tmux -dist_man1_MANS = tmux.1 +nodist_man1_MANS = tmux.1 +CLEANFILES = tmux.1 # Distribution tarball options. EXTRA_DIST = \ CHANGES FAQ README TODO examples compat \ - array.h compat.h tmux.h osdep-*.c + array.h compat.h tmux.h osdep-*.c mdoc2man.awk \ + tmux.1.in dist-hook: grep "^#found_debug=" configure find $(distdir) -name .svn -type d|xargs rm -Rf @@ -232,6 +234,14 @@ if NO_B64_NTOP nodist_tmux_SOURCES += compat/b64_ntop.c endif +# Build tmux.1 in the right format. +tmux.1: tmux.1.in + if test x@MANFORMAT@ = xmdoc; then \ + cp tmux.1.in tmux.1; \ + else \ + $(AWK) -fmdoc2man.awk tmux.1.in >tmux.1; \ + fi + # Update SF web site. upload-index.html: update-index.html scp www/index.html www/main.css www/images/*.png \ diff --git a/configure.ac b/configure.ac index f00937f0..b4f76f5f 100644 --- a/configure.ac +++ b/configure.ac @@ -416,6 +416,10 @@ else AC_MSG_RESULT(no) fi +# Man page defaults to mdoc. +MANFORMAT=mdoc +AC_SUBST(MANFORMAT) + # Figure out the platform for osdep-*.c and forkpty-*.c. AC_MSG_CHECKING(platform) case "$host_os" in @@ -455,6 +459,7 @@ case "$host_os" in *solaris*) AC_MSG_RESULT(sunos) PLATFORM=sunos + MANFORMAT=man ;; *hpux*) AC_MSG_RESULT(hpux) diff --git a/mdoc2man.awk b/mdoc2man.awk new file mode 100644 index 00000000..80e8d5ff --- /dev/null +++ b/mdoc2man.awk @@ -0,0 +1,370 @@ +#!/usr/bin/awk +# +# $Id: mdoc2man.awk,v 1.9 2009/10/24 00:52:42 dtucker Exp $ +# +# Version history: +# v4+ Adapted for OpenSSH Portable (see cvs Id and history) +# v3, I put the program under a proper license +# Dan Nelson added .An, .Aq and fixed a typo +# v2, fixed to work on GNU awk --posix and MacOS X +# v1, first attempt, didn't work on MacOS X +# +# Copyright (c) 2003 Peter Stuge +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + +BEGIN { + optlist=0 + oldoptlist=0 + nospace=0 + synopsis=0 + reference=0 + block=0 + ext=0 + extopt=0 + literal=0 + prenl=0 + breakw=0 + line="" +} + +function wtail() { + retval="" + while(w0;i--) { + add(refauthors[i]) + if(i>1) + add(", ") + } + if(nrefauthors>1) + add(" and ") + if(nrefauthors>0) + add(refauthors[0] ", ") + add("\\fI" reftitle "\\fP") + if(length(refissue)) + add(", " refissue) + if(length(refreport)) { + add(", " refreport) + } + if(length(refdate)) + add(", " refdate) + if(length(refopt)) + add(", " refopt) + add(".") + reference=0 + } else if(reference) { + if(match(words[w],"^%A$")) { refauthors[nrefauthors++]=wtail() } + if(match(words[w],"^%T$")) { + reftitle=wtail() + sub("^\"","",reftitle) + sub("\"$","",reftitle) + } + if(match(words[w],"^%N$")) { refissue=wtail() } + if(match(words[w],"^%D$")) { refdate=wtail() } + if(match(words[w],"^%O$")) { refopt=wtail() } + if(match(words[w],"^%R$")) { refreport=wtail() } + } else if(match(words[w],"^Nm$")) { + if(synopsis) { + add(".br") + prenl++ + } + n=words[++w] + if(!length(name)) + name=n + if(!length(n)) + n=name + add("\\fB" n "\\fP") + if(!nospace&&match(words[w+1],"^[\\.,]")) + nospace=1 + } else if(match(words[w],"^Nd$")) { + add("\\- " wtail()) + } else if(match(words[w],"^Fl$")) { + add("\\fB\\-" words[++w] "\\fP") + if(!nospace&&match(words[w+1],"^[\\.,]")) + nospace=1 + } else if(match(words[w],"^Ar$")) { + add("\\fI") + if(w==nwords) + add("file ...\\fP") + else { + add(words[++w] "\\fP") + while(match(words[w+1],"^\\|$")) + add(OFS words[++w] " \\fI" words[++w] "\\fP") + } + if(!nospace&&match(words[w+1],"^[\\.,]")) + nospace=1 + } else if(match(words[w],"^Cm$")) { + add("\\fB" words[++w] "\\fP") + while(w") + if(option) + add("]") + if(ext&&!extopt&&!match(line," $")) + add(OFS) + if(!ext&&!extopt&&length(line)) { + print line + prenl=0 + line="" + } +} diff --git a/tmux.1 b/tmux.1 deleted file mode 100644 index 98bf9574..00000000 --- a/tmux.1 +++ /dev/null @@ -1,3808 +0,0 @@ -.\" $Id$ -.\" -.\" Copyright (c) 2007 Nicholas Marriott -.\" -.\" Permission to use, copy, modify, and distribute this software for any -.\" purpose with or without fee is hereby granted, provided that the above -.\" copyright notice and this permission notice appear in all copies. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -.\" WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER -.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING -.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -.\" -.Dd $Mdocdate: March 25 2013 $ -.Dt TMUX 1 -.Os -.Sh NAME -.Nm tmux -.Nd terminal multiplexer -.Sh SYNOPSIS -.Nm tmux -.Bk -words -.Op Fl 28lCquvV -.Op Fl c Ar shell-command -.Op Fl f Ar file -.Op Fl L Ar socket-name -.Op Fl S Ar socket-path -.Op Ar command Op Ar flags -.Ek -.Sh DESCRIPTION -.Nm -is a terminal multiplexer: -it enables a number of terminals to be created, accessed, and -controlled from a single screen. -.Nm -may be detached from a screen -and continue running in the background, -then later reattached. -.Pp -When -.Nm -is started it creates a new -.Em session -with a single -.Em window -and displays it on screen. -A status line at the bottom of the screen -shows information on the current session -and is used to enter interactive commands. -.Pp -A session is a single collection of -.Em pseudo terminals -under the management of -.Nm . -Each session has one or more -windows linked to it. -A window occupies the entire screen -and may be split into rectangular panes, -each of which is a separate pseudo terminal -(the -.Xr pty 4 -manual page documents the technical details of pseudo terminals). -Any number of -.Nm -instances may connect to the same session, -and any number of windows may be present in the same session. -Once all sessions are killed, -.Nm -exits. -.Pp -Each session is persistent and will survive accidental disconnection -(such as -.Xr ssh 1 -connection timeout) or intentional detaching (with the -.Ql C-b d -key strokes). -.Nm -may be reattached using: -.Pp -.Dl $ tmux attach -.Pp -In -.Nm , -a session is displayed on screen by a -.Em client -and all sessions are managed by a single -.Em server . -The server and each client are separate processes which communicate through a -socket in -.Pa /tmp . -.Pp -The options are as follows: -.Bl -tag -width "XXXXXXXXXXXX" -.It Fl 2 -Force -.Nm -to assume the terminal supports 256 colours. -.It Fl C -Start in control mode. -Given twice -.Xo ( Fl CC ) Xc -disables echo. -.It Fl c Ar shell-command -Execute -.Ar shell-command -using the default shell. -If necessary, the -.Nm -server will be started to retrieve the -.Ic default-shell -option. -This option is for compatibility with -.Xr sh 1 -when -.Nm -is used as a login shell. -.It Fl f Ar file -Specify an alternative configuration file. -By default, -.Nm -loads the system configuration file from -.Pa /etc/tmux.conf , -if present, then looks for a user configuration file at -.Pa ~/.tmux.conf . -.Pp -The configuration file is a set of -.Nm -commands which are executed in sequence when the server is first started. -.Nm -loads configuration files once when the server process has started. -The -.Ic source-file -command may be used to load a file later. -.Pp -.Nm -shows any error messages from commands in configuration files in the first -session created, and continues to process the rest of the configuration file. -.It Fl L Ar socket-name -.Nm -stores the server socket in a directory under -.Ev TMUX_TMPDIR , -.Ev TMPDIR -if it is unset, or -.Pa /tmp -if both are unset. -The default socket is named -.Em default . -This option allows a different socket name to be specified, allowing several -independent -.Nm -servers to be run. -Unlike -.Fl S -a full path is not necessary: the sockets are all created in the same -directory. -.Pp -If the socket is accidentally removed, the -.Dv SIGUSR1 -signal may be sent to the -.Nm -server process to recreate it. -.It Fl l -Behave as a login shell. -This flag currently has no effect and is for compatibility with other shells -when using tmux as a login shell. -.It Fl q -Set the -.Ic quiet -server option to prevent the server sending various informational messages. -.It Fl S Ar socket-path -Specify a full alternative path to the server socket. -If -.Fl S -is specified, the default socket directory is not used and any -.Fl L -flag is ignored. -.It Fl u -.Nm -attempts to guess if the terminal is likely to support UTF-8 by checking the -first of the -.Ev LC_ALL , -.Ev LC_CTYPE -and -.Ev LANG -environment variables to be set for the string "UTF-8". -This is not always correct: the -.Fl u -flag explicitly informs -.Nm -that UTF-8 is supported. -.Pp -If the server is started from a client passed -.Fl u -or where UTF-8 is detected, the -.Ic utf8 -and -.Ic status-utf8 -options are enabled in the global window and session options respectively. -.It Fl v -Request verbose logging. -This option may be specified multiple times for increasing verbosity. -Log messages will be saved into -.Pa tmux-client-PID.log -and -.Pa tmux-server-PID.log -files in the current directory, where -.Em PID -is the PID of the server or client process. -.It Fl V -Report the -.Nm -version. -.It Ar command Op Ar flags -This specifies one of a set of commands used to control -.Nm , -as described in the following sections. -If no commands are specified, the -.Ic new-session -command is assumed. -.El -.Sh KEY BINDINGS -.Nm -may be controlled from an attached client by using a key combination of a -prefix key, -.Ql C-b -(Ctrl-b) by default, followed by a command key. -.Pp -The default command key bindings are: -.Pp -.Bl -tag -width "XXXXXXXXXX" -offset indent -compact -.It C-b -Send the prefix key (C-b) through to the application. -.It C-o -Rotate the panes in the current window forwards. -.It C-z -Suspend the -.Nm -client. -.It ! -Break the current pane out of the window. -.It \&" -Split the current pane into two, top and bottom. -.It # -List all paste buffers. -.It $ -Rename the current session. -.It % -Split the current pane into two, left and right. -.It & -Kill the current window. -.It ' -Prompt for a window index to select. -.It , -Rename the current window. -.It - -Delete the most recently copied buffer of text. -.It . -Prompt for an index to move the current window. -.It 0 to 9 -Select windows 0 to 9. -.It : -Enter the -.Nm -command prompt. -.It ; -Move to the previously active pane. -.It = -Choose which buffer to paste interactively from a list. -.It \&? -List all key bindings. -.It D -Choose a client to detach. -.It \&[ -Enter copy mode to copy text or view the history. -.It \&] -Paste the most recently copied buffer of text. -.It c -Create a new window. -.It d -Detach the current client. -.It f -Prompt to search for text in open windows. -.It i -Display some information about the current window. -.It l -Move to the previously selected window. -.It n -Change to the next window. -.It o -Select the next pane in the current window. -.It p -Change to the previous window. -.It q -Briefly display pane indexes. -.It r -Force redraw of the attached client. -.It s -Select a new session for the attached client interactively. -.It L -Switch the attached client back to the last session. -.It t -Show the time. -.It w -Choose the current window interactively. -.It x -Kill the current pane. -.It { -Swap the current pane with the previous pane. -.It } -Swap the current pane with the next pane. -.It ~ -Show previous messages from -.Nm , -if any. -.It Page Up -Enter copy mode and scroll one page up. -.It Up, Down -.It Left, Right -Change to the pane above, below, to the left, or to the right of the current -pane. -.It M-1 to M-5 -Arrange panes in one of the five preset layouts: even-horizontal, -even-vertical, main-horizontal, main-vertical, or tiled. -.It M-n -Move to the next window with a bell or activity marker. -.It M-o -Rotate the panes in the current window backwards. -.It M-p -Move to the previous window with a bell or activity marker. -.It C-Up, C-Down -.It C-Left, C-Right -Resize the current pane in steps of one cell. -.It M-Up, M-Down -.It M-Left, M-Right -Resize the current pane in steps of five cells. -.El -.Pp -Key bindings may be changed with the -.Ic bind-key -and -.Ic unbind-key -commands. -.Sh COMMANDS -This section contains a list of the commands supported by -.Nm . -Most commands accept the optional -.Fl t -argument with one of -.Ar target-client , -.Ar target-session -.Ar target-window , -or -.Ar target-pane . -These specify the client, session, window or pane which a command should affect. -.Ar target-client -is the name of the -.Xr pty 4 -file to which the client is connected, for example either of -.Pa /dev/ttyp1 -or -.Pa ttyp1 -for the client attached to -.Pa /dev/ttyp1 . -If no client is specified, the current client is chosen, if possible, or an -error is reported. -Clients may be listed with the -.Ic list-clients -command. -.Pp -.Ar target-session -is the session id prefixed with a $, the name of a session (as listed by the -.Ic list-sessions -command), or the name of a client with the same syntax as -.Ar target-client , -in which case the session attached to the client is used. -When looking for the session name, -.Nm -initially searches for an exact match; if none is found, the session names -are checked for any for which -.Ar target-session -is a prefix or for which it matches as an -.Xr fnmatch 3 -pattern. -If a single match is found, it is used as the target session; multiple matches -produce an error. -If a session is omitted, the current session is used if available; if no -current session is available, the most recently used is chosen. -.Pp -.Ar target-window -specifies a window in the form -.Em session Ns \&: Ns Em window . -.Em session -follows the same rules as for -.Ar target-session , -and -.Em window -is looked for in order: as a window index, for example mysession:1; -as a window ID, such as @1; -as an exact window name, such as mysession:mywindow; then as an -.Xr fnmatch 3 -pattern or the start of a window name, such as mysession:mywin* or -mysession:mywin. -An empty window name specifies the next unused index if appropriate (for -example the -.Ic new-window -and -.Ic link-window -commands) -otherwise the current window in -.Em session -is chosen. -The special character -.Ql \&! -uses the last (previously current) window, -.Ql ^ -selects the highest numbered window, -.Ql $ -selects the lowest numbered window, and -.Ql + -and -.Ql - -select the next window or the previous window by number. -When the argument does not contain a colon, -.Nm -first attempts to parse it as window; if that fails, an attempt is made to -match a session. -.Pp -.Ar target-pane -takes a similar form to -.Ar target-window -but with the optional addition of a period followed by a pane index, for -example: mysession:mywindow.1. -If the pane index is omitted, the currently active pane in the specified -window is used. -If neither a colon nor period appears, -.Nm -first attempts to use the argument as a pane index; if that fails, it is looked -up as for -.Ar target-window . -A -.Ql + -or -.Ql - -indicate the next or previous pane index, respectively. -One of the strings -.Em top , -.Em bottom , -.Em left , -.Em right , -.Em top-left , -.Em top-right , -.Em bottom-left -or -.Em bottom-right -may be used instead of a pane index. -.Pp -The special characters -.Ql + -and -.Ql - -may be followed by an offset, for example: -.Bd -literal -offset indent -select-window -t:+2 -.Ed -.Pp -When dealing with a session that doesn't contain sequential window indexes, -they will be correctly skipped. -.Pp -.Nm -also gives each pane created in a server an identifier consisting of a -.Ql % -and a number, starting from zero. -A pane's identifier is unique for the life of the -.Nm -server and is passed to the child process of the pane in the -.Ev TMUX_PANE -environment variable. -It may be used alone to target a pane or the window containing it. -.Pp -.Ar shell-command -arguments are -.Xr sh 1 -commands. -These must be passed as a single item, which typically means quoting them, for -example: -.Bd -literal -offset indent -new-window 'vi /etc/passwd' -.Ed -.Pp -.Ar command -.Op Ar arguments -refers to a -.Nm -command, passed with the command and arguments separately, for example: -.Bd -literal -offset indent -bind-key F1 set-window-option force-width 81 -.Ed -.Pp -Or if using -.Xr sh 1 : -.Bd -literal -offset indent -$ tmux bind-key F1 set-window-option force-width 81 -.Ed -.Pp -Multiple commands may be specified together as part of a -.Em command sequence . -Each command should be separated by spaces and a semicolon; -commands are executed sequentially from left to right and -lines ending with a backslash continue on to the next line, -except when escaped by another backslash. -A literal semicolon may be included by escaping it with a backslash (for -example, when specifying a command sequence to -.Ic bind-key ) . -.Pp -Example -.Nm -commands include: -.Bd -literal -offset indent -refresh-client -t/dev/ttyp2 - -rename-session -tfirst newname - -set-window-option -t:0 monitor-activity on - -new-window ; split-window -d - -bind-key R source-file ~/.tmux.conf \e; \e - display-message "source-file done" -.Ed -.Pp -Or from -.Xr sh 1 : -.Bd -literal -offset indent -$ tmux kill-window -t :1 - -$ tmux new-window \e; split-window -d - -$ tmux new-session -d 'vi /etc/passwd' \e; split-window -d \e; attach -.Ed -.Sh CLIENTS AND SESSIONS -The -.Nm -server manages clients, sessions, windows and panes. -Clients are attached to sessions to interact with them, either -when they are created with the -.Ic new-session -command, or later with the -.Ic attach-session -command. -Each session has one or more windows -.Em linked -into it. -Windows may be linked to multiple sessions and are made up of one or -more panes, -each of which contains a pseudo terminal. -Commands for creating, linking and otherwise manipulating windows -are covered -in the -.Sx WINDOWS AND PANES -section. -.Pp -The following commands are available to manage clients and sessions: -.Bl -tag -width Ds -.It Xo Ic attach-session -.Op Fl dr -.Op Fl t Ar target-session -.Xc -.D1 (alias: Ic attach ) -If run from outside -.Nm , -create a new client in the current terminal and attach it to -.Ar target-session . -If used from inside, switch the current client. -If -.Fl d -is specified, any other clients attached to the session are detached. -.Fl r -signifies the client is read-only (only keys bound to the -.Ic detach-client -or -.Ic switch-client -commands have any effect) -.Pp -If no server is started, -.Ic attach-session -will attempt to start it; this will fail unless sessions are created in the -configuration file. -.Pp -The -.Ar target-session -rules for -.Ic attach-session -are slightly adjusted: if -.Nm -needs to select the most recently used session, it will prefer the most -recently used -.Em unattached -session. -.It Xo Ic detach-client -.Op Fl P -.Op Fl a -.Op Fl s Ar target-session -.Op Fl t Ar target-client -.Xc -.D1 (alias: Ic detach ) -Detach the current client if bound to a key, the client specified with -.Fl t , -or all clients currently attached to the session specified by -.Fl s . -The -.Fl a -option kills all but the client given with -.Fl t . -If -.Fl P -is given, send SIGHUP to the parent process of the client, typically causing it -to exit. -.It Ic has-session Op Fl t Ar target-session -.D1 (alias: Ic has ) -Report an error and exit with 1 if the specified session does not exist. -If it does exist, exit with 0. -.It Ic kill-server -Kill the -.Nm -server and clients and destroy all sessions. -.It Ic kill-session -.Op Fl a -.Op Fl t Ar target-session -Destroy the given session, closing any windows linked to it and no other -sessions, and detaching all clients attached to it. -If -.Fl a -is given, all sessions but the specified one is killed. -.It Xo Ic list-clients -.Op Fl F Ar format -.Op Fl t Ar target-session -.Xc -.D1 (alias: Ic lsc ) -List all clients attached to the server. -For the meaning of the -.Fl F -flag, see the -.Sx FORMATS -section. -If -.Ar target-session -is specified, list only clients connected to that session. -.It Ic list-commands -.D1 (alias: Ic lscm ) -List the syntax of all commands supported by -.Nm . -.It Ic list-sessions Op Fl F Ar format -.D1 (alias: Ic ls ) -List all sessions managed by the server. -For the meaning of the -.Fl F -flag, see the -.Sx FORMATS -section. -.It Ic lock-client Op Fl t Ar target-client -.D1 (alias: Ic lockc ) -Lock -.Ar target-client , -see the -.Ic lock-server -command. -.It Ic lock-session Op Fl t Ar target-session -.D1 (alias: Ic locks ) -Lock all clients attached to -.Ar target-session . -.It Xo Ic new-session -.Op Fl AdDP -.Op Fl F Ar format -.Op Fl n Ar window-name -.Op Fl s Ar session-name -.Op Fl t Ar target-session -.Op Fl x Ar width -.Op Fl y Ar height -.Op Ar shell-command -.Xc -.D1 (alias: Ic new ) -Create a new session with name -.Ar session-name . -.Pp -The new session is attached to the current terminal unless -.Fl d -is given. -.Ar window-name -and -.Ar shell-command -are the name of and shell command to execute in the initial window. -If -.Fl d -is used, -.Fl x -and -.Fl y -specify the size of the initial window (80 by 24 if not given). -.Pp -If run from a terminal, any -.Xr termios 4 -special characters are saved and used for new windows in the new session. -.Pp -The -.Fl A -flag makes -.Ic new-session -behave like -.Ic attach-session -if -.Ar session-name -already exists; in the case, -.Fl D -behaves like -.Fl d -to -.Ic attach-session . -.Pp -If -.Fl t -is given, the new session is -.Em grouped -with -.Ar target-session . -This means they share the same set of windows - all windows from -.Ar target-session -are linked to the new session and any subsequent new windows or windows being -closed are applied to both sessions. -The current and previous window and any session options remain independent and -either session may be killed without affecting the other. -Giving -.Fl n -or -.Ar shell-command -are invalid if -.Fl t -is used. -.Pp -The -.Fl P -option prints information about the new session after it has been created. -By default, it uses the format -.Ql #{session_name}: -but a different format may be specified with -.Fl F . -.It Xo Ic refresh-client -.Op Fl S -.Op Fl t Ar target-client -.Xc -.D1 (alias: Ic refresh ) -Refresh the current client if bound to a key, or a single client if one is given -with -.Fl t . -If -.Fl S -is specified, only update the client's status bar. -.It Xo Ic rename-session -.Op Fl t Ar target-session -.Ar new-name -.Xc -.D1 (alias: Ic rename ) -Rename the session to -.Ar new-name . -.It Xo Ic show-messages -.Op Fl t Ar target-client -.Xc -.D1 (alias: Ic showmsgs ) -Any messages displayed on the status line are saved in a per-client message -log, up to a maximum of the limit set by the -.Ar message-limit -session option for the session attached to that client. -This command displays the log for -.Ar target-client . -.It Ic source-file Ar path -.D1 (alias: Ic source ) -Execute commands from -.Ar path . -.It Ic start-server -.D1 (alias: Ic start ) -Start the -.Nm -server, if not already running, without creating any sessions. -.It Xo Ic suspend-client -.Op Fl t Ar target-client -.Xc -.D1 (alias: Ic suspendc ) -Suspend a client by sending -.Dv SIGTSTP -(tty stop). -.It Xo Ic switch-client -.Op Fl lnpr -.Op Fl c Ar target-client -.Op Fl t Ar target-session -.Xc -.D1 (alias: Ic switchc ) -Switch the current session for client -.Ar target-client -to -.Ar target-session . -If -.Fl l , -.Fl n -or -.Fl p -is used, the client is moved to the last, next or previous session -respectively. -.Fl r -toggles whether a client is read-only (see the -.Ic attach-session -command). -.El -.Sh WINDOWS AND PANES -A -.Nm -window may be in one of several modes. -The default permits direct access to the terminal attached to the window. -The other is copy mode, which permits a section of a window or its -history to be copied to a -.Em paste buffer -for later insertion into another window. -This mode is entered with the -.Ic copy-mode -command, bound to -.Ql \&[ -by default. -It is also entered when a command that produces output, such as -.Ic list-keys , -is executed from a key binding. -.Pp -The keys available depend on whether emacs or vi mode is selected -(see the -.Ic mode-keys -option). -The following keys are supported as appropriate for the mode: -.Bl -column "FunctionXXXXXXXXXXXXXXXXX" "viXXXXXXXXXX" "emacs" -offset indent -.It Sy "Function" Ta Sy "vi" Ta Sy "emacs" -.It Li "Back to indentation" Ta "^" Ta "M-m" -.It Li "Bottom of history" Ta "G" Ta "M-<" -.It Li "Clear selection" Ta "Escape" Ta "C-g" -.It Li "Copy selection" Ta "Enter" Ta "M-w" -.It Li "Cursor down" Ta "j" Ta "Down" -.It Li "Cursor left" Ta "h" Ta "Left" -.It Li "Cursor right" Ta "l" Ta "Right" -.It Li "Cursor to bottom line" Ta "L" Ta "" -.It Li "Cursor to middle line" Ta "M" Ta "M-r" -.It Li "Cursor to top line" Ta "H" Ta "M-R" -.It Li "Cursor up" Ta "k" Ta "Up" -.It Li "Delete entire line" Ta "d" Ta "C-u" -.It Li "Delete/Copy to end of line" Ta "D" Ta "C-k" -.It Li "End of line" Ta "$" Ta "C-e" -.It Li "Go to line" Ta ":" Ta "g" -.It Li "Half page down" Ta "C-d" Ta "M-Down" -.It Li "Half page up" Ta "C-u" Ta "M-Up" -.It Li "Jump forward" Ta "f" Ta "f" -.It Li "Jump to forward" Ta "t" Ta "" -.It Li "Jump backward" Ta "F" Ta "F" -.It Li "Jump to backward" Ta "T" Ta "" -.It Li "Jump again" Ta ";" Ta ";" -.It Li "Jump again in reverse" Ta "," Ta "," -.It Li "Next page" Ta "C-f" Ta "Page down" -.It Li "Next space" Ta "W" Ta "" -.It Li "Next space, end of word" Ta "E" Ta "" -.It Li "Next word" Ta "w" Ta "" -.It Li "Next word end" Ta "e" Ta "M-f" -.It Li "Paste buffer" Ta "p" Ta "C-y" -.It Li "Previous page" Ta "C-b" Ta "Page up" -.It Li "Previous word" Ta "b" Ta "M-b" -.It Li "Previous space" Ta "B" Ta "" -.It Li "Quit mode" Ta "q" Ta "Escape" -.It Li "Rectangle toggle" Ta "v" Ta "R" -.It Li "Scroll down" Ta "C-Down or C-e" Ta "C-Down" -.It Li "Scroll up" Ta "C-Up or C-y" Ta "C-Up" -.It Li "Search again" Ta "n" Ta "n" -.It Li "Search again in reverse" Ta "N" Ta "N" -.It Li "Search backward" Ta "?" Ta "C-r" -.It Li "Search forward" Ta "/" Ta "C-s" -.It Li "Start of line" Ta "0" Ta "C-a" -.It Li "Start selection" Ta "Space" Ta "C-Space" -.It Li "Top of history" Ta "g" Ta "M->" -.It Li "Transpose characters" Ta "" Ta "C-t" -.El -.Pp -The next and previous word keys use space and the -.Ql - , -.Ql _ -and -.Ql @ -characters as word delimiters by default, but this can be adjusted by -setting the -.Em word-separators -session option. -Next word moves to the start of the next word, next word end to the end of the -next word and previous word to the start of the previous word. -The three next and previous space keys work similarly but use a space alone as -the word separator. -.Pp -The jump commands enable quick movement within a line. -For instance, typing -.Ql f -followed by -.Ql / -will move the cursor to the next -.Ql / -character on the current line. -A -.Ql \&; -will then jump to the next occurrence. -.Pp -Commands in copy mode may be prefaced by an optional repeat count. -With vi key bindings, a prefix is entered using the number keys; with -emacs, the Alt (meta) key and a number begins prefix entry. -For example, to move the cursor forward by ten words, use -.Ql M-1 0 M-f -in emacs mode, and -.Ql 10w -in vi. -.Pp -When copying the selection, the repeat count indicates the buffer index to -replace, if used. -.Pp -Mode key bindings are defined in a set of named tables: -.Em vi-edit -and -.Em emacs-edit -for keys used when line editing at the command prompt; -.Em vi-choice -and -.Em emacs-choice -for keys used when choosing from lists (such as produced by the -.Ic choose-window -command); and -.Em vi-copy -and -.Em emacs-copy -used in copy mode. -The tables may be viewed with the -.Ic list-keys -command and keys modified or removed with -.Ic bind-key -and -.Ic unbind-key . -One command accepts an argument, -.Ic copy-pipe , -which copies the selection and pipes it to a command. -For example the following will bind -.Ql C-q -to copy the selection into -.Pa /tmp -as well as the paste buffer: -.Bd -literal -offset indent -bind-key -temacs-copy C-q copy-pipe "cat >/tmp/out" -.Ed -.Pp -The paste buffer key pastes the first line from the top paste buffer on the -stack. -.Pp -The synopsis for the -.Ic copy-mode -command is: -.Bl -tag -width Ds -.It Xo Ic copy-mode -.Op Fl u -.Op Fl t Ar target-pane -.Xc -Enter copy mode. -The -.Fl u -option scrolls one page up. -.El -.Pp -Each window displayed by -.Nm -may be split into one or more -.Em panes ; -each pane takes up a certain area of the display and is a separate terminal. -A window may be split into panes using the -.Ic split-window -command. -Windows may be split horizontally (with the -.Fl h -flag) or vertically. -Panes may be resized with the -.Ic resize-pane -command (bound to -.Ql C-up , -.Ql C-down -.Ql C-left -and -.Ql C-right -by default), the current pane may be changed with the -.Ic select-pane -command and the -.Ic rotate-window -and -.Ic swap-pane -commands may be used to swap panes without changing their position. -Panes are numbered beginning from zero in the order they are created. -.Pp -A number of preset -.Em layouts -are available. -These may be selected with the -.Ic select-layout -command or cycled with -.Ic next-layout -(bound to -.Ql Space -by default); once a layout is chosen, panes within it may be moved and resized -as normal. -.Pp -The following layouts are supported: -.Bl -tag -width Ds -.It Ic even-horizontal -Panes are spread out evenly from left to right across the window. -.It Ic even-vertical -Panes are spread evenly from top to bottom. -.It Ic main-horizontal -A large (main) pane is shown at the top of the window and the remaining panes -are spread from left to right in the leftover space at the bottom. -Use the -.Em main-pane-height -window option to specify the height of the top pane. -.It Ic main-vertical -Similar to -.Ic main-horizontal -but the large pane is placed on the left and the others spread from top to -bottom along the right. -See the -.Em main-pane-width -window option. -.It Ic tiled -Panes are spread out as evenly as possible over the window in both rows and -columns. -.El -.Pp -In addition, -.Ic select-layout -may be used to apply a previously used layout - the -.Ic list-windows -command displays the layout of each window in a form suitable for use with -.Ic select-layout . -For example: -.Bd -literal -offset indent -$ tmux list-windows -0: ksh [159x48] - layout: bb62,159x48,0,0{79x48,0,0,79x48,80,0} -$ tmux select-layout bb62,159x48,0,0{79x48,0,0,79x48,80,0} -.Ed -.Pp -.Nm -automatically adjusts the size of the layout for the current window size. -Note that a layout cannot be applied to a window with more panes than that -from which the layout was originally defined. -.Pp -Commands related to windows and panes are as follows: -.Bl -tag -width Ds -.It Xo Ic break-pane -.Op Fl dP -.Op Fl F Ar format -.Op Fl t Ar target-pane -.Xc -.D1 (alias: Ic breakp ) -Break -.Ar target-pane -off from its containing window to make it the only pane in a new window. -If -.Fl d -is given, the new window does not become the current window. -The -.Fl P -option prints information about the new window after it has been created. -By default, it uses the format -.Ql #{session_name}:#{window_index} -but a different format may be specified with -.Fl F . -.It Xo Ic capture-pane -.Op Fl aepPq -.Op Fl b Ar buffer-index -.Op Fl E Ar end-line -.Op Fl S Ar start-line -.Op Fl t Ar target-pane -.Xc -.D1 (alias: Ic capturep ) -Capture the contents of a pane. -If -.Fl p -is given, the output goes to stdout, otherwise to the buffer specified with -.Fl b -or a new buffer if omitted. -If -.Fl a -is given, the alternate screen is used, and the history is not accessible. -If no alternate screen exists, an error will be returned unless -.Fl q -is given. -If -.Fl e -is given, the output includes escape sequences for text and background -attributes. -.Fl C -also escapes non-printable characters as octal \exxx. -.Fl J -joins wrapped lines and preserves trailing spaces at each line's end. -.Fl P -captures only any output that the pane has received that is the beginning of an -as-yet incomplete escape sequence. -.Pp -.Fl S -and -.Fl E -specify the starting and ending line numbers, zero is the first line of the -visible pane and negative numbers are lines in the history. -The default is to capture only the visible contents of the pane. -.It Xo -.Ic choose-client -.Op Fl F Ar format -.Op Fl t Ar target-window -.Op Ar template -.Xc -Put a window into client choice mode, allowing a client to be selected -interactively from a list. -After a client is chosen, -.Ql %% -is replaced by the client -.Xr pty 4 -path in -.Ar template -and the result executed as a command. -If -.Ar template -is not given, "detach-client -t '%%'" is used. -For the meaning of the -.Fl F -flag, see the -.Sx FORMATS -section. -This command works only if at least one client is attached. -.It Xo -.Ic choose-list -.Op Fl l Ar items -.Op Fl t Ar target-window -.Op Ar template -.Xc -Put a window into list choice mode, allowing -.Ar items -to be selected. -.Ar items -can be a comma-separated list to display more than one item. -If an item has spaces, that entry must be quoted. -After an item is chosen, -.Ql %% -is replaced by the chosen item in the -.Ar template -and the result is executed as a command. -If -.Ar template -is not given, "run-shell '%%'" is used. -.Ar items -also accepts format specifiers. -For the meaning of this see the -.Sx FORMATS -section. -This command works only if at least one client is attached. -.It Xo -.Ic choose-session -.Op Fl F Ar format -.Op Fl t Ar target-window -.Op Ar template -.Xc -Put a window into session choice mode, where a session may be selected -interactively from a list. -When one is chosen, -.Ql %% -is replaced by the session name in -.Ar template -and the result executed as a command. -If -.Ar template -is not given, "switch-client -t '%%'" is used. -For the meaning of the -.Fl F -flag, see the -.Sx FORMATS -section. -This command works only if at least one client is attached. -.It Xo -.Ic choose-tree -.Op Fl suw -.Op Fl b Ar session-template -.Op Fl c Ar window-template -.Op Fl S Ar format -.Op Fl W Ar format -.Op Fl t Ar target-window -.Xc -Put a window into tree choice mode, where either sessions or windows may be -selected interactively from a list. -By default, windows belonging to a session are indented to show their -relationship to a session. -.Pp -Note that the -.Ic choose-window -and -.Ic choose-session -commands are wrappers around -.Ic choose-tree . -.Pp -If -.Fl s -is given, will show sessions. -If -.Fl w -is given, will show windows. -.Pp -By default, the tree is collapsed and sessions must be expanded to windows -with the right arrow key. -The -.Fl u -option will start with all sessions expanded instead. -.Pp -If -.Fl b -is given, will override the default session command. -Note that -.Ql %% -can be used and will be replaced with the session name. -The default option if not specified is "switch-client -t '%%'". -If -.Fl c -is given, will override the default window command. -Like -.Fl b , -.Ql %% -can be used and will be replaced with the session name and window index. -When a window is chosen from the list, the session command is run before the -window command. -.Pp -If -.Fl S -is given will display the specified format instead of the default session -format. -If -.Fl W -is given will display the specified format instead of the default window -format. -For the meaning of the -.Fl s -and -.Fl w -options, see the -.Sx FORMATS -section. -.Pp -This command works only if at least one client is attached. -.It Xo -.Ic choo