1
1
mirror of https://github.com/jarun/nnn.git synced 2024-11-04 13:53:35 +03:00

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
----------------------------------- + -------------------------------------------------
e:-!sudo -E vim $nnn* | Edit file as root in vim
g:-!git diff | Show git diff
h:-!hx $nnn* | Open hovered file in hx hex editor
k:-!fuser -kiv $nnn* | Interactively kill process(es) using hovered file

View File

@ -170,6 +170,7 @@ Notes:
| Key:Command | Description |
|---|---|
| `e:-!sudo -E vim $nnn*` | Edit file as root in vim |
| `g:-!git diff` | Show git diff |
| `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 |

View File

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