Przeglądaj źródła

Resurrect NNN_OPENER

master
Arun Prakash Jana 6 lat temu
rodzic
commit
5f519841e7
Nie znaleziono w bazie danych klucza dla tego podpisu ID klucza GPG: A75979F35C080412
3 zmienionych plików z 18 dodań i 1 usunięć
  1. +4
    -0
      README.md
  2. +5
    -0
      nnn.1
  3. +9
    -1
      src/nnn.c

+ 4
- 0
README.md Wyświetl plik

@@ -372,6 +372,10 @@ The following indicators are used in the detail view:
| $PAGER | page through files (fallback less) | | $PAGER | page through files (fallback less) |
| $SHELL | spawn a shell, run script (fallback sh) | | $SHELL | spawn a shell, run script (fallback sh) |


To specify a custom file opener:

export NNN_OPENER=mimeopen

To edit all text files in EDITOR (preferably CLI, fallback vi): To edit all text files in EDITOR (preferably CLI, fallback vi):


export NNN_USE_EDITOR=1 export NNN_USE_EDITOR=1


+ 5
- 0
nnn.1 Wyświetl plik

@@ -260,6 +260,11 @@ To list the file paths copied to memory press \fIy\fR.
The SHELL, EDITOR (VISUAL, if defined) and PAGER environment variables take precedence The SHELL, EDITOR (VISUAL, if defined) and PAGER environment variables take precedence
when dealing with the !, e and p commands respectively. A single combination to arguments is supported for SHELL and PAGER. when dealing with the !, e and p commands respectively. A single combination to arguments is supported for SHELL and PAGER.
.Pp .Pp
\fBNNN_OPENER:\fR specify a custom file opener.
.Bd -literal
export NNN_OPENER=mimeopen
.Ed
.Pp
\fBNNN_BMS:\fR bookmark string as \fIkey_char:location\fR pairs (max 10) separated by \fBNNN_BMS:\fR bookmark string as \fIkey_char:location\fR pairs (max 10) separated by
\fI;\fR: \fI;\fR:
.Bd -literal .Bd -literal


+ 9
- 1
src/nnn.c Wyświetl plik

@@ -297,6 +297,7 @@ static char *pnamebuf, *pcopybuf;
static int ndents, cur, total_dents = ENTRY_INCR; static int ndents, cur, total_dents = ENTRY_INCR;
static uint idle; static uint idle;
static uint idletimeout, copybufpos, copybuflen; static uint idletimeout, copybufpos, copybuflen;
static char *opener;
static char *copier; static char *copier;
static char *editor; static char *editor;
static char *pager, *pager_arg; static char *pager, *pager_arg;
@@ -2157,6 +2158,8 @@ static bool show_help(char *path)
dprintf(fd, "\n"); dprintf(fd, "\n");
} }


if (getenv("NNN_OPENER"))
dprintf(fd, "NNN_OPENER: %s\n", opener);
if (cfg.useeditor) if (cfg.useeditor)
dprintf(fd, "NNN_USE_EDITOR: 1\n"); dprintf(fd, "NNN_USE_EDITOR: 1\n");
if (getenv("NNN_CONTEXT_COLORS")) if (getenv("NNN_CONTEXT_COLORS"))
@@ -2793,7 +2796,7 @@ nochange:
} }


/* Invoke desktop opener as last resort */ /* Invoke desktop opener as last resort */
spawn(utils[OPENER], newpath, NULL, NULL, F_NOWAIT | F_NOTRACE);
spawn(opener, newpath, NULL, NULL, F_NOWAIT | F_NOTRACE);
continue; continue;
} }
default: default:
@@ -3767,6 +3770,11 @@ int main(int argc, char *argv[])
} }
#endif #endif


/* Get custom opener, if set */
opener = getenv("NNN_OPENER");
if (!opener)
opener = utils[OPENER];

/* Get locker wait time, if set; copier used as tmp var */ /* Get locker wait time, if set; copier used as tmp var */
copier = getenv("NNN_IDLE_TIMEOUT"); copier = getenv("NNN_IDLE_TIMEOUT");
if (copier) { if (copier) {


Ładowanie…
Anuluj
Zapisz