mirror of
https://github.com/jarun/nnn.git
synced 2025-03-18 20:39:45 +00:00
Simplify getting editor env var
This commit is contained in:
parent
052cd282f4
commit
32ca8ca133
1 changed files with 8 additions and 14 deletions
22
src/nnn.c
22
src/nnn.c
|
@ -3577,20 +3577,14 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
/* Edit text in EDITOR, if opted */
|
/* Edit text in EDITOR, if opted */
|
||||||
if (getenv("NNN_USE_EDITOR")) {
|
if (getenv("NNN_USE_EDITOR")) {
|
||||||
editor = xgetenv("VISUAL", NULL);
|
editor = xgetenv("VISUAL", xgetenv("EDITOR", "vi"));
|
||||||
if (!editor)
|
/* copier used as a temp var */
|
||||||
editor = xgetenv("EDITOR", "vi");
|
copier = editor;
|
||||||
if (editor) {
|
while (*copier && *copier != ' ')
|
||||||
/* copier used as a temp var */
|
++copier;
|
||||||
copier = editor;
|
if (*copier == ' ') {
|
||||||
while (*copier) {
|
*copier = '\0';
|
||||||
if (*copier == ' ') {
|
editor_arg = ++copier;
|
||||||
*copier = '\0';
|
|
||||||
editor_arg = ++copier;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
++copier;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue