2016-03-18 20:29:59 (UTC-03:00)
Marcel Rodrigues <marcelgmr@gmail.com>
Add 'o' to open file with $ROVER_OPEN.
diff --git a/README.md b/README.md index 82478a2..bebc055 100644 --- a/README.md +++ b/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 diff --git a/config.h b/config.h index ba4ebdb..b87b5d8 100644 --- a/config.h +++ b/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" diff --git a/rover.1 b/rover.1 index 503ab2d..190ba14 100644 --- a/rover.1 +++ b/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 variable before running a 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 diff --git a/rover.c b/rover.c index cca95ad..e3bf98b 100644 --- a/rover.c +++ b/rover.c @@ -1103,6 +1103,10 @@ main(int argc, char *argv[]) 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; if (!rover.nfiles) continue;