aboutsummaryrefslogtreecommitdiff
path: root/dwim.1
diff options
context:
space:
mode:
Diffstat (limited to 'dwim.1')
-rw-r--r--dwim.1102
1 files changed, 77 insertions, 25 deletions
diff --git a/dwim.1 b/dwim.1
index 99776e2..d2e95fa 100644
--- a/dwim.1
+++ b/dwim.1
@@ -3,49 +3,101 @@
.Os
.Sh NAME
.Nm dwim
-.Nd do what i mean with a given phrase (file, URL etc.)
+.Nd do what I mean with a given phrase (file, URL etc.)
.
.Sh SYNOPSIS
.Nm dwim
-.Ar phrase
+.Op Fl d
+.Op Ar phrase
.
.Sh DESCRIPTION
+.Pp
.Nm dwim
is a program similar to Plan 9's plumber.
It takes a string
.Ar ( phrase )
and matches it against a number of regular expressions,
which are connected to handlers, specifying what to do with the phrase.
-.
+.Pp
+If no
+.Ar phrase
+is given, the current X selection is retrieved from
+.Xr xsel 1 .
+This is surprisingly useful.
+If you assign a shortcut key to invoke
+.Nm dwim
+in your window manager,
+you can select a string of text,
+press the shortcut key and
+.Nm
+will act on the selected text.
+.Pp
+If the
+.Li xtitle
+program is installed on the system,
+.Nm
+will try to figure out the current working directory
+from the window title.
+The following title formats are recognized:
+.Bl -enum -offset indent -compact
+.It
+.Em path
+.It
+.Em program
+.Em ( path )
+.El
+.Pp
+Tilde expansion is supported.
.Sh EXAMPLES
.Ss Without X selection
Open
-.Li message-window.lisp
-on line 164
-in
-.Li $EDITOR :
-.
+.Em Makefile
+in the configured text editor:
.Bd -literal
-$ grep 'def.*indicator ' *.lisp
-message-window.lisp:164:(defun show-frame-indicator (group &optional force)
-$ dwim message-window.lisp:164
+$ ls
+LICENSE Makefile README.md repl repl.1 repl.c
+$ dwim Makefile
.Ed
-.
.Ss With X selection
-Open
-.Li Makefile
-in
-.Li $EDITOR :
-.
+.Pp
+If we represent the current X selection with bold text,
+the following procedure opens
+.Em message-window.lisp
+on line 164
+in the configured text editor:
.Bd -literal
-$ ls
-LICENSE Makefile README.md repl repl.1 repl.c
-# (select Makefile)
+$ grep -n 'def.*indicator ' *.lisp
+\f(CBmessage-window.lisp:164:(defun\fP show-frame-indicator (group &optional force)
$ dwim
.Ed
-.
-.Sh EXTENDING
-It is a simple Perl script that is easily extensible.
-.Sh AUTHOR
+.Sh CONFIGURATION
+.Nm
+is configured by editing the source code.
+It is a simple Perl script,
+which uses regular expressions to parse phrases.
+Default programs are defined at the top of the script.
+The following associations are defined by default:
+.Bl -tag -width 18n -offset indent -compact
+.It OPENER
+.Li xtopen
+(change this to
+.Li xterm -e
+or equivalent)
+.It EDITOR
+.Li OPENER vi
+.It PDF_VIEWER
+.Li xpdf
+.It MAN_VIEWER
+.Li OPENER man
+.It MAILER
+.Li OPENER mutt
+.It BROWSER
+.Li OPENER w3m -title
+.It FILE_BROWSER
+.Li OPENER noice
+.It MAILDIR_VIEWER
+.Li OPENER mutt -f
+.El
+.Sh AUTHORS
.An -nosplit
-.An John Ankarström Aq Mt john@ankarstrom.se
+.An John Ankarström Aq Mt "john (at) ankarstrom.se"