aboutsummaryrefslogtreecommitdiff
path: root/dwim
diff options
context:
space:
mode:
authorJohn <john@ankarstrom.se>2019-06-01 13:54:57 +0200
committerJohn <john@ankarstrom.se>2019-06-01 14:04:06 +0200
commit99315219aba0481466c8bb236548284ccec5a1d5 (patch)
treeb8d34b92e746019ce8c75afa0402c0d378870d75 /dwim
parent21ee94842b6e461b0cd4536557f9a5a2776132aa (diff)
downloaddwim-99315219aba0481466c8bb236548284ccec5a1d5.tar.gz
dwim.pl
This is the Perl version of dwim. It is much easier to work with and extend, thanks to Perl's excellent regex support. The "phrase" (either $ARGV[0] or the primary X selection) is matched against regular expressions in the for loop (a primitive switch statement). This is the place to add handlers. Options are specified through environment variables, defined with default values in the section before the handlers. The `path` subroutine transforms a relative path to an absolute path based on the title of the current window. It depends on the `xtitle` program, and for it to work, you must instruct your shell (or editor) to set the terminal's title to the current directory (or currently edited file). (As such, `path` doesn't work with other programs than terminals and editors.)
Diffstat (limited to 'dwim')
l---------dwim1
1 files changed, 1 insertions, 0 deletions
diff --git a/dwim b/dwim
new file mode 120000
index 0000000..06baf07
--- /dev/null
+++ b/dwim
@@ -0,0 +1 @@
+dwim.pl \ No newline at end of file