Reference
Keys
Every key and command of the viewer, as F1 lists them inside aless.
The keys are jless's where jless has the key, and a count before a key repeats it (3j). Press F1 or type :help inside aless for this list; the same text is plain text here.
Moving #
j k / ↓ ↑ / C-n C-p / Enter Backspace down / up one row (count allowed)
h / ← collapse an expanded container, else go to the parent
l / → expand a collapsed container, else step to the first child
H go to the parent without collapsing
J K next / previous sibling
w b forward / back to the next change in depth
0 ^ $ first / last sibling
g G / Home End first / last row; Ng NG go to row N
C-f C-b / PgDn PgUp a page down / up
C-d C-u half a page down / up (a count sets the distance)
C-e C-y scroll one row without leaving the focus behind
zz zt zb focused row to the centre / top / bottom
. , ; scroll a long value right / left / to its end and back
< > less / more indentation
Folding #
Space toggle the focused container
c C collapse the focused node and its siblings (C: deeply)
e E expand the focused node and its siblings (E: deeply)
m switch between data mode and line mode
% in line mode, jump between a container's brackets
Search #
regular expressions; smart case; add /s to force case; [ ] { } are literal
/pat ?pat search forward / backward n N next / previous match
* # search for the focused key forward / backward
Copy and print #
y copies, p prints to the screen
yy pp pretty-printed value yv pv one-line value ys ps string contents
yk pk key yp pP path .a[0].b yb pb ["a"][0]["b"]
yq pq jq path
Explorer #
aless DIR, or aless alone for the current directory
the directory tree uses the same keys: l / Space expand a directory (its
contents are listed as you go), h collapses, / searches the listed names
Enter open the file under the cursor in a new tab (toggle a directory)
- go up: the parent directory becomes the root
:cd DIR change the root :explore [DIR] open another directory tab
:set hidden | nohidden | hidden! show dot-files (also --hidden)
yp copy the entry's filesystem path
Errors #
A file that does not parse shows the parser's report: the message, the
source lines around the error with a caret under it, and the grammar's
hint. While a watched file is broken its last good document stays on
screen with the report docked below it, until the file parses again.
! / :error the active tab's report, full size (after a failed
:format, that attempt's report); h/l pan a long line
Tabs, files and watching #
Tab / Shift-Tab next / previous tab :tab N go to tab N
:open PATH [FORMAT] open a file (or a directory) in a new tab (:e is an alias)
q / :q close the tab (the last one closed quits) :qa / :quit quit
W / :watch on|off toggle reloading the tab when its file changes
r / :reload reload now (in the program pane, the program)
s / :source show the raw source (the focused node's line centred)
:format FORMAT parse the tab's text as another format
:depth N fold everything below depth N
:w[!] FILE write the document as JSON
:set number | nonumber | relativenumber | norelativenumber | so=N | indent=N
:N or :line N go to row N
F1 / :help this help
Panes #
aless --panes out[,program], or :vsplit
C-w move the focus to the next pane; the keys work there
s show the focused pane's text, or its tree again; in the
text, : and r work too, and any other key but the
scrolling ones shows the tree
q close an output or program pane (the input pane stays)
:vsplit / :split side by side / stacked, opening the output beside the input
:arrange switch between side by side and stacked
:pane out|program|close open the output or the program pane, or close one
:only keep the input pane alone
The output is the document as --render or --alchemy writes it, read
back as a tree; it is written again when the tab reloads or changes.
A watched tab reloads when its file changes and keeps your place: the
focused node is found again by path, or by its nearest surviving
ancestor and then the node closest to its old source line; folds that
still exist are kept, and the focus stays on the same screen row.
Formats: json jsonl jsonic jsonc json5 yaml toml ini csv tsv xml zon
markdown feed text, and the NAME of any --grammar (by extension or whole
file name; --kind or :open ... FORMAT to force).