Enable automatic dir entry on unique filer match

This commit is contained in:
Arun Prakash Jana 2022-06-14 13:49:41 +05:30
parent 56f96c3d0a
commit 581e629c20
No known key found for this signature in database
GPG key ID: A75979F35C080412
5 changed files with 23 additions and 23 deletions

View file

@ -58,7 +58,8 @@ Runs on the Pi, [Termux](https://www.youtube.com/embed/AbaauM7gUJw) (Android), L
- Disk usage analyzer (block/apparent) - Disk usage analyzer (block/apparent)
- File picker, (neo)vim plugin - File picker, (neo)vim plugin
- Navigation - Navigation
- *Type-to-nav* mode with automatic matching dir entry - Filter with automatic dir entry on unique match
- *Type-to-nav* (turbo navigation/always filter) mode
- Contexts (_aka_ tabs/workspaces) with custom colors - Contexts (_aka_ tabs/workspaces) with custom colors
- Sessions, bookmarks, mark and visit a dir - Sessions, bookmarks, mark and visit a dir
- Remote mounts (needs `sshfs`, `rclone`) - Remote mounts (needs `sshfs`, `rclone`)

View file

@ -12,7 +12,7 @@ else
end end
complete -c nnn -s a -d 'auto-create NNN_FIFO' complete -c nnn -s a -d 'auto-create NNN_FIFO'
complete -c nnn -s A -d 'disable dir auto-select' complete -c nnn -s A -d 'disable dir auto-enter'
complete -c nnn -s b -r -d 'bookmark key to open' -x -a '(echo $NNN_BMS | awk -F: -v RS=\; \'{print $1"\t"$2}\')' complete -c nnn -s b -r -d 'bookmark key to open' -x -a '(echo $NNN_BMS | awk -F: -v RS=\; \'{print $1"\t"$2}\')'
complete -c nnn -s c -d 'cli-only opener' complete -c nnn -s c -d 'cli-only opener'
complete -c nnn -s C -d 'color by context' complete -c nnn -s C -d 'color by context'

View file

@ -10,7 +10,7 @@ setopt localoptions noshwordsplit noksharrays
local -a args local -a args
args=( args=(
'(-a)-a[auto-create NNN_FIFO]' '(-a)-a[auto-create NNN_FIFO]'
'(-A)-A[disable dir auto-select]' '(-A)-A[disable dir auto-enter]'
'(-b)-b[bookmark key to open]:key char' '(-b)-b[bookmark key to open]:key char'
'(-c)-c[cli-only opener]' '(-c)-c[cli-only opener]'
'(-C)-C[color by context]' '(-C)-C[color by context]'

37
nnn.1
View file

@ -201,6 +201,10 @@ Filters are strings (or regex patterns) to find matching entries in the current
directory instantly (\fIsearch-as-you-type\fR). Matches are case-insensitive by directory instantly (\fIsearch-as-you-type\fR). Matches are case-insensitive by
default. The last filter in each context is persisted at runtime or in saved default. The last filter in each context is persisted at runtime or in saved
sessions. sessions.
.br
When there's a unique match and it's a directory,
.Nm
auto enters the directory. Use the relevant program option to disable this.
.Pp .Pp
Special keys at filter prompt: Special keys at filter prompt:
.Bd -literal .Bd -literal
@ -228,6 +232,20 @@ Special keys at \fBempty filter prompt\fR:
------ + --------------------------------------- ------ + ---------------------------------------
.Ed .Ed
.Pp .Pp
Common regex use cases:
.Pp
(1) To list all matches starting with the filter expression,
start the expression with a '^' (caret) symbol.
.br
(2) Type '\\.mkv' to list all MKV files.
.br
(3) Use '.*' to match any character (\fIsort of\fR fuzzy search).
.br
(4) Exclude filenames having 'nnn' (compiled with PCRE lib): '^(?!nnn)'
.Pp
In the \fBtype-to-nav\fR mode directories are opened in filter
mode, allowing continuous navigation.
.Pp
Additional special keys at \fBempty filter prompt\fR Additional special keys at \fBempty filter prompt\fR
in \fBtype-to-nav\fR mode: in \fBtype-to-nav\fR mode:
.Bd -literal .Bd -literal
@ -248,25 +266,6 @@ in \fBtype-to-nav\fR mode:
~ | Go HOME ~ | Go HOME
------ + ------------------------ ------ + ------------------------
.Ed .Ed
.Pp
Common regex use cases:
.Pp
(1) To list all matches starting with the filter expression,
start the expression with a '^' (caret) symbol.
.br
(2) Type '\\.mkv' to list all MKV files.
.br
(3) Use '.*' to match any character (\fIsort of\fR fuzzy search).
.br
(4) Exclude filenames having 'nnn' (compiled with PCRE lib): '^(?!nnn)'
.Pp
In the \fItype-to-nav\fR mode directories are opened in filter
mode, allowing continuous navigation.
.br
When there's a unique match and it's a directory,
.Nm
auto enters it in this mode. Use the relevant program option to disable this
behaviour.
.Sh SELECTION .Sh SELECTION
.Nm .Nm
allows file selection across directories and contexts! allows file selection across directories and contexts!

View file

@ -8163,7 +8163,7 @@ static void usage(void)
#ifndef NOFIFO #ifndef NOFIFO
" -a auto NNN_FIFO\n" " -a auto NNN_FIFO\n"
#endif #endif
" -A no dir auto-enter in type-to-nav\n" " -A disable dir auto-enter\n"
" -b key open bookmark key (trumps -s/S)\n" " -b key open bookmark key (trumps -s/S)\n"
" -c cli-only NNN_OPENER (trumps -e)\n" " -c cli-only NNN_OPENER (trumps -e)\n"
" -C 8-color scheme\n" " -C 8-color scheme\n"