Skip to content

Commit dfdef9d

Browse files
authored
Merge pull request #2004 from MatthiasKunnen/sort-usage
Document sort actions
2 parents 1976cad + 272ecc2 commit dfdef9d

File tree

3 files changed

+52
-3
lines changed

3 files changed

+52
-3
lines changed

misc/auto-completion/fish/nnn.fish

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ complete -c nnn -s R -d 'disable rollover at edges'
3838
complete -c nnn -s s -r -d 'load session by name' -x -a '@\t"last session" (ls $sessions_dir)'
3939
complete -c nnn -s S -d 'persistent session'
4040
complete -c nnn -s t -r -d 'timeout in seconds to lock'
41-
complete -c nnn -s T -r -d 'a d e r s t v'
41+
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'"
4242
complete -c nnn -s u -d 'use selection (no prompt)'
4343
complete -c nnn -s U -d 'show user and group'
4444
complete -c nnn -s V -d 'show program version and exit'

misc/auto-completion/zsh/_nnn

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ args=(
3737
'(-s)-s[load session]:session name'
3838
'(-S)-S[persistent session]'
3939
'(-t)-t[timeout to lock]:seconds'
40-
'(-T)-T[sort order]:key:(( a\:"apparent disk usasge" d\:"disk usage" e\:"extension" r\:"reverse" s\:"size" t\:"time" v\:"version" ))'
40+
'(-T)-T[sort order]:key:(( a\:"apparent disk usage" d\:"disk usage" e\:"extension" r\:"reverse" s\:"size" t\:"time" v\:"version" ))'
4141
'(-u)-u[use selection (no prompt)]'
4242
'(-U)-U[show user and group]'
4343
'(-V)-V[show program version and exit]'

nnn.1

+50-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.Dd Aug 26, 2024
1+
.Dd February 22, 2025
22
.Dt NNN 1
33
.Os
44
.Sh NAME
@@ -286,6 +286,55 @@ in \fBtype-to-nav\fR mode:
286286
~ | Go HOME
287287
------ + ------------------------
288288
.Ed
289+
.Sh SORT
290+
.Nm
291+
will always show the directories first, followed by the files.
292+
String order is always case-insensitive.
293+
.Pp
294+
The sort key can be set; either on start with the -T flag, or interactively
295+
using 't' or '^T'.
296+
The following options exist:
297+
.Bl -tag -width 2n
298+
.It Ic a
299+
apparent disk usage, how large the file appears to be, can be bigger than actual
300+
disk usage in sparse files.
301+
.It Ic d
302+
disk usage, amount of data taken on disk, a multiple of the block size.
303+
.It Ic e
304+
extension of the file.
305+
.It Ic r
306+
reverse the current order (not available for the -T flag).
307+
.It Ic s
308+
size of file, amount of data stored in the file.
309+
.It Ic t
310+
time, this depends on the currently selected time type which can be changed
311+
using the 'T' key.
312+
Options are:
313+
.Bl -tag -compact -width 1n
314+
.It Ic a
315+
access, last time the file was accessed.
316+
.It Ic c
317+
change, last time the metadata of the file was changed (e.g. permissions).
318+
.It Ic m
319+
modified, last time the content of the file was changed (default).
320+
.El
321+
.It Ic v
322+
version, sorts by filename while treating digit characters numerically.
323+
For example: j1.png, j02.png, j3.png.
324+
.It Ic c
325+
clear, revert to filename order (not available for the -T flag).
326+
.It Ic ^T
327+
cycle between filename/size/time order (not available for the -T flag).
328+
.El
329+
.Pp
330+
The uppercase version of the option can be used to specify the opposite of the
331+
default order.
332+
By default, time and size sort keys are ordered in descending order, and
333+
alphabetical fields are ordered in ascending order.
334+
For example, when using the 'e' option, the entries will be ordered by
335+
extension, in ascending order.
336+
Using 'E' would result in descending order of the extensions.
337+
This means that 'e' followed by 'r' is the same as 'E'.
289338
.Sh SELECTION
290339
.Nm
291340
allows file selection across directories and contexts!

0 commit comments

Comments
 (0)