summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd-find-window.c81
-rw-r--r--tmux.18
2 files changed, 60 insertions, 29 deletions
diff --git a/cmd-find-window.c b/cmd-find-window.c
index c2d230a5..c29878b5 100644
--- a/cmd-find-window.c
+++ b/cmd-find-window.c
@@ -32,8 +32,8 @@ const struct cmd_entry cmd_find_window_entry = {
.name = "find-window",
.alias = "findw",
- .args = { "CNt:TZ", 1, 1 },
- .usage = "[-CNTZ] " CMD_TARGET_PANE_USAGE " match-string",
+ .args = { "CNrt:TZ", 1, 1 },
+ .usage = "[-CNrTZ] " CMD_TARGET_PANE_USAGE " match-string",
.target = { 't', CMD_FIND_PANE, 0 },
@@ -57,30 +57,59 @@ cmd_find_window_exec(struct cmd *self, struct cmdq_item *item)
if (!C && !N && !T)
C = N = T = 1;
- if (C && N && T) {
- xasprintf(&filter,
- "#{||:"
- "#{C:%s},#{||:#{m:*%s*,#{window_name}},"
- "#{m:*%s*,#{pane_title}}}}",
- s, s, s);
- } else if (C && N) {
- xasprintf(&filter,
- "#{||:#{C:%s},#{m:*%s*,#{window_name}}}",
- s, s);
- } else if (C && T) {
- xasprintf(&filter,
- "#{||:#{C:%s},#{m:*%s*,#{pane_title}}}",
- s, s);
- } else if (N && T) {
- xasprintf(&filter,
- "#{||:#{m:*%s*,#{window_name}},#{m:*%s*,#{pane_title}}}",
- s, s);
- } else if (C)
- xasprintf(&filter, "#{C:%s}", s);
- else if (N)
- xasprintf(&filter, "#{m:*%s*,#{window_name}}", s);
- else
- xasprintf(&filter, "#{m:*%s*,#{pane_title}}", s);
+ if (!args_has(args, 'r')) {
+ if (C && N && T) {
+ xasprintf(&filter,
+ "#{||:"
+ "#{C:%s},#{||:#{m:*%s*,#{window_name}},"
+ "#{m:*%s*,#{pane_title}}}}",
+ s, s, s);
+ } else if (C && N) {
+ xasprintf(&filter,
+ "#{||:#{C:%s},#{m:*%s*,#{window_name}}}",
+ s, s);
+ } else if (C && T) {
+ xasprintf(&filter,
+ "#{||:#{C:%s},#{m:*%s*,#{pane_title}}}",
+ s, s);
+ } else if (N && T) {
+ xasprintf(&filter,
+ "#{||:#{m:*%s*,#{window_name}},"
+ "#{m:*%s*,#{pane_title}}}",
+ s, s);
+ } else if (C)
+ xasprintf(&filter, "#{C:%s}", s);
+ else if (N)
+ xasprintf(&filter, "#{m:*%s*,#{window_name}}", s);
+ else
+ xasprintf(&filter, "#{m:*%s*,#{pane_title}}", s);
+ } else {
+ if (C && N && T) {
+ xasprintf(&filter,
+ "#{||:"
+ "#{C/r:%s},#{||:#{m/r:%s,#{window_name}},"
+ "#{m/r:%s,#{pane_title}}}}",
+ s, s, s);
+ } else if (C && N) {
+ xasprintf(&filter,
+ "#{||:#{C/r:%s},#{m/r:%s,#{window_name}}}",
+ s, s);
+ } else if (C && T) {
+ xasprintf(&filter,
+ "#{||:#{C/r:%s},#{m/r:%s,#{pane_title}}}",
+ s, s);
+ } else if (N && T) {
+ xasprintf(&filter,
+ "#{||:#{m/r:%s,#{window_name}},"
+ "#{m/r:%s,#{pane_title}}}",
+ s, s);
+ } else if (C)
+ xasprintf(&filter, "#{C/r:%s}", s);
+ else if (N)
+ xasprintf(&filter, "#{m/r:%s,#{window_name}}", s);
+ else
+ xasprintf(&filter, "#{m/r:%s,#{pane_title}}", s);
+ }
new_args = args_parse("", 1, &argv);
if (args_has(args, 'Z'))
diff --git a/tmux.1 b/tmux.1
index 1315e29a..a7b4af05 100644
--- a/tmux.1
+++ b/tmux.1
@@ -1828,14 +1828,16 @@ With
.Fl b ,
other commands are not blocked from running until the indicator is closed.
.It Xo Ic find-window
-.Op Fl CNTZ
+.Op Fl rCNTZ
.Op Fl t Ar target-pane
.Ar match-string
.Xc
.D1 (alias: Ic findw )
-Search for the
+Search for a
.Xr fnmatch 3
-pattern
+pattern or, with
+.Fl r ,
+regular expression
.Ar match-string
in window names, titles, and visible content (but not history).
The flags control matching behavior: