- To edit all text files in EDITOR (preferably CLI, fallback vi):
export NNN_USE_EDITOR=1
+ Note: Arguments to the editor should be combined together, e.g.,
+ export EDITOR='vim -xR'
#### Help
files.
.Bd -literal
export NNN_USE_EDITOR=1
+
+ NOTE: Arguments to the editor should be combined together, e.g.,
+
+ export EDITOR='vim -xR'
.Ed
.Pp
\fBNNN_IDLE_TIMEOUT:\fR set idle timeout (in seconds) to invoke terminal locker.
cat /path/to/.nnncp | xargs -0 | xsel -bi
-----------------------------------------
- Note: By default file paths are copied to the tmp file \fBDIR/.nnncp\fR, where 'DIR' (by priority) is: \fI$HOME\fR or, \fI$TMPDIR\fR or, \fI/tmp\fR.
+ NOTE: By default file paths are copied to the tmp file \fBDIR/.nnncp\fR, where 'DIR' (by priority) is: \fI$HOME\fR or, \fI$TMPDIR\fR or, \fI/tmp\fR.
.Ed
.Pp
\fBNNN_SCRIPT:\fR path to a custom script to invoke with currently selected file name as argument 1.
static uint idle;
static uint idletimeout, copybufpos, copybuflen;
static char *copier;
-static char *editor;
+static char *editor, *editor_arg;
static blkcnt_t ent_blocks;
static blkcnt_t dir_blocks;
static ulong num_files;
if (cfg.nonavopen && sel == SEL_NAV_IN)
continue;
- /* If NNN_USE_EDITOR is set,
- * open text in EDITOR
- */
+ /* If NNN_USE_EDITOR is set, open text in EDITOR */
if (editor) {
if (getmime(dents[cur].name)) {
- spawn(editor, newpath, NULL, path, F_NORMAL);
+ spawn(editor, editor_arg, newpath, path, F_NORMAL);
continue;
}
continue;
if (strstr(g_buf, "text/") == g_buf) {
- spawn(editor, newpath, NULL, path, F_NORMAL);
+ spawn(editor, editor_arg, newpath, path, F_NORMAL);
continue;
}
}
editor = xgetenv("VISUAL", NULL);
if (!editor)
editor = xgetenv("EDITOR", "vi");
+ if (editor) {
+ /* copier used as a temp var */
+ copier = editor;
+ while (*copier) {
+ if (*copier == ' ') {
+ *copier = '\0';
+ editor_arg = ++copier;
+ break;
+ }
+ ++copier;
+ }
+ }
}
/* Get locker wait time, if set; copier used as tmp var */