README.md | 12 +++++++++++- nnn.1 | 4 ++++ nnn.c | 13 +++++++++---- diff --git a/README.md b/README.md index 513dd09373e4f6a56407ab4e82c862afa96a6b8a..798f3a0da2bdc96218c2131f35ddeda5cd6d878a 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ - [add bookmarks](#add-bookmarks) - [use cd .....](#use-cd-) - [cd on quit](#cd-on-quit) - [copy file path to clipboard](#copy-file-path-to-clipboard) + - [change dir color](#change-dir-color) - [file copy, move, delete](#file-copy-move-delete) - [boost chdir prompt](#boost-chdir-prompt) - [set idle timeout](#set-idle-timeout) @@ -67,7 +68,7 @@ - Bookmarks - Jump HOME or to the last visited directory (as usual!) - Jump to initial dir, chdir prompt, cd ..... (with . as PWD) - Roll-over at edges, page through entries - - Show directories in blue (default: enabled) + - Show directories in custom color (default: enabled in blue) - Disk usage analyzer mode - Search - Filter directory contents with *search-as-you-type* @@ -140,6 +141,7 @@ positional arguments: PATH directory to open [default: current dir] optional arguments: + -c N specify dir color, disables if N>7 -e use exiftool instead of mediainfo -i start in navigate-as-you-type mode -l start in light mode (fewer details) @@ -285,6 +287,14 @@ export NNN_COPIER="/path/to/copier.sh" Start `nnn` and use ^K to copy the absolute path (from `/`) of the file under the cursor to clipboard. + +#### change dir color + +The default color for directories is blue. Option `-c` accepts color codes from 0 to 7 to use a different color: + +0-black, 1-red, 2-green, 3-yellow, 4-blue, 5-magenta, 6-cyan, 7-white + +Any other value disables colored directories. #### file copy, move, delete diff --git a/nnn.1 b/nnn.1 index d16e3f0c1b3500814ffb66462151722bab220f7a..c2f8f5c3a2eb3e8e3428ce687f7465094f601196 100644 --- a/nnn.1 +++ b/nnn.1 @@ -101,6 +101,10 @@ .Pp .Nm supports the following options: .Pp +.Fl "c N" + specify dir color (default blue), disables if N>7 + 0-black, 1-red, 2-green, 3-yellow, 4-blue, 5-magenta, 6-cyan, 7-white +.Pp .Fl e use exiftool instead of mediainfo .Pp diff --git a/nnn.c b/nnn.c index 876b711d7d63a5ab2a932c5f473e95871fb61fe6..eb6265c7686ad6fb2e809a70b2a8aeb5e2d2d833 100644 --- a/nnn.c +++ b/nnn.c @@ -178,6 +178,7 @@ static uint open_max; static bm bookmark[MAX_BM]; static const double div_2_pow_10 = 1.0 / 1024.0; static uint _WSHIFT = (sizeof(ulong) == 8) ? 3 : 2; +static uchar color = 4; /* Utilities to open files, run actions */ static char * const utils[] = { @@ -466,7 +467,8 @@ keypad(stdscr, TRUE); curs_set(FALSE); /* Hide cursor */ start_color(); use_default_colors(); - init_pair(1, COLOR_BLUE, -1); + if (cfg.showcolor) + init_pair(1, color, -1); timeout(1000); /* One second */ } @@ -2455,6 +2457,7 @@ The missing terminal file browser for X.\n\n\ positional arguments:\n\ PATH directory to open [default: current dir]\n\n\ optional arguments:\n\ + -c N specify dir color, disables if N>7\n\ -e use exiftool instead of mediainfo\n\ -i start in navigate-as-you-type mode\n\ -l start in light mode (fewer details)\n\ @@ -2482,7 +2485,7 @@ fprintf(stderr, "stdin or stdout is not a tty\n"); exit(1); } - while ((opt = getopt(argc, argv, "lSinep:vh")) != -1) { + while ((opt = getopt(argc, argv, "Slic:ep:vh")) != -1) { switch (opt) { case 'S': cfg.blkorder = 1; @@ -2494,8 +2497,10 @@ break; case 'i': cfg.filtermode = 1; break; - case 'n': - cfg.showcolor = 0; + case 'c': + color = (uchar)atoi(optarg); + if (color > 7) + cfg.showcolor = 0; break; case 'e': metaviewer = utils[3];