From ede3e0830efe1fad770e4788a7b8783fa74a58f9 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sun, 11 Nov 2018 16:22:58 +0530 Subject: [PATCH] Reformat program help --- README.md | 87 +++++++++++++-------------------- nnn.1 | 140 ++++++++++++++++++++++++++++++------------------------ src/nnn.c | 86 +++++++++++++-------------------- 3 files changed, 144 insertions(+), 169 deletions(-) diff --git a/README.md b/README.md index fe08169b..db67c26e 100644 --- a/README.md +++ b/README.md @@ -204,60 +204,39 @@ optional args: #### Keyboard shortcuts +Press ? in `nnn` to see the list anytime. + ``` - Key Desc - ---- - ↑, k, ^P Up - ↓, j, ^N Down - PgUp, ^U Scroll up - PgDn, ^D Scroll down - Home, g, ^, ^A First entry - End, G, $, ^E Last entry - →, ↵, l, ^M Open file/enter dir - ←, Bksp, h, ^H Parent dir - ^O Open with... - Insert, ^I Toggle nav-as-you-type - ~ Go HOME - & Start dir - - Last visited dir - / Filter entries - . Toggle show hidden - ^B Key prompt - b Pin current dir - ^V Go to pinned dir - d Toggle detail view - D File details - m, M Brief/full media info - n Create new - ^R Rename entry - r Open dir in vidir - s Toggle sort by size - S Toggle apparent size - ^J Toggle du mode - t Toggle sort by mtime - !, ^] Spawn SHELL in dir - R Run custom script - e Edit in EDITOR - p Open in PAGER - f Archive entry - F List archive - ^F Extract archive - Space, ^K Copy file path - ^Y Toggle selection mode - y Show copy buffer - P Copy selection - V Move selection - ^X Delete selection - X Delete entry - ^T Toggle path quote - ^L Redraw, clear prompt - Esc Exit prompt - L Lock terminal - o Launch GUI app - ? Help, settings - q Quit context - ^G Quit and cd - Q, ^Q Quit + NAVIGATION + ↑, k, ^P Up PgUp, ^U Scroll up + ↓, j, ^N Down PgDn, ^D Scroll down + Home, g, ^, ^A First entry ~ Go HOME + End, G, $, ^E Last entry & Start dir + ←, Bksp, h, ^H Parent dir - Last visited dir + →, ↵, l, ^M Open file/enter dir . Toggle show hidden + / Filter Ins, ^I Toggle nav-as-you-type + b Pin current dir ^V Go to pinned dir + ^B Key prompt ^L Redraw, clear prompt + Esc Exit prompt ^Bn Switch to context n + ^G Quit and cd q Quit context + Q, ^Q Quit ? Help, settings + FILES + ^O Open with... n Create new + D File details d Toggle detail view + ^R Rename entry r Open dir in vidir + ^Y Toggle selection y List selection + ⎵, ^K Copy entry path ^T Toggle path quote + P Copy selection ^X Delete selection + V Move selection X Delete entry + f Archive entry F List archive + ^F Extract archive m, M Brief/full media info + e Edit in EDITOR p Open in PAGER + ORDER + ^J Toggle du mode S Toggle apparent size + s Toggle sort by size t Toggle sort by mtime + MISC + o Launch GUI app !, ^] Spawn SHELL in dir + R Run custom script L Lock terminal ``` Help & settings, file details, media info and archive listing are shown in the PAGER. Please use the PAGER-specific keys in these screens. @@ -277,7 +256,7 @@ The key prompt, invoked by ^B, provides a powerful multi-functional n | & | Go to start directory | | q | Quit context | -If all the configured bookmark keys are single character, the prompt is not shown and Enter is not required; just press ^B followed by the key. +If all the configured bookmark keys are single character, the prompt is not shown and Enter is not required; just press ^B followed by the key (like the vim Leader key). #### Contexts diff --git a/nnn.1 b/nnn.1 index cacd07c0..e343c275 100644 --- a/nnn.1 +++ b/nnn.1 @@ -23,10 +23,13 @@ opens the current working directory by default if .Ar PATH is not specified. +.Sh KEYBINDS .Pp .Nm supports both vi-like and emacs-like key bindings as listed below. .Pp +NAVIGATION +.Pp .Bl -tag -width "l, [Right], [Return] or C-mXXXX" -offset indent -compact .It Ic [Up], k, ^P Move to previous entry @@ -40,72 +43,67 @@ Scroll down half a page Move to the first entry .It Ic [End], G, $, ^E Move to the last entry +.It Ic [Left], [Backspace], h, ^H +Go to parent directory .It Ic [Right], [Enter], l, ^M Open file or enter directory -.It Ic [Left], [Backspace], h, ^H -Back up one directory level -.It Ic ^O -Open with a custom application -.It Ic [Insert], ^I -Toggle navigate-as-you-type mode .It Ic ~ Change to the HOME directory .It Ic & Change to initial directory .It Ic \- Change to the last visited directory -.It Ic / -Change filter (more information below) .It Ic \&. Toggle show hidden . (dot) files -.It Ic ^B -Show key prompt (recognizes bookmark keys, ~, -, & and context IDs) +.It Ic / +Change filter (more information below) +.It Ic [Insert], ^I +Toggle navigate-as-you-type mode .It Ic b Pin current directory .It Ic ^V Visit pinned directory -.It Ic d -Toggle detail view -.It Ic D -Show current file details screen -.It Ic m -Show brief media info -.It Ic M -Show full media info +.It Ic ^B +Show key prompt (recognizes bookmark keys, ~, -, & and context IDs) +.It Ic ^L +Force a redraw, clear prompt +.It Ic Esc +Exit prompt +.It Ic ^Bn +Switch to context n +.It Ic q +Quit the current context +.It Ic ^G +Quit and change directory +.It Ic Q, ^Q +Quit +.It Ic \&? +Toggle help and settings screen +.El +.Pp +FILES +.Pp +.Bl -tag -width "l, [Right], [Return] or C-mXXXX" -offset indent -compact +.It Ic ^O +Open with an application .It Ic n Create a new file or directory +.It Ic D +Show entry details +.It Ic d +Toggle detail view .It Ic ^R Rename selected entry .It Ic r Open directory in vidir -.It Ic s -Toggle sort by file size -.It Ic S -Toggle sort by apparent size -.It Ic ^J -Toggle disk usage analyzer mode -.It Ic t -Toggle sort by time modified -.It Ic \&!, ^] -Spawn SHELL in PWD (fallback sh) -.It Ic R -Run a custom script -.It Ic e -Open current entry in EDITOR (fallback vi) -.It Ic p -Open current entry in PAGER (fallback less) -.It Ic f -Archive current entry -.It Ic F -List files in archive -.It Ic ^F -Extract archive in current directory -.It Ic Space, ^K -Invoke file path copier .It Ic ^Y Toggle selection mode +.It Ic Space, ^K +Copy entry absolute path .It Ic y -Show copy buffer +Show selection list +.It Ic ^T +Toggle path quote .It Ic P Copy files from selection .It Ic V @@ -113,26 +111,45 @@ Move files from selection .It Ic ^X Delete files from selection .It Ic X -Delete the current entry -, ^Q Quit -.It Ic ^T -Toggle path quote -.It Ic ^L -Force a redraw, clear prompt -.It Ic Esc -Exit prompt -.It Ic L -Lock terminal (Linux only) +Delete entry +.It Ic f +Archive entry +.It Ic F +List files in archive +.It Ic ^F +Extract archive in current directory +.It Ic m, M +Show brief/full media info +.It Ic e +Open entry in EDITOR (fallback vi) +.It Ic p +Open entry in PAGER (fallback less) +.El +.Pp +ORDER +.Pp +.Bl -tag -width "l, [Right], [Return] or C-mXXXX" -offset indent -compact +.It Ic ^J +Toggle disk usage analyzer mode +.It Ic S +Toggle sort by apparent size +.It Ic s +Toggle sort by file size +.It Ic t +Toggle sort by time modified +.El +.Pp +MISC +.Pp +.Bl -tag -width "l, [Right], [Return] or C-mXXXX" -offset indent -compact .It Ic o Launch a GUI application -.It Ic \&? -Toggle help and settings screen -.It Ic q -Quit the current context -.It Ic ^G -Quit and change directory -.It Ic Q, ^X -Quit +.It Ic \&!, ^] +Spawn SHELL in current directory (fallback sh) +.It Ic R +Run a custom script +.It Ic L +Lock terminal (Linux only) .El .Pp Backing up one directory level will set the cursor position at the @@ -140,6 +157,7 @@ directory you came out of. .Pp Help & settings, file details, media info and archive listing are shown in the PAGER. Please use the PAGER-specific keys in these screens. +.Sh OPTIONS .Pp .Nm supports the following options: diff --git a/src/nnn.c b/src/nnn.c index c148b826..852dfa87 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -1960,59 +1960,37 @@ static int show_help(char *path) int i = 0, fd = mkstemp(g_tmpfpath); char *start, *end; static char helpstr[] = { - "cKey Desc\n" - "e----\n" - "7↑, k, ^P Up\n" - "7↓, j, ^N Down\n" - "7PgUp, ^U Scroll up\n" - "7PgDn, ^D Scroll down\n" -"1Home, g, ^, ^A First entry\n" - "2End, G, $, ^E Last entry\n" - "4→, ↵, l, ^M Open file/enter dir\n" -"1←, Bksp, h, ^H Parent dir\n" - "d^O Open with...\n" - "5Insert, ^I Toggle nav-as-you-type\n" - "e~ Go HOME\n" - "e& Start dir\n" - "e- Last visited dir\n" - "e/ Filter entries\n" - "e. Toggle show hidden\n" - "d^B Key prompt\n" - "eb Pin current dir\n" - "d^V Go to pinned dir\n" - "ed Toggle detail view\n" - "eD File details\n" - "bm, M Brief/full media info\n" - "en Create new\n" - "d^R Rename entry\n" - "er Open dir in vidir\n" - "es Toggle sort by size\n" - "eS Toggle apparent size\n" - "d^J Toggle du mode\n" - "et Toggle sort by mtime\n" - "a!, ^] Spawn SHELL in dir\n" - "eR Run custom script\n" - "ee Edit in EDITOR\n" - "ep Open in PAGER\n" - "ef Archive entry\n" - "eF List archive\n" - "d^F Extract archive\n" - "6Space, ^K Copy file path\n" - "d^Y Toggle selection mode\n" - "ey Show copy buffer\n" - "eP Copy selection\n" - "eV Move selection\n" - "d^X Delete selection\n" - "eX Delete entry\n" - "d^T Toggle path quote\n" - "d^L Redraw, clear prompt\n" - "cEsc Exit prompt\n" - "eL Lock terminal\n" - "eo Launch GUI app\n" - "e? Help, settings\n" - "eq Quit context\n" - "d^G Quit and cd\n" - "aQ, ^Q Quit\n\n"}; +"0\n" +"1NAVIGATION\n" + "7↑, k, ^P Up PgUp, ^U Scroll up\n" + "7↓, j, ^N Down PgDn, ^D Scroll down\n" +"1Home, g, ^, ^A First entry ~ Go HOME\n" + "2End, G, $, ^E Last entry & Start dir\n" +"1←, Bksp, h, ^H Parent dir - Last visited dir\n" + "4→, ↵, l, ^M Open file/enter dir . Toggle show hidden\n" + "e/ Filter Ins, ^I Toggle nav-as-you-type\n" + "eb Pin current dir ^V Go to pinned dir\n" + "d^B Key prompt ^L Redraw, clear prompt\n" + "cEsc Exit prompt ^Bn Switch to context n\n" + "d^G Quit and cd q Quit context\n" + "aQ, ^Q Quit ? Help, settings\n" +"1FILES\n" + "d^O Open with... n Create new\n" + "eD File details d Toggle detail view\n" + "d^R Rename entry r Open dir in vidir\n" + "d^Y Toggle selection y List selection\n" + "a⎵, ^K Copy entry path ^T Toggle path quote\n" + "eP Copy selection ^X Delete selection\n" + "eV Move selection X Delete entry\n" + "ef Archive entry F List archive\n" + "d^F Extract archive m, M Brief/full media info\n" + "ee Edit in EDITOR p Open in PAGER\n" +"1ORDER\n" + "d^J Toggle du mode S Toggle apparent size\n" + "es Toggle sort by size t Toggle sort by mtime\n" +"1MISC\n" + "eo Launch GUI app !, ^] Spawn SHELL in dir\n" + "eR Run custom script L Lock terminal\n"}; if (fd == -1) return -1; @@ -2031,7 +2009,7 @@ static int show_help(char *path) start = ++end; } - dprintf(fd, "\nVolume: %s of ", coolsize(get_fs_info(path, FREE))); + dprintf(fd, "\nVOLUME: %s of ", coolsize(get_fs_info(path, FREE))); dprintf(fd, "%s free\n\n", coolsize(get_fs_info(path, CAPACITY))); if (getenv("NNN_BMS")) {