aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nnn.c33
-rw-r--r--src/nnn.h5
2 files changed, 11 insertions, 27 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 96cdefe..c9f6f51 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -501,7 +501,7 @@ static const char * const messages[] = {
"\nPress Enter to continue",
"open failed",
"dir inaccessible",
- "empty: edit or open with",
+ "empty: use open with",
"unsupported file",
"not set",
"dir changed, range sel off",
@@ -3620,7 +3620,6 @@ static void show_help(const char *path)
"cD File details%-12cd Detail view toggle\n"
"b^R Rename/dup%-14cr Batch rename\n"
"cz Archive entry%-11c* Toggle exe\n"
- "ce Edit in EDITOR%-10cp Open in PAGER\n"
"5Space ^J (Un)select%-11cm ^K Mark range/clear\n"
"cP Copy sel here%-11ca Select all\n"
"cV Move sel here%-10c^V Copy/move sel as\n"
@@ -4745,25 +4744,25 @@ nochange:
}
}
- if (!sb.st_size) {
- printwait(messages[MSG_EMPTY_FILE], &presel);
- goto nochange;
- }
-
/* If NNN_USE_EDITOR is set, open text in EDITOR */
- if (cfg.useeditor &&
+ if (cfg.useeditor && (!sb.st_size ||
#ifdef FILE_MIME_OPTS
- get_output(g_buf, CMD_LEN_MAX, "file", FILE_MIME_OPTS, newpath, FALSE)
- && !strncmp(g_buf, "text/", 5)) {
+ (get_output(g_buf, CMD_LEN_MAX, "file", FILE_MIME_OPTS, newpath, FALSE)
+ && !strncmp(g_buf, "text/", 5)))) {
#else
/* no mime option; guess from description instead */
- get_output(g_buf, CMD_LEN_MAX, "file", "-b", newpath, FALSE)
- && strstr(g_buf, "text")) {
+ (get_output(g_buf, CMD_LEN_MAX, "file", "-b", newpath, FALSE)
+ && strstr(g_buf, "text")))) {
#endif
spawn(editor, newpath, NULL, path, F_CLI);
continue;
}
+ if (!sb.st_size) {
+ printwait(messages[MSG_EMPTY_FILE], &presel);
+ goto nochange;
+ }
+
if (!regexec(&archive_re, dents[cur].name, 0, NULL, 0)) {
r = get_input(messages[MSG_ARCHIVE_OPTS]);
if (r == 'l' || r == 'x') {
@@ -5086,16 +5085,12 @@ nochange:
case SEL_REDRAW: // fallthrough
case SEL_RENAMEMUL: // fallthrough
case SEL_HELP: // fallthrough
- case SEL_RUNEDIT: // fallthrough
- case SEL_RUNPAGE: // fallthrough
case SEL_LOCK:
{
bool refresh = FALSE;
if (ndents)
mkpath(path, dents[cur].name, newpath);
- else if (sel == SEL_RUNEDIT || sel == SEL_RUNPAGE)
- break;
switch (sel) {
case SEL_REDRAW:
@@ -5115,12 +5110,6 @@ nochange:
if (cfg.filtermode)
presel = FILTER;
continue;
- case SEL_RUNEDIT:
- spawn(editor, dents[cur].name, NULL, path, F_CLI);
- continue;
- case SEL_RUNPAGE:
- spawn(pager, dents[cur].name, NULL, path, F_CLI);
- continue;
default: /* SEL_LOCK */
lock_terminal();
break;
diff --git a/src/nnn.h b/src/nnn.h
index d39f824..efa426b 100644
--- a/src/nnn.h
+++ b/src/nnn.h
@@ -89,8 +89,6 @@ enum action {
SEL_SHELL,
SEL_LAUNCH,
SEL_RUNCMD,
- SEL_RUNEDIT,
- SEL_RUNPAGE,
SEL_LOCK,
SEL_SESSIONS,
SEL_QUITCTX,
@@ -224,9 +222,6 @@ static struct key bindings[] = {
{ '=', SEL_LAUNCH },
/* Run a command */
{ ']', SEL_RUNCMD },
- /* Open in EDITOR or PAGER */
- { 'e', SEL_RUNEDIT },
- { 'p', SEL_RUNPAGE },
/* Lock screen */
{ 'L', SEL_LOCK },
/* Quit a context */