mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +00:00
Fix #179
This commit is contained in:
parent
a40cdadb82
commit
e87ff1129c
|
@ -372,9 +372,7 @@ To edit all text files in EDITOR (preferably CLI, fallback vi):
|
||||||
|
|
||||||
export NNN_USE_EDITOR=1
|
export NNN_USE_EDITOR=1
|
||||||
|
|
||||||
Arguments to the `$EDITOR`, `$PAGER` and `$SHELL` should be combined together, e.g.,
|
Arguments to the `$PAGER` and `$SHELL` should be combined together.
|
||||||
|
|
||||||
export EDITOR='vim -xR'
|
|
||||||
|
|
||||||
The option `open with` takes 1 combined argument.
|
The option `open with` takes 1 combined argument.
|
||||||
|
|
||||||
|
|
5
nnn.1
5
nnn.1
|
@ -264,10 +264,7 @@ be copied, moved or removed using respective keyboard shortcuts.
|
||||||
To list the file paths copied to memory press \fIy\fR.
|
To list the file paths copied to memory press \fIy\fR.
|
||||||
.Sh ENVIRONMENT
|
.Sh ENVIRONMENT
|
||||||
The SHELL, EDITOR (VISUAL, if defined) and PAGER environment variables take precedence
|
The SHELL, EDITOR (VISUAL, if defined) and PAGER environment variables take precedence
|
||||||
when dealing with the !, e and p commands respectively. A single combination to arguments is supported, e.g.:
|
when dealing with the !, e and p commands respectively. A single combination to arguments is supported for SHELL and PAGER.
|
||||||
.Bd -literal
|
|
||||||
export EDITOR='vim -xR'
|
|
||||||
.Ed
|
|
||||||
.Pp
|
.Pp
|
||||||
\fBNNN_BMS:\fR bookmark string as \fIkey_char:location\fR pairs (max 10) separated by
|
\fBNNN_BMS:\fR bookmark string as \fIkey_char:location\fR pairs (max 10) separated by
|
||||||
\fI;\fR:
|
\fI;\fR:
|
||||||
|
|
18
src/nnn.c
18
src/nnn.c
|
@ -293,7 +293,7 @@ static int ndents, cur, total_dents = ENTRY_INCR;
|
||||||
static uint idle;
|
static uint idle;
|
||||||
static uint idletimeout, copybufpos, copybuflen;
|
static uint idletimeout, copybufpos, copybuflen;
|
||||||
static char *copier;
|
static char *copier;
|
||||||
static char *editor, *editor_arg;
|
static char *editor;
|
||||||
static char *pager, *pager_arg;
|
static char *pager, *pager_arg;
|
||||||
static char *shell, *shell_arg;
|
static char *shell, *shell_arg;
|
||||||
static char *runpath;
|
static char *runpath;
|
||||||
|
@ -2125,9 +2125,9 @@ static bool show_help(char *path)
|
||||||
if (getenv("SHLVL"))
|
if (getenv("SHLVL"))
|
||||||
dprintf(fd, "SHLVL: %s\n", getenv("SHLVL"));
|
dprintf(fd, "SHLVL: %s\n", getenv("SHLVL"));
|
||||||
if (getenv("VISUAL"))
|
if (getenv("VISUAL"))
|
||||||
dprintf(fd, "VISUAL: %s %s\n", editor, editor_arg);
|
dprintf(fd, "VISUAL: %s\n", editor);
|
||||||
else if (getenv("EDITOR"))
|
else if (getenv("EDITOR"))
|
||||||
dprintf(fd, "EDITOR: %s %s\n", editor, editor_arg);
|
dprintf(fd, "EDITOR: %s\n", editor);
|
||||||
if (getenv("PAGER"))
|
if (getenv("PAGER"))
|
||||||
dprintf(fd, "PAGER: %s %s\n", pager, pager_arg);
|
dprintf(fd, "PAGER: %s %s\n", pager, pager_arg);
|
||||||
|
|
||||||
|
@ -2717,7 +2717,11 @@ nochange:
|
||||||
if (cfg.useeditor &&
|
if (cfg.useeditor &&
|
||||||
get_output(g_buf, CMD_LEN_MAX, "file", FILE_OPTS, newpath, FALSE) &&
|
get_output(g_buf, CMD_LEN_MAX, "file", FILE_OPTS, newpath, FALSE) &&
|
||||||
strstr(g_buf, "text/") == g_buf) {
|
strstr(g_buf, "text/") == g_buf) {
|
||||||
spawn(editor, editor_arg, newpath, path, F_NORMAL);
|
r = xstrlcpy(g_buf, editor, CMD_LEN_MAX);
|
||||||
|
g_buf[r - 1] = ' ';
|
||||||
|
xstrlcpy(g_buf + r, newpath, CMD_LEN_MAX - r);
|
||||||
|
DPRINTF_S(g_buf);
|
||||||
|
spawn("sh", "-c", g_buf, path, F_NORMAL);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3023,8 +3027,11 @@ nochange:
|
||||||
r = show_help(path);
|
r = show_help(path);
|
||||||
break;
|
break;
|
||||||
case SEL_RUNEDIT:
|
case SEL_RUNEDIT:
|
||||||
|
r = xstrlcpy(g_buf, editor, CMD_LEN_MAX);
|
||||||
|
g_buf[r - 1] = ' ';
|
||||||
|
xstrlcpy(g_buf + r, dents[cur].name, CMD_LEN_MAX - r);
|
||||||
r = TRUE;
|
r = TRUE;
|
||||||
spawn(editor, editor_arg, dents[cur].name, path, F_NORMAL);
|
spawn("sh", "-c", g_buf, path, F_NORMAL);
|
||||||
break;
|
break;
|
||||||
case SEL_RUNPAGE:
|
case SEL_RUNPAGE:
|
||||||
r = TRUE;
|
r = TRUE;
|
||||||
|
@ -3666,7 +3673,6 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
/* Get VISUAL/EDITOR */
|
/* Get VISUAL/EDITOR */
|
||||||
editor = xgetenv("VISUAL", xgetenv("EDITOR", "vi"));
|
editor = xgetenv("VISUAL", xgetenv("EDITOR", "vi"));
|
||||||
getprogarg(editor, &editor_arg);
|
|
||||||
|
|
||||||
/* Get PAGER */
|
/* Get PAGER */
|
||||||
pager = xgetenv("PAGER", "less");
|
pager = xgetenv("PAGER", "less");
|
||||||
|
|
Loading…
Reference in a new issue