mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
Config NNN_HELP to show output of a program on top of help page
This commit is contained in:
parent
8c116eea2c
commit
06c5b17c02
11
nnn.1
11
nnn.1
|
@ -6,7 +6,7 @@
|
||||||
.Nd The unorthodox terminal file manager.
|
.Nd The unorthodox terminal file manager.
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm
|
.Nm
|
||||||
.Op Ar -aAcCdDeEfFgHJKlnQrRSuUVwxh
|
.Op Ar -aAcCdDeEfgHJKlnQrRSuUVwxh
|
||||||
.Op Ar -b key
|
.Op Ar -b key
|
||||||
.Op Ar -p file
|
.Op Ar -p file
|
||||||
.Op Ar -P key
|
.Op Ar -P key
|
||||||
|
@ -72,9 +72,6 @@ supports the following options:
|
||||||
.Fl f
|
.Fl f
|
||||||
use readline history file
|
use readline history file
|
||||||
.Pp
|
.Pp
|
||||||
.Fl F
|
|
||||||
show fortune in help and settings screen
|
|
||||||
.Pp
|
|
||||||
.Fl g
|
.Fl g
|
||||||
use regex filters instead of substring match
|
use regex filters instead of substring match
|
||||||
.Pp
|
.Pp
|
||||||
|
@ -526,6 +523,12 @@ separated by \fI;\fR:
|
||||||
export NNN_LOCKER='cmatrix'
|
export NNN_LOCKER='cmatrix'
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.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.
|
\fBNNN_MCLICK:\fR key emulated by a middle mouse click.
|
||||||
.Bd -literal
|
.Bd -literal
|
||||||
export NNN_MCLICK='^R'
|
export NNN_MCLICK='^R'
|
||||||
|
|
25
src/nnn.c
25
src/nnn.c
|
@ -324,7 +324,6 @@ typedef struct {
|
||||||
uint_t rangesel : 1; /* Range selection on */
|
uint_t rangesel : 1; /* Range selection on */
|
||||||
uint_t move : 1; /* Move operation */
|
uint_t move : 1; /* Move operation */
|
||||||
uint_t autonext : 1; /* Auto-proceed on open */
|
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 trash : 2; /* Use trash to delete files 1: trash-cli, 2: gio trash */
|
||||||
uint_t forcequit : 1; /* Do not prompt on quit */
|
uint_t forcequit : 1; /* Do not prompt on quit */
|
||||||
uint_t autofifo : 1; /* Auto-create NNN_FIFO */
|
uint_t autofifo : 1; /* Auto-create NNN_FIFO */
|
||||||
|
@ -341,7 +340,7 @@ typedef struct {
|
||||||
uint_t uidgid : 1; /* Show owner and group info */
|
uint_t uidgid : 1; /* Show owner and group info */
|
||||||
uint_t prstssn : 1; /* Persistent session */
|
uint_t prstssn : 1; /* Persistent session */
|
||||||
uint_t duinit : 1; /* Initialize disk usage */
|
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;
|
} runstate;
|
||||||
|
|
||||||
/* Contexts or workspaces */
|
/* Contexts or workspaces */
|
||||||
|
@ -651,8 +650,9 @@ static const char * const messages[] = {
|
||||||
#define NNN_PIPE 6
|
#define NNN_PIPE 6
|
||||||
#define NNN_MCLICK 7
|
#define NNN_MCLICK 7
|
||||||
#define NNN_SEL 8
|
#define NNN_SEL 8
|
||||||
#define NNN_ARCHIVE 9 /* strings end here */
|
#define NNN_ARCHIVE 9
|
||||||
#define NNN_TRASH 10 /* flags begin here */
|
#define NNN_HELP 10 /* strings end here */
|
||||||
|
#define NNN_TRASH 11 /* flags begin here */
|
||||||
|
|
||||||
static const char * const env_cfg[] = {
|
static const char * const env_cfg[] = {
|
||||||
"NNN_OPTS",
|
"NNN_OPTS",
|
||||||
|
@ -665,6 +665,7 @@ static const char * const env_cfg[] = {
|
||||||
"NNN_MCLICK",
|
"NNN_MCLICK",
|
||||||
"NNN_SEL",
|
"NNN_SEL",
|
||||||
"NNN_ARCHIVE",
|
"NNN_ARCHIVE",
|
||||||
|
"NNN_HELP",
|
||||||
"NNN_TRASH",
|
"NNN_TRASH",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4636,12 +4637,10 @@ static void show_help(const char *path)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_state.fortune && getutil("fortune"))
|
|
||||||
#ifndef __HAIKU__
|
char *prog = xgetenv(env_cfg[NNN_HELP], NULL);
|
||||||
get_output("fortune", "-s", NULL, fp, FALSE, FALSE);
|
if (prog)
|
||||||
#else
|
get_output(prog, NULL, NULL, fp, TRUE, FALSE);
|
||||||
get_output("fortune", NULL, NULL, fp, FALSE, FALSE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
start = end = helpstr;
|
start = end = helpstr;
|
||||||
while (*end) {
|
while (*end) {
|
||||||
|
@ -7594,7 +7593,6 @@ static void usage(void)
|
||||||
#ifndef NORL
|
#ifndef NORL
|
||||||
" -f use readline history file\n"
|
" -f use readline history file\n"
|
||||||
#endif
|
#endif
|
||||||
" -F show fortune\n"
|
|
||||||
" -g regex filters\n"
|
" -g regex filters\n"
|
||||||
" -H show hidden files\n"
|
" -H show hidden files\n"
|
||||||
" -J no auto-proceed on select\n"
|
" -J no auto-proceed on select\n"
|
||||||
|
@ -7778,7 +7776,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
while ((opt = (env_opts_id > 0
|
while ((opt = (env_opts_id > 0
|
||||||
? env_opts[--env_opts_id]
|
? 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) {
|
switch (opt) {
|
||||||
#ifndef NOFIFO
|
#ifndef NOFIFO
|
||||||
case 'a':
|
case 'a':
|
||||||
|
@ -7815,9 +7813,6 @@ int main(int argc, char *argv[])
|
||||||
rlhist = TRUE;
|
rlhist = TRUE;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 'F':
|
|
||||||
g_state.fortune = 1;
|
|
||||||
break;
|
|
||||||
case 'g':
|
case 'g':
|
||||||
cfg.regex = 1;
|
cfg.regex = 1;
|
||||||
filterfn = &visible_re;
|
filterfn = &visible_re;
|
||||||
|
|
Loading…
Reference in a new issue