nnn.1 | 11 +++++++---- src/nnn.c | 25 ++++++++++--------------- diff --git a/nnn.1 b/nnn.1 index d90164967f0f6c8d43534a1d9270d3fec0cc1d61..78968a5aaab9db0ce58cf69088fa2e7b3939acc4 100644 --- a/nnn.1 +++ b/nnn.1 @@ -6,7 +6,7 @@ .Nm nnn .Nd The unorthodox terminal file manager. .Sh SYNOPSIS .Nm -.Op Ar -aAcCdDeEfFgHJKlnQrRSuUVwxh +.Op Ar -aAcCdDeEfgHJKlnQrRSuUVwxh .Op Ar -b key .Op Ar -p file .Op Ar -P key @@ -71,9 +71,6 @@ use $EDITOR for internal undetached edits .Pp .Fl f use readline history file -.Pp -.Fl F - show fortune in help and settings screen .Pp .Fl g use regex filters instead of substring match @@ -524,6 +521,12 @@ \fBNNN_LOCKER:\fR terminal locker program. .Bd -literal export NNN_LOCKER='bmon -p wlp1s0' export NNN_LOCKER='cmatrix' +.Ed +.Pp +\fBNNN_HELP:\fR run a program and show the output on top of the program help page. +.Bd -literal + export NNN_HELP='fortune' + export NNN_HELP='pwy paris' .Ed .Pp \fBNNN_MCLICK:\fR key emulated by a middle mouse click. diff --git a/src/nnn.c b/src/nnn.c index d6ff427bc11862e28d0833d6fc03c93aac0ced2c..fde166cf7c8612a418e9896d2fe1b89d2e58d714 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -324,7 +324,6 @@ uint_t interrupt : 1; /* Program received an interrupt */ uint_t rangesel : 1; /* Range selection on */ uint_t move : 1; /* Move operation */ uint_t autonext : 1; /* Auto-proceed on open */ - uint_t fortune : 1; /* Show fortune messages in help */ uint_t trash : 2; /* Use trash to delete files 1: trash-cli, 2: gio trash */ uint_t forcequit : 1; /* Do not prompt on quit */ uint_t autofifo : 1; /* Auto-create NNN_FIFO */ @@ -341,7 +340,7 @@ uint_t dirctx : 1; /* Show dirs in context color */ uint_t uidgid : 1; /* Show owner and group info */ uint_t prstssn : 1; /* Persistent session */ uint_t duinit : 1; /* Initialize disk usage */ - uint_t reserved : 7; /* Adjust when adding/removing a field */ + uint_t reserved : 8; /* Adjust when adding/removing a field */ } runstate; /* Contexts or workspaces */ @@ -651,8 +650,9 @@ #define NNNLVL 5 #define NNN_PIPE 6 #define NNN_MCLICK 7 #define NNN_SEL 8 -#define NNN_ARCHIVE 9 /* strings end here */ -#define NNN_TRASH 10 /* flags begin here */ +#define NNN_ARCHIVE 9 +#define NNN_HELP 10 /* strings end here */ +#define NNN_TRASH 11 /* flags begin here */ static const char * const env_cfg[] = { "NNN_OPTS", @@ -665,6 +665,7 @@ "NNN_PIPE", "NNN_MCLICK", "NNN_SEL", "NNN_ARCHIVE", + "NNN_HELP", "NNN_TRASH", }; @@ -4636,12 +4637,10 @@ close(fd); return; } - if (g_state.fortune && getutil("fortune")) -#ifndef __HAIKU__ - get_output("fortune", "-s", NULL, fp, FALSE, FALSE); -#else - get_output("fortune", NULL, NULL, fp, FALSE, FALSE); -#endif + + char *prog = xgetenv(env_cfg[NNN_HELP], NULL); + if (prog) + get_output(prog, NULL, NULL, fp, TRUE, FALSE); start = end = helpstr; while (*end) { @@ -7594,7 +7593,6 @@ " -E internal edits in EDITOR\n" #ifndef NORL " -f use readline history file\n" #endif - " -F show fortune\n" " -g regex filters\n" " -H show hidden files\n" " -J no auto-proceed on select\n" @@ -7778,7 +7776,7 @@ #endif while ((opt = (env_opts_id > 0 ? env_opts[--env_opts_id] - : getopt(argc, argv, "aAb:cCdDeEfFgHJKl:nop:P:QrRs:St:T:uUVwxh"))) != -1) { + : getopt(argc, argv, "aAb:cCdDeEfgHJKl:nop:P:QrRs:St:T:uUVwxh"))) != -1) { switch (opt) { #ifndef NOFIFO case 'a': @@ -7814,9 +7812,6 @@ case 'f': #ifndef NORL rlhist = TRUE; #endif - break; - case 'F': - g_state.fortune = 1; break; case 'g': cfg.regex = 1;