mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
Add fortune to help
This commit is contained in:
parent
9fea0220c4
commit
54d2580799
|
@ -119,6 +119,7 @@ A curses library with wide char support (e.g. ncursesw), libreadline (optional)
|
||||||
| trash-cli | optional | trash files (default action: rm) |
|
| trash-cli | optional | trash files (default action: rm) |
|
||||||
| vlock (Linux), bashlock (macOS), lock(1) (BSD),<br>peaclock (Haiku) | optional | terminal locker (fallback: [cmatrix](https://github.com/abishekvashok/cmatrix)) |
|
| vlock (Linux), bashlock (macOS), lock(1) (BSD),<br>peaclock (Haiku) | optional | terminal locker (fallback: [cmatrix](https://github.com/abishekvashok/cmatrix)) |
|
||||||
| advcpmv (Linux) ([integration](https://github.com/jarun/nnn/wiki/Advanced-use-cases#show-cp-mv-progress)) | optional | copy, move progress |
|
| advcpmv (Linux) ([integration](https://github.com/jarun/nnn/wiki/Advanced-use-cases#show-cp-mv-progress)) | optional | copy, move progress |
|
||||||
|
| fortune | optional | random quotes in help screen |
|
||||||
| `$VISUAL` (else `$EDITOR`), `$PAGER`, `$SHELL` | optional | fallback vi, less, sh |
|
| `$VISUAL` (else `$EDITOR`), `$PAGER`, `$SHELL` | optional | fallback vi, less, sh |
|
||||||
|
|
||||||
#### From a package manager
|
#### From a package manager
|
||||||
|
|
|
@ -19,6 +19,7 @@ _nnn ()
|
||||||
-e
|
-e
|
||||||
-E
|
-E
|
||||||
-f
|
-f
|
||||||
|
-F
|
||||||
-g
|
-g
|
||||||
-H
|
-H
|
||||||
-K
|
-K
|
||||||
|
|
|
@ -18,6 +18,7 @@ complete -c nnn -s d -d 'start in detail mode'
|
||||||
complete -c nnn -s e -d 'open text files in $VISUAL/$EDITOR/vi'
|
complete -c nnn -s e -d 'open text files in $VISUAL/$EDITOR/vi'
|
||||||
complete -c nnn -s E -d 'use EDITOR for undetached edits'
|
complete -c nnn -s E -d 'use EDITOR for undetached edits'
|
||||||
complete -c nnn -s f -d 'use readline history file'
|
complete -c nnn -s f -d 'use readline history file'
|
||||||
|
complete -c nnn -s F -d 'show fortune'
|
||||||
complete -c nnn -s g -d 'regex filters'
|
complete -c nnn -s g -d 'regex filters'
|
||||||
complete -c nnn -s H -d 'show hidden files'
|
complete -c nnn -s H -d 'show hidden files'
|
||||||
complete -c nnn -s K -d 'detect key collision'
|
complete -c nnn -s K -d 'detect key collision'
|
||||||
|
|
|
@ -16,6 +16,7 @@ args=(
|
||||||
'(-e)-e[open text files in $VISUAL/$EDITOR/vi]'
|
'(-e)-e[open text files in $VISUAL/$EDITOR/vi]'
|
||||||
'(-E)-E[use EDITOR for undetached edits]'
|
'(-E)-E[use EDITOR for undetached edits]'
|
||||||
'(-f)-f[use readline history file]'
|
'(-f)-f[use readline history file]'
|
||||||
|
'(-F)-F[show fortune]'
|
||||||
'(-g)-g[regex filters]'
|
'(-g)-g[regex filters]'
|
||||||
'(-H)-H[show hidden files]'
|
'(-H)-H[show hidden files]'
|
||||||
'(-K)-K[detect key collision]'
|
'(-K)-K[detect key collision]'
|
||||||
|
|
7
nnn.1
7
nnn.1
|
@ -13,6 +13,7 @@
|
||||||
.Op Ar -e
|
.Op Ar -e
|
||||||
.Op Ar -E
|
.Op Ar -E
|
||||||
.Op Ar -f
|
.Op Ar -f
|
||||||
|
.Op Ar -F
|
||||||
.Op Ar -g
|
.Op Ar -g
|
||||||
.Op Ar -H
|
.Op Ar -H
|
||||||
.Op Ar -K
|
.Op Ar -K
|
||||||
|
@ -73,6 +74,9 @@ 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
|
||||||
|
@ -350,7 +354,8 @@ separated by \fI;\fR:
|
||||||
Key:Command | Description
|
Key:Command | Description
|
||||||
----------------------------------- + -------------------------------------------------
|
----------------------------------- + -------------------------------------------------
|
||||||
k:-_fuser -kiv $nnn* | Interactively kill process(es) using hovered file
|
k:-_fuser -kiv $nnn* | Interactively kill process(es) using hovered file
|
||||||
l:_git log | Show git log
|
g:-_git diff* | Show git diff
|
||||||
|
l:-_git log* | Show git log
|
||||||
n:-_vi /home/user/Dropbox/dir/note* | Take quick notes in a synced file/dir of notes
|
n:-_vi /home/user/Dropbox/dir/note* | Take quick notes in a synced file/dir of notes
|
||||||
p:-_less -iR $nnn* | Page through hovered file in less
|
p:-_less -iR $nnn* | Page through hovered file in less
|
||||||
s:-_|smplayer -minigui $nnn | Play hovered media file, even unfinished download
|
s:-_|smplayer -minigui $nnn | Play hovered media file, even unfinished download
|
||||||
|
|
|
@ -133,7 +133,8 @@ Notes:
|
||||||
| Key:Command | Description |
|
| Key:Command | Description |
|
||||||
|---|---|
|
|---|---|
|
||||||
| `k:-_fuser -kiv $nnn*` | Interactively kill process(es) using hovered file |
|
| `k:-_fuser -kiv $nnn*` | Interactively kill process(es) using hovered file |
|
||||||
| `l:_git log` | Show git log |
|
| `g:-_git diff*` | Show git diff |
|
||||||
|
| `l:-_git log*` | Show git log |
|
||||||
| `n:-_vi /home/user/Dropbox/dir/note*` | Take quick notes in a synced file/dir of notes |
|
| `n:-_vi /home/user/Dropbox/dir/note*` | Take quick notes in a synced file/dir of notes |
|
||||||
| `p:-_less -iR $nnn*` | Page through hovered file in less |
|
| `p:-_less -iR $nnn*` | Page through hovered file in less |
|
||||||
| `s:-_\|smplayer -minigui $nnn` | Play hovered media file, even unfinished download |
|
| `s:-_\|smplayer -minigui $nnn` | Play hovered media file, even unfinished download |
|
||||||
|
|
12
src/nnn.c
12
src/nnn.c
|
@ -399,8 +399,9 @@ static char g_pipepath[TMP_LEN_MAX] __attribute__ ((aligned));
|
||||||
#define STATE_MSG 0x20
|
#define STATE_MSG 0x20
|
||||||
#define STATE_TRASH 0x40
|
#define STATE_TRASH 0x40
|
||||||
#define STATE_FORCEQUIT 0x80
|
#define STATE_FORCEQUIT 0x80
|
||||||
|
#define STATE_FORTUNE 0x100
|
||||||
|
|
||||||
static uchar g_states;
|
static uint g_states;
|
||||||
|
|
||||||
/* Options to identify file mime */
|
/* Options to identify file mime */
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
|
@ -4131,6 +4132,9 @@ static void show_help(const char *path)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((g_states & STATE_FORTUNE) && getutil("fortune"))
|
||||||
|
pipetof("fortune -s", fp);
|
||||||
|
|
||||||
start = end = helpstr;
|
start = end = helpstr;
|
||||||
while (*end) {
|
while (*end) {
|
||||||
if (*end == '\n') {
|
if (*end == '\n') {
|
||||||
|
@ -6575,6 +6579,7 @@ 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 [default: string]\n"
|
" -g regex filters [default: string]\n"
|
||||||
" -H show hidden files\n"
|
" -H show hidden files\n"
|
||||||
" -K detect key collision\n"
|
" -K detect key collision\n"
|
||||||
|
@ -6739,7 +6744,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, "Ab:cdeEfgHKnop:QrRs:St:T:Vxh"))) != -1) {
|
: getopt(argc, argv, "Ab:cdeEfFgHKnop:QrRs:St:T:Vxh"))) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'A':
|
case 'A':
|
||||||
cfg.autoselect = 0;
|
cfg.autoselect = 0;
|
||||||
|
@ -6769,6 +6774,9 @@ int main(int argc, char *argv[])
|
||||||
rlhist = TRUE;
|
rlhist = TRUE;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
case 'F':
|
||||||
|
g_states |= STATE_FORTUNE;
|
||||||
|
break;
|
||||||
case 'g':
|
case 'g':
|
||||||
cfg.regex = 1;
|
cfg.regex = 1;
|
||||||
filterfn = &visible_re;
|
filterfn = &visible_re;
|
||||||
|
|
Loading…
Reference in a new issue