mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +00:00
parent
e226e8c889
commit
9f68e74289
|
@ -168,6 +168,7 @@ positional args:
|
||||||
optional args:
|
optional args:
|
||||||
-a use access time
|
-a use access time
|
||||||
-b key open bookmark key
|
-b key open bookmark key
|
||||||
|
-c cli-only opener
|
||||||
-d detail mode
|
-d detail mode
|
||||||
-f run filter as cmd on prompt key
|
-f run filter as cmd on prompt key
|
||||||
-H show hidden files
|
-H show hidden files
|
||||||
|
|
3
nnn.1
3
nnn.1
|
@ -44,6 +44,9 @@ supports the following options:
|
||||||
.Fl "b key"
|
.Fl "b key"
|
||||||
specify bookmark key to open
|
specify bookmark key to open
|
||||||
.Pp
|
.Pp
|
||||||
|
.Fl c
|
||||||
|
opener opens files in cli utilities only
|
||||||
|
.Pp
|
||||||
.Fl d
|
.Fl d
|
||||||
detail mode
|
detail mode
|
||||||
.Pp
|
.Pp
|
||||||
|
|
21
src/nnn.c
21
src/nnn.c
|
@ -212,7 +212,7 @@ typedef struct {
|
||||||
uint selmode : 1; /* Set when selecting files */
|
uint selmode : 1; /* Set when selecting files */
|
||||||
uint showdetail : 1; /* Clear to show fewer file info */
|
uint showdetail : 1; /* Clear to show fewer file info */
|
||||||
uint ctxactive : 1; /* Context active or not */
|
uint ctxactive : 1; /* Context active or not */
|
||||||
uint reserved : 6;
|
uint reserved : 5;
|
||||||
/* The following settings are global */
|
/* The following settings are global */
|
||||||
uint curctx : 2; /* Current context number */
|
uint curctx : 2; /* Current context number */
|
||||||
uint dircolor : 1; /* Current status of dir color */
|
uint dircolor : 1; /* Current status of dir color */
|
||||||
|
@ -228,6 +228,7 @@ typedef struct {
|
||||||
uint filtercmd : 1; /* Run filter as command on no match */
|
uint filtercmd : 1; /* Run filter as command on no match */
|
||||||
uint trash : 1; /* Move removed files to trash */
|
uint trash : 1; /* Move removed files to trash */
|
||||||
uint mtime : 1; /* Use modification time (else access time) */
|
uint mtime : 1; /* Use modification time (else access time) */
|
||||||
|
uint cliopener : 1; /* All-CLI app opener */
|
||||||
} settings;
|
} settings;
|
||||||
|
|
||||||
/* Contexts or workspaces */
|
/* Contexts or workspaces */
|
||||||
|
@ -269,6 +270,7 @@ static settings cfg = {
|
||||||
0, /* filtercmd */
|
0, /* filtercmd */
|
||||||
0, /* trash */
|
0, /* trash */
|
||||||
1, /* mtime */
|
1, /* mtime */
|
||||||
|
0, /* cliopener */
|
||||||
};
|
};
|
||||||
|
|
||||||
static context g_ctx[CTX_MAX] __attribute__ ((aligned));
|
static context g_ctx[CTX_MAX] __attribute__ ((aligned));
|
||||||
|
@ -3356,20 +3358,17 @@ static void browse(char *ipath)
|
||||||
char mark[PATH_MAX] __attribute__ ((aligned));
|
char mark[PATH_MAX] __attribute__ ((aligned));
|
||||||
char rundir[PATH_MAX] __attribute__ ((aligned));
|
char rundir[PATH_MAX] __attribute__ ((aligned));
|
||||||
char runfile[NAME_MAX + 1] __attribute__ ((aligned));
|
char runfile[NAME_MAX + 1] __attribute__ ((aligned));
|
||||||
uchar opener_flags = F_NOTRACE | F_NOWAIT;
|
uchar opener_flags = (cfg.cliopener ? F_CLI : (F_NOTRACE | F_NOWAIT));
|
||||||
int r = -1, fd, presel, selstartid = 0, selendid = 0, onscreen;
|
int r = -1, fd, presel, selstartid = 0, selendid = 0, onscreen;
|
||||||
ino_t inode = 0;
|
ino_t inode = 0;
|
||||||
enum action sel;
|
enum action sel;
|
||||||
bool dir_changed = FALSE, rangesel = FALSE;
|
bool dir_changed = FALSE, rangesel = FALSE;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
char *path, *lastdir, *lastname, *dir, *tmp = getenv("XDG_SESSION_TYPE");
|
char *path, *lastdir, *lastname, *dir, *tmp;
|
||||||
MEVENT event;
|
MEVENT event;
|
||||||
|
|
||||||
atexit(dentfree);
|
atexit(dentfree);
|
||||||
|
|
||||||
if (tmp && !xstrcmp(tmp, "tty"))
|
|
||||||
opener_flags = F_CLI;
|
|
||||||
|
|
||||||
/* setup first context */
|
/* setup first context */
|
||||||
xstrlcpy(g_ctx[0].c_path, ipath, PATH_MAX); /* current directory */
|
xstrlcpy(g_ctx[0].c_path, ipath, PATH_MAX); /* current directory */
|
||||||
path = g_ctx[0].c_path;
|
path = g_ctx[0].c_path;
|
||||||
|
@ -4567,6 +4566,7 @@ static void usage(void)
|
||||||
"optional args:\n"
|
"optional args:\n"
|
||||||
" -a use access time\n"
|
" -a use access time\n"
|
||||||
" -b key open bookmark key\n"
|
" -b key open bookmark key\n"
|
||||||
|
" -c cli-only opener\n"
|
||||||
" -d detail mode\n"
|
" -d detail mode\n"
|
||||||
" -f run filter as cmd on prompt key\n"
|
" -f run filter as cmd on prompt key\n"
|
||||||
" -H show hidden files\n"
|
" -H show hidden files\n"
|
||||||
|
@ -4713,7 +4713,7 @@ int main(int argc, char *argv[])
|
||||||
bool progress = FALSE;
|
bool progress = FALSE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "HSiab:dfnop:rstvh")) != -1) {
|
while ((opt = getopt(argc, argv, "HSiab:cdfnop:rstvh")) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'S':
|
case 'S':
|
||||||
cfg.blkorder = 1;
|
cfg.blkorder = 1;
|
||||||
|
@ -4732,6 +4732,9 @@ int main(int argc, char *argv[])
|
||||||
case 'b':
|
case 'b':
|
||||||
arg = optarg;
|
arg = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'c':
|
||||||
|
cfg.cliopener = 1;
|
||||||
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
cfg.filtercmd = 1;
|
cfg.filtercmd = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -4879,8 +4882,8 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Edit text in EDITOR if opted */
|
/* Edit text in EDITOR if opted (and opener is not all-CLI) */
|
||||||
if (xgetenv_set(env_cfg[NNN_USE_EDITOR]))
|
if (!cfg.cliopener && xgetenv_set(env_cfg[NNN_USE_EDITOR]))
|
||||||
cfg.useeditor = 1;
|
cfg.useeditor = 1;
|
||||||
|
|
||||||
/* Get VISUAL/EDITOR */
|
/* Get VISUAL/EDITOR */
|
||||||
|
|
Loading…
Reference in a new issue