commit 272ecc2f7115da771312b9c3e92328841e927628
parent 1976cad3259e86aa4bc1e9aaa25fd451985020e4
Author: Matthias Kunnen <matthias.kunnen@gmail.com>
Date: Wed, 19 Feb 2025 04:22:34 +0100
Improve sort order documentation
- Document sort order in the man page
- Fix typo in zsh completion
- Explain sort order options in fish completions
Diffstat:
3 files changed, 52 insertions(+), 3 deletions(-)
diff --git a/misc/auto-completion/fish/nnn.fish b/misc/auto-completion/fish/nnn.fish
@@ -38,7 +38,7 @@ complete -c nnn -s R -d 'disable rollover at edges'
complete -c nnn -s s -r -d 'load session by name' -x -a '@\t"last session" (ls $sessions_dir)'
complete -c nnn -s S -d 'persistent session'
complete -c nnn -s t -r -d 'timeout in seconds to lock'
-complete -c nnn -s T -r -d 'a d e r s t v'
+complete -c nnn -s T -r -d 'sort order' -x -a "a\t'apparent disk usage' d\t'disk usage' e\t'extension' r\t'reverse' s\t'size' t\t'time' v\t'version'"
complete -c nnn -s u -d 'use selection (no prompt)'
complete -c nnn -s U -d 'show user and group'
complete -c nnn -s V -d 'show program version and exit'
diff --git a/misc/auto-completion/zsh/_nnn b/misc/auto-completion/zsh/_nnn
@@ -37,7 +37,7 @@ args=(
'(-s)-s[load session]:session name'
'(-S)-S[persistent session]'
'(-t)-t[timeout to lock]:seconds'
- '(-T)-T[sort order]:key:(( a\:"apparent disk usasge" d\:"disk usage" e\:"extension" r\:"reverse" s\:"size" t\:"time" v\:"version" ))'
+ '(-T)-T[sort order]:key:(( a\:"apparent disk usage" d\:"disk usage" e\:"extension" r\:"reverse" s\:"size" t\:"time" v\:"version" ))'
'(-u)-u[use selection (no prompt)]'
'(-U)-U[show user and group]'
'(-V)-V[show program version and exit]'
diff --git a/nnn.1 b/nnn.1
@@ -1,4 +1,4 @@
-.Dd Aug 26, 2024
+.Dd February 22, 2025
.Dt NNN 1
.Os
.Sh NAME
@@ -286,6 +286,55 @@ in \fBtype-to-nav\fR mode:
~ | Go HOME
------ + ------------------------
.Ed
+.Sh SORT
+.Nm
+will always show the directories first, followed by the files.
+String order is always case-insensitive.
+.Pp
+The sort key can be set; either on start with the -T flag, or interactively
+using 't' or '^T'.
+The following options exist:
+.Bl -tag -width 2n
+.It Ic a
+apparent disk usage, how large the file appears to be, can be bigger than actual
+disk usage in sparse files.
+.It Ic d
+disk usage, amount of data taken on disk, a multiple of the block size.
+.It Ic e
+extension of the file.
+.It Ic r
+reverse the current order (not available for the -T flag).
+.It Ic s
+size of file, amount of data stored in the file.
+.It Ic t
+time, this depends on the currently selected time type which can be changed
+using the 'T' key.
+Options are:
+.Bl -tag -compact -width 1n
+.It Ic a
+access, last time the file was accessed.
+.It Ic c
+change, last time the metadata of the file was changed (e.g. permissions).
+.It Ic m
+modified, last time the content of the file was changed (default).
+.El
+.It Ic v
+version, sorts by filename while treating digit characters numerically.
+For example: j1.png, j02.png, j3.png.
+.It Ic c
+clear, revert to filename order (not available for the -T flag).
+.It Ic ^T
+cycle between filename/size/time order (not available for the -T flag).
+.El
+.Pp
+The uppercase version of the option can be used to specify the opposite of the
+default order.
+By default, time and size sort keys are ordered in descending order, and
+alphabetical fields are ordered in ascending order.
+For example, when using the 'e' option, the entries will be ordered by
+extension, in ascending order.
+Using 'E' would result in descending order of the extensions.
+This means that 'e' followed by 'r' is the same as 'E'.
.Sh SELECTION
.Nm
allows file selection across directories and contexts!