aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar FriendlyNeighborhoodShane <39659394+FriendlyNeighborhoodShane@users.noreply.github.com>2020-08-30 05:25:08 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2020-08-30 05:32:40 +0530
commita8afbf89d56951bafc9038a1db09c74d260dbe6b (patch)
tree6637fc82f66a27cb300806ce50e7d787cafc29a5
parent279f36f628fbdd8f5a3f2e57516de31648e056bb (diff)
downloadnnn-a8afbf89d56951bafc9038a1db09c74d260dbe6b.tar.gz
Add option to not move to next entry on select (#713)
-rw-r--r--nnn.14
-rw-r--r--src/nnn.c9
2 files changed, 11 insertions, 2 deletions
diff --git a/nnn.1 b/nnn.1
index 069faee..9b29db9 100644
--- a/nnn.1
+++ b/nnn.1
@@ -18,6 +18,7 @@
.Op Ar -F
.Op Ar -g
.Op Ar -H
+.Op Ar -J
.Op Ar -K
.Op Ar -l
.Op Ar -n
@@ -95,6 +96,9 @@ supports the following options:
.Fl H
show hidden files
.Pp
+.Fl J
+ disable auto-proceed on select
+.Pp
.Fl K
test for keybind collision
.Pp
diff --git a/src/nnn.c b/src/nnn.c
index 800b88c..0791f1e 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -314,6 +314,7 @@ typedef struct {
uint selmode : 1; /* Set when selecting files */
uint oldcolor : 1; /* Show dirs in context colors */
uint reserved : 14;
+ uint stayonsel : 1; /* Disable auto-proceed on select */
} runstate;
/* Contexts or workspaces */
@@ -6461,7 +6462,7 @@ nochange:
else
#endif
/* move cursor to the next entry if this is not the last entry */
- if (!g_state.picker && cur != ndents - 1)
+ if (!g_state.stayonsel && !g_state.picker && cur != ndents - 1)
move_cursor((cur + 1) % ndents, 0);
break;
case SEL_SELMUL:
@@ -7256,6 +7257,7 @@ static void usage(void)
" -F show fortune\n"
" -g regex filters [default: string]\n"
" -H show hidden files\n"
+ " -J no auto-proceed on select\n"
" -K detect key collision\n"
" -l val set scroll lines\n"
" -n type-to-nav mode\n"
@@ -7417,7 +7419,7 @@ int main(int argc, char *argv[])
while ((opt = (env_opts_id > 0
? env_opts[--env_opts_id]
- : getopt(argc, argv, "aAb:cCdeEfFgHKl:nop:P:QrRs:St:T:uVwxh"))) != -1) {
+ : getopt(argc, argv, "aAb:cCdeEfFgHJKl:nop:P:QrRs:St:T:uVwxh"))) != -1) {
switch (opt) {
#ifndef NOFIFO
case 'a':
@@ -7462,6 +7464,9 @@ int main(int argc, char *argv[])
case 'H':
cfg.showhidden = 1;
break;
+ case 'J':
+ g_state.stayonsel = 1;
+ break;
case 'K':
check_key_collision();
return EXIT_SUCCESS;