aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn <john@ankarstrom.se>2019-06-04 20:40:07 +0200
committerJohn <john@ankarstrom.se>2019-06-04 20:40:07 +0200
commit49aa32c46a6f0375581492cde45a55d7c3331a07 (patch)
tree186b4c5aacbf4a1b24a8920bd0d895e685cbde06
parent08d83595dd729ca42ab1746bc5b7744e99eec1aa (diff)
downloaddwim-49aa32c46a6f0375581492cde45a55d7c3331a07.tar.gz
rename handlers
-rwxr-xr-xdwim14
1 files changed, 7 insertions, 7 deletions
diff --git a/dwim b/dwim
index bf7da16..e63b107 100755
--- a/dwim
+++ b/dwim
@@ -33,20 +33,20 @@ for ($phrase) {
}
if (/^(.+):(\d+)(:.*?)?$/) {
- handle "file:line";
- my $p = path($1);
+ handle "{file}:{line} (like grep -n)";
+ my $p = path $1;
exec @LAUNCHER, @EDITOR, "-c", ":$2", "$p"
}
if (/^(.+) line (\d+)\.?$/) {
- handle "file \" line \" line (like perl)";
- my $p = path($1);
+ handle "{file} line {line} (like perl)";
+ my $p = path $1;
exec @LAUNCHER, @EDITOR, "-c", ":$2", "$p"
}
if (/^(.+):(.+)$/) {
- handle "file:query (like grep)";
- my $p = path($1);
+ handle "{file}:{query} (like grep)";
+ my $p = path $1;
exec @LAUNCHER, @EDITOR, "-c", "/$2", "$p" if -e $p;
fail "file not found" if $o{d};
# otherwise fall through
@@ -54,7 +54,7 @@ for ($phrase) {
if (/^([^\s]+)$/) {
handle "maildir / directory / file";
- my $p = path($1);
+ my $p = path $1;
exec @LAUNCHER, @MAILDIR_VIEWER, "$p" if $p =~ /^$MAILROOT/; # maildir
exec @LAUNCHER, @EDITOR, "$p" if -e $p; #file
fail "file not found" if $o{d};