Updated Basic use cases (markdown)

Arun 2022-08-16 21:33:29 +05:30
parent 8b8146827d
commit fab5618549

@ -269,17 +269,19 @@ mocp -a $(nnn -p -)
## Remote mounts
`nnn` integrates with SSHFS and rclone to support remote mounts. The mount points (for remotes as well as archives) are created within:
`nnn` integrates with `sshfs` and `rclone` to support remote mounts. The mount points (for remotes as well as archives) are created within:
${XDG_CONFIG_HOME:-$HOME/.config}/nnn/mounts
Upon successful unmount, the mount points are removed.
#### SSHFS
The key to mount a remote folder is <kbd>c</kbd> (for *c*onnect).
#### sshfs
Example primary setup: [connect to SSH sever from desktop](https://gist.github.com/jarun/660fd1d5e79e1a4038de8ba5f2e1a513).
To connect to and mount remote shares using SSHFS, `nnn` requires the ssh configuration file `~/.ssh/config` to have the host entries. sshfs reads this file.
To connect to and mount remote shares using `sshfs`, `nnn` requires the ssh configuration file `~/.ssh/config` to have the host entries. sshfs reads this file.
Example host entry for a Termux environment on Android device:
@ -297,6 +299,15 @@ Host phone
# ProxyJump jumphost
```
Once you try to connect using `sshfs`, `nnn` will prompt for the name of the host (`phone` in the example above). Type the exact name (as it appears in this file) optionally followed by the path in the remote host you want to mount.
Examples:
```
phone <----- Mount your remote user's $HOME folder in `phone`
phone:/tmp <----- Mount the remote `tmp` folder in `phone`
```
Host `phone` will be mounted at `${XDG_CONFIG_HOME:-$HOME/.config}/nnn/mounts/phone`.
If you need to pass options to the `sshfs` command, you can do so:
@ -311,7 +322,7 @@ Options must be preceded by `sshfs` and comma-separated without any space betwee
The remote needs to be [configured and authenticated](https://rclone.org/docs/) beforehand (one-time activity). The name used to configure is all `nnn` needs to connect and mount (as well as unmount) the remote service locally.
Like SSHFS, if you need to pass options, use the dedicated environment variable:
If you need to pass options, use the dedicated environment variable for `rclone`:
```sh
export NNN_RCLONE='rclone mount --read-only --no-checksum'
@ -325,13 +336,13 @@ Tip: To list all the remotes in the rclone config file: `rclone listremotes`
The unmount option (which also unmounts mounted archives BTW) works in 2 ways:
1. hover on the mount point, press <kbd>u</kbd> (this works for both remotes and archives)
1. hover on the mount point, press <kbd>u</kbd> (for *u*nmount). This works for both remotes and archives.
2. if the current entry is not a mount point, `nnn` prompts for the remote host name
Notes:
1. `nnn` opens the mount point in a smart context after successful mounts.
2. More information on [SSHFS](https://wiki.archlinux.org/index.php/SSHFS).
2. More information on [sshfs](https://wiki.archlinux.org/index.php/SSHFS).
## Synced quick notes
Open your note file OR directory (if your editor supports opening a dir like `vim`) in your favourite editor like a plugin (see plugin docs for more info):