Skip to content

Instantly share code, notes, and snippets.

@nicm
Created May 28, 2026 12:36
Show Gist options
  • Select an option

  • Save nicm/80d203b96ea669adf37f742b47a007fc to your computer and use it in GitHub Desktop.

Select an option

Save nicm/80d203b96ea669adf37f742b47a007fc to your computer and use it in GitHub Desktop.
Index: cmd-split-window.c
===================================================================
RCS file: /cvs/src/usr.bin/tmux/cmd-split-window.c,v
diff -u -p -r1.119 cmd-split-window.c
--- cmd-split-window.c 20 May 2026 08:54:40 -0000 1.119
+++ cmd-split-window.c 28 May 2026 12:36:02 -0000
@@ -148,7 +148,7 @@ cmd_split_window_exec(struct cmd *self,
u_int count = args_count(args);
if (cmd_get_entry(self) == &cmd_new_pane_entry)
- is_floating = 0; /* !args_has(args, 'L'); */
+ is_floating = !args_has(args, 'L');
else
is_floating = 0;
input = (args_has(args, 'I') && count == 0);
Index: key-bindings.c
===================================================================
RCS file: /cvs/src/usr.bin/tmux/key-bindings.c,v
diff -u -p -r1.170 key-bindings.c
--- key-bindings.c 28 May 2026 10:34:38 -0000 1.170
+++ key-bindings.c 28 May 2026 12:36:02 -0000
@@ -362,6 +362,7 @@ key_bindings_init(void)
"bind -N 'Split window horizontally' % { split-window -h }",
"bind -N 'Kill current window' & { confirm-before -p\"kill-window #W? (y/n)\" kill-window }",
"bind -N 'Prompt for window index to select' \"'\" { command-prompt -T window-target -pindex { select-window -t ':%%' } }",
+ "bind -N 'New floating pane' * { new-pane }",
"bind -N 'Switch to previous client' ( { switch-client -p }",
"bind -N 'Switch to next client' ) { switch-client -n }",
"bind -N 'Rename current window' , { command-prompt -I'#W' { rename-window -- '%%' } }",
Index: options-table.c
===================================================================
RCS file: /cvs/src/usr.bin/tmux/options-table.c,v
diff -u -p -r1.212 options-table.c
--- options-table.c 27 May 2026 18:57:10 -0000 1.212
+++ options-table.c 28 May 2026 12:36:02 -0000
@@ -349,6 +349,13 @@ const struct options_table_entry options
.text = "Default command to run when tmux is run without a command."
},
+ { .name = "default-session-name",
+ .type = OPTIONS_TABLE_STRING,
+ .scope = OPTIONS_TABLE_SERVER,
+ .default_str = "#{?session_group,#{session_group}-,}#{s|^\\$||:#{next_session_id}}",
+ .text = "The default session name for a session if none is provided."
+ },
+
{ .name = "default-terminal",
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_SERVER,
Index: session.c
===================================================================
RCS file: /cvs/src/usr.bin/tmux/session.c,v
diff -u -p -r1.103 session.c
--- session.c 22 Apr 2026 07:10:16 -0000 1.103
+++ session.c 28 May 2026 12:36:02 -0000
@@ -113,7 +113,11 @@ struct session *
session_create(const char *prefix, const char *name, const char *cwd,
struct environ *env, struct options *oo, struct termios *tio)
{
- struct session *s;
+ struct session *s;
+ struct options *so = global_options;
+ struct format_tree *ft;
+ const char *fmt;
+ char *newname;
s = xcalloc(1, sizeof *s);
s->references = 1;
@@ -139,14 +143,25 @@ session_create(const char *prefix, const
s->name = xstrdup(name);
s->id = next_session_id++;
} else {
- do {
+ ft = format_create (NULL, NULL, 0, 0);
+ if (prefix != NULL)
+ format_add(ft, "session_group", "%s", prefix);
+ fmt = options_get_string(so, "default-session-name");
+ newname = format_expand(ft, fmt);
+ format_free(ft);
+
+ s->name = clean_name(newname, "#:.");
+ free(newname);
+ if (s->name == NULL || RB_FIND(sessions, &sessions, s) != NULL) {
+ do {
s->id = next_session_id++;
free(s->name);
if (prefix != NULL)
xasprintf(&s->name, "%s-%u", prefix, s->id);
else
xasprintf(&s->name, "%u", s->id);
- } while (RB_FIND(sessions, &sessions, s) != NULL);
+ } while (RB_FIND(sessions, &sessions, s) != NULL);
+ }
}
RB_INSERT(sessions, &sessions, s);
Index: tmux.1
===================================================================
RCS file: /cvs/src/usr.bin/tmux/tmux.1,v
diff -u -p -r1.1058 tmux.1
--- tmux.1 27 May 2026 18:57:10 -0000 1.1058
+++ tmux.1 28 May 2026 12:36:03 -0000
@@ -296,6 +296,8 @@ Prompt for a window index to select.
Switch the attached client to the previous session.
.It \&)
Switch the attached client to the next session.
+.It *
+Create a new floating pane.
.It ,
Rename the current window.
.It \-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment