Commit Diff


commit - dfcc74a1ce9f275fa591e0f27641cb40149ae2ce
commit + 528f478659a7b3a152bbae31eb87ce4fbb30bc35
blob - 82478a2566254100e462d55330f089d58f28b600
blob + bebc0557c87bf31aa32545799c757d017d312154
--- README.md
+++ README.md
@@ -40,6 +40,7 @@ Quick Start
   RETURN - open $SHELL on the current directory
    SPACE - open $PAGER with the selected file
        e - open $EDITOR with the selected file
+       o - open $ROVER_OPEN with the selected file
        / - start incremental search (RETURN to finish)
    f/d/s - toggle file/directory/hidden listing
      n/N - create new file/directory
blob - ba4ebdb04148227c68581a921b71252f040979e3
blob + b87b5d88206d4969056d571eba14a26f78cdb2f6
--- config.h
+++ config.h
@@ -17,6 +17,7 @@
 #define RVK_SHELL       "^M"
 #define RVK_VIEW        " "
 #define RVK_EDIT        "e"
+#define RVK_OPEN        "o"
 #define RVK_SEARCH      "/"
 #define RVK_TG_FILES    "f"
 #define RVK_TG_DIRS     "d"
blob - 503ab2de65145062551ea7c0e32bae9bbf5ce71e
blob + 190ba14c0e522bbfce09ff25bb0dea75ae0158ab
--- rover.1
+++ rover.1
@@ -108,6 +108,9 @@ Open \fB$PAGER\fR with the selected file.
 .B e
 Open \fB$EDITOR\fR with the selected file.
 .TP
+.B o
+Open \fB$ROVER_OPEN\fR with the selected file.
+.TP
 .B /
 Start incremental search.
 .TP
@@ -187,6 +190,10 @@ Rover writes the name of the selected entry to this va
 subprocess. This allows one to use the selection as part of an arbitrary command
 by first invoking a shell from Rover (see the \fBCOMMANDS\fR section) and then
 typing something like \fBgrep abc "$RVSEL"\fR.
+.TP
+.B ROVER_OPEN
+This variable can be set to a command accepting a single argument: a filename.
+The command is supposed to open the given file with an appropriate program.
 .SH CONFIGURATION
 .PP
 If you want to change Rover key bindings or colors, you can edit the
blob - cca95ad7ee970590454ca968f55627306311b6e2
blob + e3bf98be63ab565013599a36dc542744ec398d4a
--- rover.c
+++ rover.c
@@ -1102,6 +1102,10 @@ main(int argc, char *argv[])
         } else if (!strcmp(key, RVK_EDIT)) {
             if (!rover.nfiles || S_ISDIR(EMODE(ESEL))) continue;
             if (open_with_env("EDITOR", ENAME(ESEL)))
+                cd(0);
+        } else if (!strcmp(key, RVK_OPEN)) {
+            if (!rover.nfiles || S_ISDIR(EMODE(ESEL))) continue;
+            if (open_with_env("ROVER_OPEN", ENAME(ESEL)))
                 cd(0);
         } else if (!strcmp(key, RVK_SEARCH)) {
             int oldsel, oldscroll, length;