mirror of
https://github.com/tmux/tmux.git
synced 2025-04-01 21:41:44 +00:00
Support #S #H in status-left/right.
This commit is contained in:
parent
3f20549f66
commit
5aa3098bb6
3
CHANGES
3
CHANGES
@ -1,5 +1,6 @@
|
|||||||
15 January 2009
|
15 January 2009
|
||||||
|
|
||||||
|
* Support #H for hostname and #S for session name in status-left/right.
|
||||||
* Two new commands, choose-window and choose-session which work only when bound
|
* Two new commands, choose-window and choose-session which work only when bound
|
||||||
to a key and allow the window or session to be selected from a list. These
|
to a key and allow the window or session to be selected from a list. These
|
||||||
are now bound to "w" and "s" instead of the list commands.
|
are now bound to "w" and "s" instead of the list commands.
|
||||||
@ -929,7 +930,7 @@
|
|||||||
(including mutt, emacs). No status bar yet and no key remapping or other
|
(including mutt, emacs). No status bar yet and no key remapping or other
|
||||||
customisation.
|
customisation.
|
||||||
|
|
||||||
$Id: CHANGES,v 1.212 2009-01-15 19:30:21 nicm Exp $
|
$Id: CHANGES,v 1.213 2009-01-15 23:42:21 nicm Exp $
|
||||||
|
|
||||||
LocalWords: showw utf UTF fulvio ciriaco joshe OSC APC gettime abc DEF OA clr
|
LocalWords: showw utf UTF fulvio ciriaco joshe OSC APC gettime abc DEF OA clr
|
||||||
LocalWords: rivo nurges lscm Erdely eol smysession mysession ek dstname RB ms
|
LocalWords: rivo nurges lscm Erdely eol smysession mysession ek dstname RB ms
|
||||||
|
1
TODO
1
TODO
@ -62,7 +62,6 @@ soon:
|
|||||||
- swap-panes
|
- swap-panes
|
||||||
- move-pane (to window)
|
- move-pane (to window)
|
||||||
- should be able to move to a hidden pane and it would be moved into view
|
- should be able to move to a hidden pane and it would be moved into view
|
||||||
- more # commands in status-left,right eg #H for hostname, #S for session name
|
|
||||||
- command to run something without a window at all - output to window-more
|
- command to run something without a window at all - output to window-more
|
||||||
- command to purge window history
|
- command to purge window history
|
||||||
- command: load-buffer -b number filename
|
- command: load-buffer -b number filename
|
||||||
|
20
status.c
20
status.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: status.c,v 1.62 2009-01-14 19:29:32 nicm Exp $ */
|
/* $Id: status.c,v 1.63 2009-01-15 23:42:21 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -25,6 +25,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "tmux.h"
|
#include "tmux.h"
|
||||||
|
|
||||||
@ -291,7 +292,7 @@ status_replace(struct session *s, char *fmt, time_t t)
|
|||||||
{
|
{
|
||||||
struct winlink *wl = s->curw;
|
struct winlink *wl = s->curw;
|
||||||
static char out[BUFSIZ];
|
static char out[BUFSIZ];
|
||||||
char in[BUFSIZ], ch, *iptr, *optr, *ptr, *endptr;
|
char in[BUFSIZ], tmp[256], ch, *iptr, *optr, *ptr, *endptr;
|
||||||
size_t len;
|
size_t len;
|
||||||
long n;
|
long n;
|
||||||
|
|
||||||
@ -316,9 +317,22 @@ status_replace(struct session *s, char *fmt, time_t t)
|
|||||||
if (n <= 0)
|
if (n <= 0)
|
||||||
n = LONG_MAX;
|
n = LONG_MAX;
|
||||||
|
|
||||||
|
ptr = NULL;
|
||||||
switch (*iptr++) {
|
switch (*iptr++) {
|
||||||
|
case 'H':
|
||||||
|
if (ptr == NULL) {
|
||||||
|
if (gethostname(tmp, sizeof tmp) != 0)
|
||||||
|
fatal("gethostname");
|
||||||
|
ptr = tmp;
|
||||||
|
}
|
||||||
|
/* FALLTHROUGH */
|
||||||
|
case 'S':
|
||||||
|
if (ptr == NULL)
|
||||||
|
ptr = s->name;
|
||||||
|
/* FALLTHROUGH */
|
||||||
case 'T':
|
case 'T':
|
||||||
ptr = wl->window->active->base.title;
|
if (ptr == NULL)
|
||||||
|
ptr = wl->window->active->base.title;
|
||||||
len = strlen(ptr);
|
len = strlen(ptr);
|
||||||
if ((size_t) n < len)
|
if ((size_t) n < len)
|
||||||
len = n;
|
len = n;
|
||||||
|
4
tmux.1
4
tmux.1
@ -1,4 +1,4 @@
|
|||||||
.\" $Id: tmux.1,v 1.61 2009-01-15 21:24:03 tcunha Exp $
|
.\" $Id: tmux.1,v 1.62 2009-01-15 23:42:21 nicm Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
.\"
|
.\"
|
||||||
@ -759,6 +759,8 @@ By default, nothing is displayed.
|
|||||||
may contain any of the following special character pairs:
|
may contain any of the following special character pairs:
|
||||||
.Bl -column "Character pair" "Replaced with" -offset indent
|
.Bl -column "Character pair" "Replaced with" -offset indent
|
||||||
.It Sy "Character pair" Ta Sy "Replaced with"
|
.It Sy "Character pair" Ta Sy "Replaced with"
|
||||||
|
.It Li "#H" Ta "Hostname of local host"
|
||||||
|
.It Li "#S" Ta "Session name"
|
||||||
.It Li "#T" Ta "Current window title"
|
.It Li "#T" Ta "Current window title"
|
||||||
.It Li "##" Ta "A literal" Ql #
|
.It Li "##" Ta "A literal" Ql #
|
||||||
.El
|
.El
|
||||||
|
4
tmux.c
4
tmux.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: tmux.c,v 1.96 2009-01-14 22:13:30 nicm Exp $ */
|
/* $Id: tmux.c,v 1.97 2009-01-15 23:42:21 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -243,7 +243,7 @@ main(int argc, char **argv)
|
|||||||
options_set_number(&global_options, "status-interval", 15);
|
options_set_number(&global_options, "status-interval", 15);
|
||||||
options_set_number(&global_options, "status-left-length", 10);
|
options_set_number(&global_options, "status-left-length", 10);
|
||||||
options_set_number(&global_options, "status-right-length", 40);
|
options_set_number(&global_options, "status-right-length", 40);
|
||||||
options_set_string(&global_options, "status-left", "%s", ""); /* ugh */
|
options_set_string(&global_options, "status-left", "[#S]");
|
||||||
options_set_string(
|
options_set_string(
|
||||||
&global_options, "status-right", "\"#24T\" %%H:%%M %%d-%%b-%%y");
|
&global_options, "status-right", "\"#24T\" %%H:%%M %%d-%%b-%%y");
|
||||||
options_init(&global_window_options, NULL);
|
options_init(&global_window_options, NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user