Last active
August 2, 2018 17:08
-
-
Save giodamelio/bd7dcd855d49b6916a75b0596f288469 to your computer and use it in GitHub Desktop.
A patch to remove $VISUAL support from NNN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/nnn.c b/nnn.c | |
index a3a422a..6b26138 100644 | |
--- a/nnn.c | |
+++ b/nnn.c | |
@@ -2028,8 +2028,6 @@ show_help(char *path) | |
dprintf(fd, "SHELL: %s\n", getenv("SHELL")); | |
if (getenv("SHLVL")) | |
dprintf(fd, "SHLVL: %s\n", getenv("SHLVL")); | |
- if (getenv("VISUAL")) | |
- dprintf(fd, "VISUAL: %s\n", getenv("VISUAL")); | |
else if (getenv("EDITOR")) | |
dprintf(fd, "EDITOR: %s\n", getenv("EDITOR")); | |
if (getenv("PAGER")) | |
@@ -3251,7 +3249,7 @@ nochange: | |
goto begin; | |
case SEL_RUNARG: | |
run = xgetenv(env, run); | |
- if ((!run || !run[0]) && (xstrcmp("VISUAL", env) == 0)) | |
+ if (!run || !run[0]) | |
run = editor ? editor : xgetenv("EDITOR", "vi"); | |
spawn(run, dents[cur].name, NULL, path, F_NORMAL); | |
break; | |
@@ -3413,7 +3411,6 @@ main(int argc, char *argv[]) | |
/* Edit text in EDITOR, if opted */ | |
if (getenv("NNN_USE_EDITOR")) { | |
- editor = xgetenv("VISUAL", NULL); | |
if (!editor) | |
editor = xgetenv("EDITOR", "vi"); | |
} | |
diff --git a/nnn.h b/nnn.h | |
index f021567..ee0c708 100644 | |
--- a/nnn.h | |
+++ b/nnn.h | |
@@ -177,7 +177,7 @@ static struct key bindings[] = { | |
/* Run a custom script */ | |
{ 'R', SEL_RUNSCRIPT, "sh", "SHELL" }, | |
/* Run command with argument */ | |
- { 'e', SEL_RUNARG, "", "VISUAL" }, | |
+ { 'e', SEL_RUNARG, "", "EDITOR" }, | |
{ 'p', SEL_RUNARG, "less", "PAGER" }, | |
#ifdef __linux__ | |
/* Lock screen */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/nnn.c b/nnn.c | |
index ed5bd67..6f56d12 100644 | |
--- a/nnn.c | |
+++ b/nnn.c | |
@@ -2019,8 +2019,6 @@ show_help(char *path) | |
dprintf(fd, "SHELL: %s\n", getenv("SHELL")); | |
if (getenv("SHLVL")) | |
dprintf(fd, "SHLVL: %s\n", getenv("SHLVL")); | |
- if (getenv("VISUAL")) | |
- dprintf(fd, "VISUAL: %s\n", getenv("VISUAL")); | |
else if (getenv("EDITOR")) | |
dprintf(fd, "EDITOR: %s\n", getenv("EDITOR")); | |
if (getenv("PAGER")) | |
@@ -3275,7 +3273,7 @@ nochange: | |
goto begin; | |
case SEL_RUNARG: | |
run = xgetenv(env, run); | |
- if ((!run || !run[0]) && (strcmp("VISUAL", env) == 0)) | |
+ if (!run || !run[0]) | |
run = editor ? editor : xgetenv("EDITOR", "vi"); | |
spawn(run, dents[cur].name, NULL, path, F_NORMAL); | |
break; | |
@@ -3437,7 +3435,6 @@ main(int argc, char *argv[]) | |
/* Edit text in EDITOR, if opted */ | |
if (getenv("NNN_USE_EDITOR")) { | |
- editor = xgetenv("VISUAL", NULL); | |
if (!editor) | |
editor = xgetenv("EDITOR", "vi"); | |
} | |
diff --git a/nnn.h b/nnn.h | |
index e68f7cb..5af7433 100644 | |
--- a/nnn.h | |
+++ b/nnn.h | |
@@ -178,7 +178,7 @@ static struct key bindings[] = { | |
/* Run a custom script */ | |
{ 'R', SEL_RUNSCRIPT, "sh", "SHELL" }, | |
/* Run command with argument */ | |
- { 'e', SEL_RUNARG, "", "VISUAL" }, | |
+ { 'e', SEL_RUNARG, "", "EDITOR" }, | |
{ 'p', SEL_RUNARG, "less", "PAGER" }, | |
#ifdef __linux__ | |
/* Lock screen */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment