Skip to content

Instantly share code, notes, and snippets.

@ThomasAdam
Created March 24, 2019 21:31
Show Gist options
  • Save ThomasAdam/f9624c5c2847332da787beb619682b7c to your computer and use it in GitHub Desktop.
Save ThomasAdam/f9624c5c2847332da787beb619682b7c to your computer and use it in GitHub Desktop.
diff --git a/cfg.c b/cfg.c
index 84db9fb3..fb95f89e 100644
--- a/cfg.c
+++ b/cfg.c
@@ -77,6 +77,12 @@ set_cfg_file(const char *path)
cfg_file = xstrdup(path);
}
+const char *
+get_cfg_file(void)
+{
+ return (cfg_file);
+}
+
void
start_cfg(void)
{
diff --git a/format.c b/format.c
index 1a3ba762..f5f78a88 100644
--- a/format.c
+++ b/format.c
@@ -759,6 +759,7 @@ format_create(struct client *c, struct cmdq_item *item, int tag, int flags)
format_add_cb(ft, "pid", format_cb_pid);
format_add(ft, "socket_path", "%s", socket_path);
format_add_tv(ft, "start_time", &start_time);
+ format_add(ft, "config_file", "%s", get_cfg_file());
for (wm = all_window_modes; *wm != NULL; wm++) {
if ((*wm)->default_format != NULL) {
diff --git a/tmux.h b/tmux.h
index 9487e4ad..f2b8c6ee 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1597,6 +1597,7 @@ extern struct client *cfg_client;
void start_cfg(void);
int load_cfg(const char *, struct client *, struct cmdq_item *, int);
void set_cfg_file(const char *);
+const char *get_cfg_file(void);
void printflike(1, 2) cfg_add_cause(const char *, ...);
void cfg_print_causes(struct cmdq_item *);
void cfg_show_causes(struct session *);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment