commit 6f14190e6daa10f1a52c97d26f78d3cb440c8f4b
parent d54bc230f67a02130296fc6196f92dd331430144
Author: Arun Prakash Jana <engineerarun@gmail.com>
Date: Sat, 17 Jul 2021 21:41:19 +0530
Plugin suedit - preserve environment
Diffstat:
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/nnn.1 b/nnn.1
@@ -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
diff --git a/plugins/README.md b/plugins/README.md
@@ -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 |
diff --git a/plugins/suedit b/plugins/suedit
@@ -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