Преглед изворни кода

Show current config along with help

master
Arun Prakash Jana пре 7 година
родитељ
комит
2a1f99526f
No known key found for this signature in database GPG Key ID: A75979F35C080412
3 измењених фајлова са 54 додато и 17 уклоњено
  1. +1
    -1
      README.md
  2. +10
    -7
      nnn.1
  3. +43
    -9
      nnn.c

+ 1
- 1
README.md Прегледај датотеку

@@ -182,7 +182,7 @@ Right, Enter, l, ^M | Open file or enter dir
p | Open entry in PAGER (fallback less)
^K | Invoke file path copier
^L | Force a redraw, exit filter prompt
? | Toggle help screen
? | Toggle help and settings screen
Q | Quit and change directory
q, ^Q | Quit
```


+ 10
- 7
nnn.1 Прегледај датотеку

@@ -88,7 +88,7 @@ Invoke file path copier
.It Ic ^L
Force a redraw, exit filter prompt
.It Ic \&?
Toggle help screen
Toggle help and settings screen
.It Ic Q
Quit and change directory
.It Ic q, ^Q
@@ -129,6 +129,9 @@ at:
.br
.Em https://github.com/jarun/nnn/wiki/all-about-nlay
.Pp
There is no configuration file. Settings work on environment variables. Please
refer to the ENVIRONMENT section below.
.Pp
Configuring
.Nm
to change to the last visited directory on quit requires shell integration in a
@@ -158,18 +161,18 @@ allowing continuous navigation. Works best with the \fBarrow keys\fR.
The SHELL, EDITOR and PAGER environment variables take precedence
when dealing with the !, e and p commands respectively.
.Pp
\fBNNN_USE_EDITOR:\fR use EDITOR (preferably CLI, fallback vi) to handle text
files.
.Bd -literal
export NNN_USE_EDITOR=1
.Ed
.Pp
\fBNNN_BMS:\fR bookmark string as \fIkey:location\fR pairs (max 10) separated by
\fI;\fR:
.Bd -literal
export NNN_BMS='doc:~/Documents;u:/home/user/Cam Uploads;D:~/Downloads/'
.Ed
.Pp
\fBNNN_USE_EDITOR:\fR use EDITOR (preferably CLI, fallback vi) to handle text
files.
.Bd -literal
export NNN_USE_EDITOR=1
.Ed
.Pp
\fBNNN_DE_FILE_MANAGER:\fR set to a desktop file manager to open the current
directory with. E.g.:
.Bd -literal


+ 43
- 9
nnn.c Прегледај датотеку

@@ -1311,7 +1311,12 @@ show_mediainfo(char* fpath, char *arg)
static int
show_help(void)
{
static char helpstr[] = ("echo \"\
char tmp[] = "/tmp/nnnXXXXXX";
int fd = mkstemp(tmp);
if (fd == -1)
return -1;

static char helpstr[] = ("\
Key | Function\n\
-+-\n\
Up, k, ^P | Previous entry\n\
@@ -1344,11 +1349,40 @@ show_help(void)
p | Open entry in PAGER (fallback less)\n\
^K | Invoke file path copier\n\
^L | Force a redraw, exit filter prompt\n\
? | Toggle help screen\n\
? | Toggle help and settings screen\n\
Q | Quit and change directory\n\
q, ^Q | Quit\n\n\" | less");
q, ^Q | Quit\n\n\n");

dprintf(fd, "%s", helpstr);

if (getenv("NNN_BMS")) {
dprintf(fd, "BOOKMARKS\n");
for (int i = 0; i < MAX_BM; i++)
if (bookmark[i].key)
dprintf(fd, " %s: %s\n", bookmark[i].key, bookmark[i].loc);
else
break;
dprintf(fd, "\n");
}

if (editor)
dprintf(fd, "NNN_USE_EDITOR: %s\n", editor);

if (desktop_manager)
dprintf(fd, "NNN_DE_FILE_MANAGER: %s\n", desktop_manager);

if (idletimeout)
dprintf(fd, "NNN_IDLE_TIMEOUT: %d secs\n", idletimeout);

if (copier)
dprintf(fd, "NNN_COPIER: %s\n", copier);

return system(helpstr);
dprintf(fd, "\n");
close(fd);

get_output(NULL, 0, "cat", tmp, NULL, 1);
unlink(tmp);
return 0;
}

static int
@@ -2285,6 +2319,11 @@ main(int argc, char *argv[])
showhidden = 1;
initfilter(showhidden, &ifilter);

/* Parse bookmarks string, if available */
char *bms = getenv("NNN_BMS");
if (bms)
parsebmstr(bms);

/* Edit text in EDITOR, if opted */
if (getenv("NNN_USE_EDITOR"))
editor = xgetenv("EDITOR", "vi");
@@ -2304,11 +2343,6 @@ main(int argc, char *argv[])
/* Get the default copier, if set */
copier = getenv("NNN_COPIER");

/* Parse bookmarks string, if available */
char *bms = getenv("NNN_BMS");
if (bms)
parsebmstr(bms);

signal(SIGINT, SIG_IGN);

/* Test initial path */


Loading…
Откажи
Сачувај