mirror of
https://github.com/jarun/nnn.git
synced 2024-11-17 08:32:36 +00:00
Bind ^J with toggle auto-jump on open
This commit is contained in:
parent
2c5cb4c5aa
commit
eb42f7a948
|
@ -64,7 +64,7 @@ Runs on the Pi, [Termux](https://www.youtube.com/embed/AbaauM7gUJw) (Android), L
|
||||||
- Remote mounts (needs `sshfs`, `rclone`)
|
- Remote mounts (needs `sshfs`, `rclone`)
|
||||||
- Familiar shortcuts (arrows, <kbd>~</kbd>, <kbd>-</kbd>, <kbd>@</kbd>), quick look-up
|
- Familiar shortcuts (arrows, <kbd>~</kbd>, <kbd>-</kbd>, <kbd>@</kbd>), quick look-up
|
||||||
- `cd` on quit (*easy* shell integration)
|
- `cd` on quit (*easy* shell integration)
|
||||||
- Auto-proceed on file open and selection
|
- Jump to next file on file open and selection
|
||||||
- Search
|
- Search
|
||||||
- Instant filtering with *search-as-you-type*
|
- Instant filtering with *search-as-you-type*
|
||||||
- Regex (POSIX/PCRE) and string (default) filters
|
- Regex (POSIX/PCRE) and string (default) filters
|
||||||
|
|
|
@ -24,7 +24,7 @@ complete -c nnn -s f -d 'use readline history file'
|
||||||
complete -c nnn -s g -d 'regex filters'
|
complete -c nnn -s g -d 'regex filters'
|
||||||
complete -c nnn -s H -d 'show hidden files'
|
complete -c nnn -s H -d 'show hidden files'
|
||||||
complete -c nnn -s i -d 'show current file info'
|
complete -c nnn -s i -d 'show current file info'
|
||||||
complete -c nnn -s J -d 'no auto-proceed on select'
|
complete -c nnn -s J -d 'no auto-jump on select'
|
||||||
complete -c nnn -s K -d 'detect key collision'
|
complete -c nnn -s K -d 'detect key collision'
|
||||||
complete -c nnn -s l -r -d 'lines to move per scroll'
|
complete -c nnn -s l -r -d 'lines to move per scroll'
|
||||||
complete -c nnn -s n -d 'start in type-to-nav mode'
|
complete -c nnn -s n -d 'start in type-to-nav mode'
|
||||||
|
|
|
@ -22,7 +22,7 @@ args=(
|
||||||
'(-g)-g[regex filters]'
|
'(-g)-g[regex filters]'
|
||||||
'(-H)-H[show hidden files]'
|
'(-H)-H[show hidden files]'
|
||||||
'(-i)-i[show current file info]'
|
'(-i)-i[show current file info]'
|
||||||
'(-J)-J[no auto-proceed on select]'
|
'(-J)-J[no auto-jump on select]'
|
||||||
'(-K)-K[detect key collision]'
|
'(-K)-K[detect key collision]'
|
||||||
'(-l)-l[lines to move per scroll]:val'
|
'(-l)-l[lines to move per scroll]:val'
|
||||||
'(-n)-n[start in type-to-nav mode]'
|
'(-n)-n[start in type-to-nav mode]'
|
||||||
|
|
4
nnn.1
4
nnn.1
|
@ -88,7 +88,7 @@ supports the following options:
|
||||||
show current file information in info bar (may be slow)
|
show current file information in info bar (may be slow)
|
||||||
.Pp
|
.Pp
|
||||||
.Fl J
|
.Fl J
|
||||||
disable auto-proceed on selection
|
disable auto-jump on selection
|
||||||
(eg. selecting an entry will no longer move cursor to the next entry)
|
(eg. selecting an entry will no longer move cursor to the next entry)
|
||||||
.Pp
|
.Pp
|
||||||
.Fl K
|
.Fl K
|
||||||
|
@ -235,7 +235,7 @@ in \fBtype-to-nav\fR mode:
|
||||||
Key | Function
|
Key | Function
|
||||||
------ + ------------------------
|
------ + ------------------------
|
||||||
' | Go to first non-dir file
|
' | Go to first non-dir file
|
||||||
+ | Toggle auto-proceed on open
|
+ | Toggle file selection
|
||||||
, | Mark CWD
|
, | Mark CWD
|
||||||
- | Go to last visited dir
|
- | Go to last visited dir
|
||||||
. | Show hidden files
|
. | Show hidden files
|
||||||
|
|
|
@ -210,7 +210,7 @@ index 1028906a..c80314de 100644
|
||||||
+ " -G always show git status\n"
|
+ " -G always show git status\n"
|
||||||
" -H show hidden files\n"
|
" -H show hidden files\n"
|
||||||
" -i show current file info\n"
|
" -i show current file info\n"
|
||||||
" -J no auto-proceed on select\n"
|
" -J no auto-jump on select\n"
|
||||||
@@ -8266,6 +8382,7 @@ static void cleanup(void)
|
@@ -8266,6 +8382,7 @@ static void cleanup(void)
|
||||||
free(hostname);
|
free(hostname);
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,7 +213,7 @@ index af586056..9ebfb203 100644
|
||||||
+ " -G always show git status\n"
|
+ " -G always show git status\n"
|
||||||
" -H show hidden files\n"
|
" -H show hidden files\n"
|
||||||
" -i show current file info\n"
|
" -i show current file info\n"
|
||||||
" -J no auto-proceed on select\n"
|
" -J no auto-jump on select\n"
|
||||||
@@ -8272,6 +8387,7 @@ static void cleanup(void)
|
@@ -8272,6 +8387,7 @@ static void cleanup(void)
|
||||||
free(hostname);
|
free(hostname);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ index 4243f2cc..b893f573 100644
|
||||||
--- a/src/nnn.c
|
--- a/src/nnn.c
|
||||||
+++ b/src/nnn.c
|
+++ b/src/nnn.c
|
||||||
@@ -370,7 +370,8 @@ typedef struct {
|
@@ -370,7 +370,8 @@ typedef struct {
|
||||||
uint_t stayonsel : 1; /* Disable auto-proceed on select */
|
uint_t stayonsel : 1; /* Disable auto-jump on select */
|
||||||
uint_t trash : 2; /* Trash method 0: rm -rf, 1: trash-cli, 2: gio trash */
|
uint_t trash : 2; /* Trash method 0: rm -rf, 1: trash-cli, 2: gio trash */
|
||||||
uint_t uidgid : 1; /* Show owner and group info */
|
uint_t uidgid : 1; /* Show owner and group info */
|
||||||
- uint_t reserved : 7; /* Adjust when adding/removing a field */
|
- uint_t reserved : 7; /* Adjust when adding/removing a field */
|
||||||
|
|
10
src/nnn.c
10
src/nnn.c
|
@ -350,7 +350,7 @@ typedef struct {
|
||||||
/* Non-persistent program-internal states (alphabeical order) */
|
/* Non-persistent program-internal states (alphabeical order) */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint_t autofifo : 1; /* Auto-create NNN_FIFO */
|
uint_t autofifo : 1; /* Auto-create NNN_FIFO */
|
||||||
uint_t autonext : 1; /* Auto-proceed on open */
|
uint_t autonext : 1; /* Auto-jump on open */
|
||||||
uint_t dircolor : 1; /* Current status of dir color */
|
uint_t dircolor : 1; /* Current status of dir color */
|
||||||
uint_t dirctx : 1; /* Show dirs in context color */
|
uint_t dirctx : 1; /* Show dirs in context color */
|
||||||
uint_t duinit : 1; /* Initialize disk usage */
|
uint_t duinit : 1; /* Initialize disk usage */
|
||||||
|
@ -368,7 +368,7 @@ typedef struct {
|
||||||
uint_t runctx : 3; /* The context in which plugin is to be run */
|
uint_t runctx : 3; /* The context in which plugin is to be run */
|
||||||
uint_t runplugin : 1; /* Choose plugin mode */
|
uint_t runplugin : 1; /* Choose plugin mode */
|
||||||
uint_t selmode : 1; /* Set when selecting files */
|
uint_t selmode : 1; /* Set when selecting files */
|
||||||
uint_t stayonsel : 1; /* Disable auto-proceed on select */
|
uint_t stayonsel : 1; /* Disable auto-jump on select */
|
||||||
uint_t trash : 2; /* Trash method 0: rm -rf, 1: trash-cli, 2: gio trash */
|
uint_t trash : 2; /* Trash method 0: rm -rf, 1: trash-cli, 2: gio trash */
|
||||||
uint_t uidgid : 1; /* Show owner and group info */
|
uint_t uidgid : 1; /* Show owner and group info */
|
||||||
uint_t reserved : 7; /* Adjust when adding/removing a field */
|
uint_t reserved : 7; /* Adjust when adding/removing a field */
|
||||||
|
@ -3376,7 +3376,7 @@ static int filterentries(char *path, char *lastname)
|
||||||
if (cfg.filtermode) {
|
if (cfg.filtermode) {
|
||||||
switch (*ch) {
|
switch (*ch) {
|
||||||
case '\'': // fallthrough /* Go to first non-dir file */
|
case '\'': // fallthrough /* Go to first non-dir file */
|
||||||
case '+': // fallthrough /* Toggle auto-proceed on open */
|
case '+': // fallthrough /* Toggle file selection */
|
||||||
case ',': // fallthrough /* Mark CWD */
|
case ',': // fallthrough /* Mark CWD */
|
||||||
case '-': // fallthrough /* Visit last visited dir */
|
case '-': // fallthrough /* Visit last visited dir */
|
||||||
case '.': // fallthrough /* Show hidden files */
|
case '.': // fallthrough /* Show hidden files */
|
||||||
|
@ -5023,7 +5023,7 @@ static void show_help(const char *path)
|
||||||
"9Lt h Parent%-12c~ ` @ - ~, /, start, prev\n"
|
"9Lt h Parent%-12c~ ` @ - ~, /, start, prev\n"
|
||||||
"5Ret Rt l Open%-20c' First file/match\n"
|
"5Ret Rt l Open%-20c' First file/match\n"
|
||||||
"9g ^A Top%-21c. Toggle hidden\n"
|
"9g ^A Top%-21c. Toggle hidden\n"
|
||||||
"9G ^E End%-21c+ Toggle auto-proceed on open\n"
|
"9G ^E End%-20c^J Toggle auto-jump on open\n"
|
||||||
"8B (,) Book(mark)%-11cb ^/ Select bookmark\n"
|
"8B (,) Book(mark)%-11cb ^/ Select bookmark\n"
|
||||||
"a1-4 Context%-11c(Sh)Tab Cycle/new context\n"
|
"a1-4 Context%-11c(Sh)Tab Cycle/new context\n"
|
||||||
"62Esc ^Q Quit%-20cq Quit context\n"
|
"62Esc ^Q Quit%-20cq Quit context\n"
|
||||||
|
@ -8146,7 +8146,7 @@ static void usage(void)
|
||||||
" -g regex filters\n"
|
" -g regex filters\n"
|
||||||
" -H show hidden files\n"
|
" -H show hidden files\n"
|
||||||
" -i show current file info\n"
|
" -i show current file info\n"
|
||||||
" -J no auto-proceed on selection\n"
|
" -J no auto-jump on selection\n"
|
||||||
" -K detect key collision\n"
|
" -K detect key collision\n"
|
||||||
" -l val set scroll lines\n"
|
" -l val set scroll lines\n"
|
||||||
" -n type-to-nav mode\n"
|
" -n type-to-nav mode\n"
|
||||||
|
|
|
@ -247,8 +247,8 @@ static struct key bindings[] = {
|
||||||
{ 'u', SEL_UMOUNT },
|
{ 'u', SEL_UMOUNT },
|
||||||
/* Show help */
|
/* Show help */
|
||||||
{ '?', SEL_HELP },
|
{ '?', SEL_HELP },
|
||||||
/* Quit a context */
|
/* Toggle auto-jump on open */
|
||||||
{ '+', SEL_AUTONEXT },
|
{ CONTROL('J'), SEL_AUTONEXT },
|
||||||
/* Edit in EDITOR */
|
/* Edit in EDITOR */
|
||||||
{ 'e', SEL_EDIT },
|
{ 'e', SEL_EDIT },
|
||||||
/* Run a plugin */
|
/* Run a plugin */
|
||||||
|
|
Loading…
Reference in a new issue