summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd-break-pane.c2
-rw-r--r--cmd-choose-buffer.c3
-rw-r--r--cmd-choose-client.c6
-rw-r--r--cmd-choose-tree.c9
-rw-r--r--cmd-display-message.c5
-rw-r--r--cmd-find-window.c5
-rw-r--r--cmd-list-buffers.c3
-rw-r--r--cmd-list-clients.c5
-rw-r--r--cmd-list-sessions.c8
-rw-r--r--cmd-list-windows.c16
-rw-r--r--cmd-new-session.c16
-rw-r--r--cmd-new-window.c2
-rw-r--r--cmd-split-window.c2
-rw-r--r--tmux.h72
14 files changed, 80 insertions, 74 deletions
diff --git a/cmd-break-pane.c b/cmd-break-pane.c
index 5e7ecd02..0025167f 100644
--- a/cmd-break-pane.c
+++ b/cmd-break-pane.c
@@ -26,6 +26,8 @@
* Break pane off into a window.
*/
+#define BREAK_PANE_TEMPLATE "#{session_name}:#{window_index}.#{pane_index}"
+
enum cmd_retval cmd_break_pane_exec(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_break_pane_entry = {
diff --git a/cmd-choose-buffer.c b/cmd-choose-buffer.c
index de4855ae..19f5fba2 100644
--- a/cmd-choose-buffer.c
+++ b/cmd-choose-buffer.c
@@ -27,6 +27,9 @@
* Enter choice mode to choose a buffer.
*/
+#define CHOOSE_BUFFER_TEMPLATE \
+ "#{buffer_name}: #{buffer_size} bytes: #{buffer_sample}"
+
enum cmd_retval cmd_choose_buffer_exec(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_choose_buffer_entry = {
diff --git a/cmd-choose-client.c b/cmd-choose-client.c
index be3d4056..5a1892f4 100644
--- a/cmd-choose-client.c
+++ b/cmd-choose-client.c
@@ -27,6 +27,12 @@
* Enter choice mode to choose a client.
*/
+#define CHOOSE_CLIENT_TEMPLATE \
+ "#{client_tty}: #{session_name} " \
+ "[#{client_width}x#{client_height} #{client_termname}]" \
+ "#{?client_utf8, (utf8),}#{?client_readonly, (ro),} " \
+ "(last used #{client_activity_string})"
+
enum cmd_retval cmd_choose_client_exec(struct cmd *, struct cmd_q *);
void cmd_choose_client_callback(struct window_choose_data *);
diff --git a/cmd-choose-tree.c b/cmd-choose-tree.c
index eee49cc2..823d0423 100644
--- a/cmd-choose-tree.c
+++ b/cmd-choose-tree.c
@@ -32,6 +32,15 @@
* Enter choice mode to choose a session and/or window.
*/
+#define CHOOSE_TREE_SESSION_TEMPLATE \
+ "#{session_name}: #{session_windows} windows" \
+ "#{?session_grouped, (group ,}" \
+ "#{session_group}#{?session_grouped,),}" \
+ "#{?session_attached, (attached),}"
+#define CHOOSE_TREE_WINDOW_TEMPLATE \
+ "#{window_index}: #{window_name}#{window_flags} " \
+ "\"#{pane_title}\""
+
enum cmd_retval cmd_choose_tree_exec(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_choose_tree_entry = {
diff --git a/cmd-display-message.c b/cmd-display-message.c
index dc4290e9..f3547b00 100644
--- a/cmd-display-message.c
+++ b/cmd-display-message.c
@@ -27,6 +27,11 @@
* Displays a message in the status line.
*/
+#define DISPLAY_MESSAGE_TEMPLATE \
+ "[#{session_name}] #{window_index}:" \
+ "#{window_name}, current pane #{pane_index} " \
+ "- (%H:%M %d-%b-%y)"
+
enum cmd_retval cmd_display_message_exec(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_display_message_entry = {
diff --git a/cmd-find-window.c b/cmd-find-window.c
index f1fc5f50..deacf99c 100644
--- a/cmd-find-window.c
+++ b/cmd-find-window.c
@@ -28,6 +28,11 @@
* Find window containing text.
*/
+#define FIND_WINDOW_TEMPLATE \
+ "#{window_index}: #{window_name} " \
+ "[#{window_width}x#{window_height}] " \
+ "(#{window_panes} panes) #{window_find_matches}"
+
enum cmd_retval cmd_find_window_exec(struct cmd *, struct cmd_q *);
void cmd_find_window_callback(struct window_choose_data *);
diff --git a/cmd-list-buffers.c b/cmd-list-buffers.c
index 25f7e8bc..8eb1610f 100644
--- a/cmd-list-buffers.c
+++ b/cmd-list-buffers.c
@@ -27,6 +27,9 @@
* List paste buffers.
*/
+#define LIST_BUFFERS_TEMPLATE \
+ "#{buffer_name}: #{buffer_size} bytes: \"#{buffer_sample}\""
+
enum cmd_retval cmd_list_buffers_exec(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_list_buffers_entry = {
diff --git a/cmd-list-clients.c b/cmd-list-clients.c
index 0cfbdfa7..292be722 100644
--- a/cmd-list-clients.c
+++ b/cmd-list-clients.c
@@ -28,6 +28,11 @@
* List all clients.
*/
+#define LIST_CLIENTS_TEMPLATE \
+ "#{client_tty}: #{session_name} " \
+ "[#{client_width}x#{client_height} #{client_termname}]" \
+ "#{?client_utf8, (utf8),} #{?client_readonly, (ro),}"
+
enum cmd_retval cmd_list_clients_exec(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_list_clients_entry = {
diff --git a/cmd-list-sessions.c b/cmd-list-sessions.c
index f0a7c538..ea8f3e32 100644
--- a/cmd-list-sessions.c
+++ b/cmd-list-sessions.c
@@ -28,6 +28,14 @@
* List all sessions.
*/
+#define LIST_SESSIONS_TEMPLATE \
+ "#{session_name}: #{session_windows} windows " \
+ "(created #{session_created_string}) " \
+ "[#{session_width}x#{session_height}]" \
+ "#{?session_grouped, (group ,}" \
+ "#{session_group}#{?session_grouped,),}" \
+ "#{?session_attached, (attached),}"
+
enum cmd_retval cmd_list_sessions_exec(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_list_sessions_entry = {
diff --git a/cmd-list-windows.c b/cmd-list-windows.c
index 1317ecb1..5f73e8d2 100644
--- a/cmd-list-windows.c
+++ b/cmd-list-windows.c
@@ -27,11 +27,23 @@
* List windows on given session.
*/
+#define LIST_WINDOWS_TEMPLATE \
+ "#{window_index}: #{window_name}#{window_flags} " \
+ "(#{window_panes} panes) " \
+ "[#{window_width}x#{window_height}] " \
+ "[layout #{window_layout}] #{window_id}" \
+ "#{?window_active, (active),}";
+#define LIST_WINDOWS_WITH_SESSION_TEMPLATE \
+ "#{session_name}:" \
+ "#{window_index}: #{window_name}#{window_flags} " \
+ "(#{window_panes} panes) " \
+ "[#{window_width}x#{window_height}] "
+
enum cmd_retval cmd_list_windows_exec(struct cmd *, struct cmd_q *);
void cmd_list_windows_server(struct cmd *, struct cmd_q *);
-void cmd_list_windows_session(
- struct cmd *, struct session *, struct cmd_q *, int);
+void cmd_list_windows_session(struct cmd *, struct session *,
+ struct cmd_q *, int);
const struct cmd_entry cmd_list_windows_entry = {
"list-windows", "lsw",
diff --git a/cmd-new-session.c b/cmd-new-session.c
index e42947e7..e244f885 100644
--- a/cmd-new-session.c
+++ b/cmd-new-session.c
@@ -31,6 +31,8 @@
* Create a new session and attach to the current terminal unless -d is given.
*/
+#define NEW_SESSION_TEMPLATE "#{session_name}:"
+
enum cmd_retval cmd_new_session_exec(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_new_session_entry = {
@@ -43,6 +45,14 @@ const struct cmd_entry cmd_new_session_entry = {
cmd_new_session_exec
};
+const struct cmd_entry cmd_has_session_entry = {
+ "has-session", "has",
+ "t:", 0, 0,
+ CMD_TARGET_SESSION_USAGE,
+ 0,
+ cmd_new_session_exec
+};
+
enum cmd_retval
cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
{
@@ -61,6 +71,12 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
struct format_tree *ft;
struct environ_entry *envent;
+ if (self->entry == &cmd_has_session_entry) {
+ if (cmd_find_session(cmdq, args_get(args, 't'), 0) == NULL)
+ return (CMD_RETURN_ERROR);
+ return (CMD_RETURN_NORMAL);
+ }
+
if (args_has(args, 't') && (args->argc != 0 || args_has(args, 'n'))) {
cmdq_error(cmdq, "command or window name given with target");
return (CMD_RETURN_ERROR);
diff --git a/cmd-new-window.c b/cmd-new-window.c
index 09693c8f..7f14b21a 100644
--- a/cmd-new-window.c
+++ b/cmd-new-window.c
@@ -30,6 +30,8 @@
* Create a new window.
*/
+#define NEW_WINDOW_TEMPLATE "#{session_name}:#{window_index}.#{pane_index}"
+
enum cmd_retval cmd_new_window_exec(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_new_window_entry = {
diff --git a/cmd-split-window.c b/cmd-split-window.c
index 797332cf..b05a2faf 100644
--- a/cmd-split-window.c
+++ b/cmd-split-window.c
@@ -31,6 +31,8 @@
* Split a window (add a new pane).
*/
+#define SPLIT_WINDOW_TEMPLATE "#{session_name}:#{window_index}.#{pane_index}"
+
enum cmd_retval cmd_split_window_exec(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_split_window_entry = {
diff --git a/tmux.h b/tmux.h
index 2b2cd4a6..7ad6e62c 100644
--- a/tmux.h
+++ b/tmux.h
@@ -80,78 +80,6 @@ extern char **environ;
#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
#endif
-/* Default template for choose-buffer. */
-#define CHOOSE_BUFFER_TEMPLATE \
- "#{buffer_name}: #{buffer_size} bytes: #{buffer_sample}"
-
-/* Default template for choose-client. */
-#define CHOOSE_CLIENT_TEMPLATE \
- "#{client_tty}: #{session_name} " \
- "[#{client_width}x#{client_height} #{client_termname}]" \
- "#{?client_utf8, (utf8),}#{?client_readonly, (ro),} " \
- "(last used #{client_activity_string})"
-
-/* Default templates for choose-tree. */
-#define CHOOSE_TREE_SESSION_TEMPLATE \
- "#{session_name}: #{session_windows} windows" \
- "#{?session_grouped, (group ,}" \
- "#{session_group}#{?session_grouped,),}" \
- "#{?session_attached, (attached),}"
-#define CHOOSE_TREE_WINDOW_TEMPLATE \
- "#{window_index}: #{window_name}#{window_flags} " \
- "\"#{pane_title}\""
-
-/* Default template for display-message. */
-#define DISPLAY_MESSAGE_TEMPLATE \
- "[#{session_name}] #{window_index}:" \
- "#{window_name}, current pane #{pane_index} " \
- "- (%H:%M %d-%b-%y)"
-
-/* Default template for find-window. */
-#define FIND_WINDOW_TEMPLATE \
- "#{window_index}: #{window_name} " \
- "[#{window_width}x#{window_height}] " \
- "(#{window_panes} panes) #{window_find_matches}"
-
-/* Default template for list-buffers. */
-#define LIST_BUFFERS_TEMPLATE \
- "#{buffer_name}: #{buffer_size} bytes: " \
- "\"#{buffer_sample}\""
-
-/* Default template for list-clients. */
-#define LIST_CLIENTS_TEMPLATE \
- "#{client_tty}: #{session_name} " \
- "[#{client_width}x#{client_height} #{client_termname}]" \
- "#{?client_utf8, (utf8),} #{?client_readonly, (ro),}"
-
-/* Default template for list-sessions. */
-#define LIST_SESSIONS_TEMPLATE \
- "#{session_name}: #{session_windows} windows " \
- "(created #{session_created_string}) " \
- "[#{session_width}x#{session_height}]" \
- "#{?session_grouped, (group ,}" \
- "#{session_group}#{?session_grouped,),}" \
- "#{?session_attached, (attached),}"
-
-/* Default templates for list-windows. */
-#define LIST_WINDOWS_TEMPLATE \
- "#{window_index}: #{window_name}#{window_flags} " \
- "(#{window_panes} panes) " \
- "[#{window_width}x#{window_height}] " \
- "[layout #{window_layout}] #{window_id}" \
- "#{?window_active, (active),}";
-#define LIST_WINDOWS_WITH_SESSION_TEMPLATE \
- "#{session_name}:" \
- "#{window_index}: #{window_name}#{window_flags} " \
- "(#{window_panes} panes) " \
- "[#{window_width}x#{window_height}] "
-
-/* Default templates for break-pane, new-window and split-window. */
-#define BREAK_PANE_TEMPLATE "#{session_name}:#{window_index}.#{pane_index}"
-#define NEW_SESSION_TEMPLATE "#{session_name}:"
-#define NEW_WINDOW_TEMPLATE BREAK_PANE_TEMPLATE
-#define SPLIT_WINDOW_TEMPLATE BREAK_PANE_TEMPLATE
-
/* Bell option values. */
#define BELL_NONE 0
#define BELL_ANY 1