config option to specify archive mounter utility

This commit is contained in:
Arun Prakash Jana 2023-04-14 01:47:50 +05:30
parent 9319b638e7
commit 8a1dce888a
No known key found for this signature in database
GPG Key ID: 4A865183AF6C5631
2 changed files with 16 additions and 7 deletions

16
nnn.1
View File

@ -59,7 +59,7 @@ to see the list of keybinds.
supports the following options: supports the following options:
.Pp .Pp
.Fl a .Fl a
auto-setup temporary NNN_FIFO (described in ENVIRONMENT section) auto-setup temporary \fBNNN_FIFO\fR (described in \fIENVIRONMENT\fR section)
.Pp .Pp
.Fl A .Fl A
disable directory auto-enter on unique filter match disable directory auto-enter on unique filter match
@ -369,17 +369,17 @@ selected entries from the listed results.
.Sh BOOKMARKS .Sh BOOKMARKS
There are 2 ways (can be used together) to manage bookmarks. There are 2 ways (can be used together) to manage bookmarks.
.Pp .Pp
(1) Bookmark keys: See \fINNN_BMS\fR under \fIENVIORNMENT\fR section on how to set (1) Bookmark keys: See \fBNNN_BMS\fR under \fIENVIORNMENT\fR section on how to set
bookmark keys. bookmark keys.
The select bookmark key \fIb\fR lists all the bookmark keys set in \fINNN_BMS\fR The select bookmark key \fIb\fR lists all the bookmark keys set in \fBNNN_BMS\fR
in the bookmarks prompt. in the bookmarks prompt.
.Pp .Pp
(2) Symlinked bookmarks: A symlinked bookmark to the current directory can (2) Symlinked bookmarks: A symlinked bookmark to the current directory can
be created with the \fIB\fR key (or manually under ~/.config/nnn/bookmarks). be created with the \fIB\fR key (or manually under ~/.config/nnn/bookmarks).
Pressing 'Enter' at the bookmarks prompt takes to this directory. Pressing 'Enter' at the bookmarks prompt takes to this directory.
If \fINNN_BMS\fR is not set, the select bookmark key directly opens it. If \fBNNN_BMS\fR is not set, the select bookmark key directly opens it.
.Pp .Pp
On entering a bookmark, the directory where the select bookmark key was On entering a bookmark, the directory where the select bookmark key was
pressed is set as the previous directory. Press '-' to return to it. pressed is set as the previous directory. Press '-' to return to it.
@ -540,6 +540,11 @@ separated by \fI;\fR:
NOTE: Non-default formats may require a third-party utility. NOTE: Non-default formats may require a third-party utility.
.Ed .Ed
.Pp .Pp
\fBNNN_ARCHMNT:\fR optional archive mounter utility (default: archivemount).
.Bd -literal
export NNN_ARCHIVE='fuse-archive'
.Ed
.Pp
\fBNNN_SSHFS:\fR specify custom sshfs command with options: \fBNNN_SSHFS:\fR specify custom sshfs command with options:
.Bd -literal .Bd -literal
export NNN_SSHFS='sshfs -o reconnect,idmap=user,cache_timeout=3600' export NNN_SSHFS='sshfs -o reconnect,idmap=user,cache_timeout=3600'
@ -561,6 +566,9 @@ separated by \fI;\fR:
.Ed .Ed
.Pp .Pp
\fBNNN_SEL:\fR absolute path to custom selection file. \fBNNN_SEL:\fR absolute path to custom selection file.
.Bd -literal
export NNN_SEL='/tmp/.sel'
.Ed
.Pp .Pp
\fBNNN_FIFO:\fR path of a named pipe to write the hovered file path: \fBNNN_FIFO:\fR path of a named pipe to write the hovered file path:
.Bd -literal .Bd -literal

View File

@ -536,6 +536,7 @@ static runstate g_state;
#define UTIL_TRASH_CLI 18 #define UTIL_TRASH_CLI 18
#define UTIL_GIO_TRASH 19 #define UTIL_GIO_TRASH 19
#define UTIL_RM_RF 20 #define UTIL_RM_RF 20
#define UTIL_ARCHMNT 21
/* Utilities to open files, run actions */ /* Utilities to open files, run actions */
static char * const utils[] = { static char * const utils[] = {
@ -576,6 +577,7 @@ static char * const utils[] = {
"trash-put", "trash-put",
"gio trash", "gio trash",
"rm -rf", "rm -rf",
"archivemount",
}; };
/* Common strings */ /* Common strings */
@ -4800,14 +4802,13 @@ static void valid_parent(char *path, char *lastname)
static bool archive_mount(char *newpath) static bool archive_mount(char *newpath)
{ {
char *str = "install archivemount"; char *dir, *cmd = xgetenv("NNN_ARCHMNT", utils[UTIL_ARCHMNT]);
char *dir, *cmd = str + 8; /* Start of "archivemount" */
char *name = pdents[cur].name; char *name = pdents[cur].name;
size_t len = pdents[cur].nlen; size_t len = pdents[cur].nlen;
char mntpath[PATH_MAX]; char mntpath[PATH_MAX];
if (!getutil(cmd)) { if (!getutil(cmd)) {
printmsg(str); printmsg("install utility");
return FALSE; return FALSE;
} }