From 42d01da96f85c6e2de6e6061aa418d4aa8a64441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Mon, 26 Jul 2021 13:16:13 +0200 Subject: Handle file:/regex Like Plan 9. For example, taskbar.c:/^Render. --- dwim | 12 +++++++----- 1 file 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 ' line (like perl)'; my $p = path $1; run @EDITOR, "+$2", $p } -- cgit v1.2.3