Browse Source

Remove p and e

master
Arun Prakash Jana 5 years ago
parent
commit
5bc20f1460
No known key found for this signature in database GPG Key ID: A75979F35C080412
2 changed files with 11 additions and 27 deletions
  1. +11
    -22
      src/nnn.c
  2. +0
    -5
      src/nnn.h

+ 11
- 22
src/nnn.c View File

@@ -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;


+ 0
- 5
src/nnn.h View File

@@ -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 */


Loading…
Cancel
Save