Plugin suedit - preserve environment

This commit is contained in:
Arun Prakash Jana 2021-07-17 21:41:19 +05:30
parent d54bc230f6
commit 6f14190e6d
No known key found for this signature in database
GPG Key ID: A75979F35C080412
3 changed files with 4 additions and 2 deletions

1
nnn.1
View File

@ -414,6 +414,7 @@ separated by \fI;\fR:
----------------------------------- + ------------------------------------------------- ----------------------------------- + -------------------------------------------------
Key:Command | Description Key:Command | Description
----------------------------------- + ------------------------------------------------- ----------------------------------- + -------------------------------------------------
e:-!sudo -E vim $nnn* | Edit file as root in vim
g:-!git diff | Show git diff g:-!git diff | Show git diff
h:-!hx $nnn* | Open hovered file in hx hex editor h:-!hx $nnn* | Open hovered file in hx hex editor
k:-!fuser -kiv $nnn* | Interactively kill process(es) using hovered file k:-!fuser -kiv $nnn* | Interactively kill process(es) using hovered file

View File

@ -170,6 +170,7 @@ Notes:
| Key:Command | Description | | Key:Command | Description |
|---|---| |---|---|
| `e:-!sudo -E vim $nnn*` | Edit file as root in vim |
| `g:-!git diff` | Show git diff | | `g:-!git diff` | Show git diff |
| `h:-!hx $nnn*` | Open hovered file in [hx](https://github.com/krpors/hx) hex editor | | `h:-!hx $nnn*` | Open hovered file in [hx](https://github.com/krpors/hx) hex editor |
| `k:-!fuser -kiv $nnn*` | Interactively kill process(es) using hovered file | | `k:-!fuser -kiv $nnn*` | Interactively kill process(es) using hovered file |

View File

@ -8,9 +8,9 @@
EDITOR="${EDITOR:-vim}" EDITOR="${EDITOR:-vim}"
if type sudo >/dev/null 2>&1; then if type sudo >/dev/null 2>&1; then
sudo "$EDITOR" "$1" sudo -E "$EDITOR" "$1"
elif type sudoedit >/dev/null 2>&1; then elif type sudoedit >/dev/null 2>&1; then
sudoedit "$1" sudoedit -E "$1"
elif type doas >/dev/null 2>&1; then elif type doas >/dev/null 2>&1; then
doas "$EDITOR" "$1" doas "$EDITOR" "$1"
fi fi