diff --git a/README.md b/README.md index 6890c86a..961715ef 100644 --- a/README.md +++ b/README.md @@ -66,8 +66,7 @@ Have as many scripts as you want to extend the power of `nnn`! Pick from the ava - [Troubleshooting](#troubleshooting) - [Tmux configuration](#tmux-configuration) - [BSD terminal issue](#bsd-terminal-issue) - - [Restrict file open](#restrict-file-open) - - [Restrict 0-byte files](#restrict-0-byte-files) + - [100% CPU usage](#100-cpu-usage) - [Why fork?](#why-fork) - [Mentions](#mentions) - [Developers](#developers) @@ -345,7 +344,7 @@ The following indicators are used in the detail view: | `NNN_USE_EDITOR=1` | open text files in `$EDITOR` (`$VISUAL`, if defined; fallback vi) | | `NNN_NO_AUTOSELECT=1` | do not auto-select matching dir in _nav-as-you-type_ mode | | `NNN_RESTRICT_NAV_OPEN=1` | open files on , not or l | -| `NNN_RESTRICT_0B=1` | do not open 0-byte files | +| `NNN_RESTRICT_0B=1` | disable 0-byte file open; see [#187](https://github.com/jarun/nnn/issues/187), use _edit_ or _open with_ | | `NNN_TRASH=1` | trash files to the desktop Trash [default: delete] | | `NNN_OPS_PROG=1` | show copy, move progress on Linux | @@ -404,23 +403,9 @@ TLDR: Use the keybind K to toggle selection if you are having issues By default in OpenBSD & FreeBSD (and probably on macOS as well), `stty` maps ^Y to `DSUSP`. This means that typing ^Y will suspend `nnn` as if you typed ^Z (you can bring `nnn` back to the foreground by issuing `fg`) instead of entering multi-selection mode. You can check this with `stty -a`. If it includes the text `dsusp = ^Y`, issuing `stty dsusp undef` will disable this `DSUSP` and let `nnn` receive the ^Y instead. -##### Restrict file open - -In order to disable opening files on accidental navigation key ( or l) press: - - export NNN_RESTRICT_NAV_OPEN=1 - -Use Enter to open these files. - -##### Restrict 0-byte files - -Restrict opening 0-byte files due to [unexpected behaviour](https://github.com/jarun/nnn/issues/187); use _edit_ or _open with_ to open the file. - - export NNN_RESTRICT_0B=1 - ##### 100% CPU usage -There is a known issue where if you close the terminal directly with `nnn` waiting for a spawned process to exit, a deadlock occurs and `nnn` uses 100% CPU. Please see issue [#225](https://github.com/jarun/nnn/issues/225) for more details. Make sure you quit the spawned process before closing the terminal. It's not a problem if there is no spawned process. +There is a known issue where if you close the terminal directly with `nnn` waiting for a spawned process to exit, a deadlock occurs and `nnn` uses 100% CPU. Please see issue [#225](https://github.com/jarun/nnn/issues/225) for more details. Make sure you quit the spawned process before closing the terminal. It's not a problem if there is no spawned process (`nnn` isn't blocked) as `nnn` checks if the parent process has exited. #### WHY FORK? diff --git a/plugins/nmount b/plugins/nmount index e08966a0..ce9f99e6 100755 --- a/plugins/nmount +++ b/plugins/nmount @@ -1,7 +1,8 @@ #!/usr/bin/env sh # Description: Toggle mount status of a device using pmount -# If the device is mounted, it will be unmounted and vice versa. +# If the device is not mounted, it will be mounted. +# If the device is mounted, it will be unmounted and powered down. # # Shell: POSIX compliant # Author: Arun Prakash Jana @@ -19,7 +20,10 @@ echo if grep -qs "$dev " /proc/mounts; then pumount "$dev" - echo $dev unmounted. + if [ "$?" -eq "0" ]; then + udisksctl power-off -b /dev/"$dev" + echo $dev ejected. + fi else pmount "$dev" echo "$dev" mounted to "$(lsblk -n /dev/"$dev" | rev | cut -d' ' -f1 | rev)".