This commit is contained in:
Arun Prakash Jana 2019-06-24 21:45:02 +05:30
parent 2934db3482
commit 277f156c37
No known key found for this signature in database
GPG key ID: A75979F35C080412
3 changed files with 28 additions and 7 deletions

View file

@ -204,6 +204,7 @@ Option completion scripts for Bash, Fish and Zsh can be found in respective subd
| `NNN_BMS='d:~/Documents;D:~/Docs archive/'` | specify bookmarks (max 10) | | `NNN_BMS='d:~/Documents;D:~/Docs archive/'` | specify bookmarks (max 10) |
| `NNN_USE_EDITOR=1` | open text files in `$VISUAL` (else `$EDITOR`, fallback vi) | | `NNN_USE_EDITOR=1` | open text files in `$VISUAL` (else `$EDITOR`, fallback vi) |
| `NNN_CONTEXT_COLORS='1234'` | specify per context color [default: '4444' (all blue)] | | `NNN_CONTEXT_COLORS='1234'` | specify per context color [default: '4444' (all blue)] |
| `NNN_SSHFS_OPTS='sshfs -o reconnect,idmap=user'` | specify SSHFS options |
| `NNN_NOTE=/home/user/Dropbox/notes` | path to note file [default: none] | | `NNN_NOTE=/home/user/Dropbox/notes` | path to note file [default: none] |
| `NNN_OPENER=mimeopen` | custom file opener | | `NNN_OPENER=mimeopen` | custom file opener |
| `NNN_IDLE_TIMEOUT=300` | idle seconds before locking terminal [default: disabled] | | `NNN_IDLE_TIMEOUT=300` | idle seconds before locking terminal [default: disabled] |
@ -399,6 +400,12 @@ Host phone
The above host `phone` will be mounted at `${XDG_CONFIG_HOME:-$HOME/.config}/nnn/phone`. `nnn` creates the directory `phone` if it doesn't exist. The above host `phone` will be mounted at `${XDG_CONFIG_HOME:-$HOME/.config}/nnn/phone`. `nnn` creates the directory `phone` if it doesn't exist.
If you need to pass options to the `sshfs` command, you can do so:
export NNN_SSHFS_OPTS='sshfs -o reconnect,idmap=user,cache_timeout=3600'
The options must be preceded by `sshfs` and comma-separated without any space between them.
Notes: Notes:
1. `nnn` takes you to the mount point after successful mounts. To jump back to the last directory, press the usual <kbd>-</kbd>. 1. `nnn` takes you to the mount point after successful mounts. To jump back to the last directory, press the usual <kbd>-</kbd>.

7
nnn.1
View file

@ -157,6 +157,13 @@ when dealing with the !, e and p commands respectively. A single combination to
codes: 0-black, 1-red, 2-green, 3-yellow, 4-blue (default), 5-magenta, 6-cyan, 7-white codes: 0-black, 1-red, 2-green, 3-yellow, 4-blue (default), 5-magenta, 6-cyan, 7-white
.Ed .Ed
.Pp .Pp
\fBNNN_SSHFS_OPTS:\fR Pass additional options to sshfs command:
.Bd -literal
export NNN_SSHFS_OPTS='sshfs -o reconnect,idmap=user,cache_timeout=3600'
NOTE: The options must be preceded by `sshfs` and comma-separated without any space between them.
.Ed
.Pp
\fBNNN_IDLE_TIMEOUT:\fR set idle timeout (in seconds) to invoke terminal locker (default: disabled). \fBNNN_IDLE_TIMEOUT:\fR set idle timeout (in seconds) to invoke terminal locker (default: disabled).
.Pp .Pp
\fBNNN_COPIER:\fR system clipboard copier script. The project page has some sample copier scripts. \fBNNN_COPIER:\fR system clipboard copier script. The project page has some sample copier scripts.

View file

@ -2569,8 +2569,14 @@ static bool create_dir(const char *path)
static bool sshfs_mount(char *path, char *newpath, int *presel) static bool sshfs_mount(char *path, char *newpath, int *presel)
{ {
uchar flag = F_NORMAL;
int r; int r;
char *tmp; char *tmp, *env, *cmd = "sshfs";
if (!getutil(cmd)) {
printwait("sshfs missing", presel);
return FALSE;
}
tmp = xreadline(NULL, "host: "); tmp = xreadline(NULL, "host: ");
if (!tmp[0]) if (!tmp[0])
@ -2583,18 +2589,19 @@ static bool sshfs_mount(char *path, char *newpath, int *presel)
return FALSE; return FALSE;
} }
if (!getutil("sshfs")) {
printwait("sshfs missing", presel);
return FALSE;
}
/* Convert "Host" to "Host:" */ /* Convert "Host" to "Host:" */
r = strlen(tmp); r = strlen(tmp);
tmp[r] = ':'; tmp[r] = ':';
tmp[r + 1] = '\0'; tmp[r + 1] = '\0';
env = getenv("NNN_SSHFS_OPTS");
if (env)
flag |= F_MULTI;
else
env = cmd;
/* Connect to remote */ /* Connect to remote */
if (spawn("sshfs", tmp, newpath, NULL, F_NORMAL)) { if (spawn(env, tmp, newpath, NULL, flag)) {
printwait("mount failed", presel); printwait("mount failed", presel);
return FALSE; return FALSE;
} }