mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +00:00
Custom color support for directories
This commit is contained in:
parent
a7d88ad7f9
commit
be8e4d8552
12
README.md
12
README.md
|
@ -36,6 +36,7 @@ Noice is Not Noice, a noicer fork...
|
|||
- [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 @@ Have fun with it! PRs are welcome. Check out [#1](https://github.com/jarun/nnn/i
|
|||
- 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 @@ Have fun with it! PRs are welcome. Check out [#1](https://github.com/jarun/nnn/i
|
|||
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)
|
||||
|
@ -286,6 +288,14 @@ export `NNN_COPIER`:
|
|||
|
||||
Start `nnn` and use <kbd>^K</kbd> 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
|
||||
|
||||
`nnn` doesn't support file copy, move, delete inherently. However, it simplifies the workflow:
|
||||
|
|
4
nnn.1
4
nnn.1
|
@ -101,6 +101,10 @@ directory you came out of.
|
|||
.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
|
||||
|
|
11
nnn.c
11
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 @@ initcurses(void)
|
|||
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 @@ main(int argc, char *argv[])
|
|||
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,7 +2497,9 @@ main(int argc, char *argv[])
|
|||
case 'i':
|
||||
cfg.filtermode = 1;
|
||||
break;
|
||||
case 'n':
|
||||
case 'c':
|
||||
color = (uchar)atoi(optarg);
|
||||
if (color > 7)
|
||||
cfg.showcolor = 0;
|
||||
break;
|
||||
case 'e':
|
||||
|
|
Loading…
Reference in a new issue