aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-07-26 13:16:13 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-07-26 13:16:13 +0200
commit42d01da96f85c6e2de6e6061aa418d4aa8a64441 (patch)
tree4e70d9ea8fe2f46b281a0446d53d6bb263d50aeb
parent9b81e70bb3b364e7ed79871b2af7993cb2892139 (diff)
downloaddwim-42d01da96f85c6e2de6e6061aa418d4aa8a64441.tar.gz
Handle file:/regex
Like Plan 9. For example, taskbar.c:/^Render.
-rwxr-xr-xdwim12
1 files changed, 7 insertions, 5 deletions
diff --git a/dwim b/dwim
index a5d8030..a3224cb 100755
--- a/dwim
+++ b/dwim
@@ -42,14 +42,16 @@ for ($phrase) {
run @MAILER, $1
}
- if (/^(.+?):(\d+).*?$/) {
- handle 'file:line (like grep -n)';
+ if (/^(.+?):(\d+|\/\S+)/) {
+ handle 'file:line/query (like grep -n)';
my $p = path $1;
- run @EDITOR, "+$2", $p
+ my $q = $2;
+ $q =~ s/\)$//;
+ run @EDITOR, "+$q", $p
}
- if (/^(.+) line (\d+)\.?$/) {
- handle 'FILE line LINE (like perl)';
+ if (/^(.+) line (\d+)/) {
+ handle '<file> line <line> (like perl)';
my $p = path $1;
run @EDITOR, "+$2", $p
}