Skip to content

Commit d4bbfb3

Browse files
committed
Document environment variables and colours
1 parent 937b325 commit d4bbfb3

File tree

1 file changed

+240
-0
lines changed

1 file changed

+240
-0
lines changed

contrib/man/exa.1

Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,246 @@ To display a tree of files, three levels deep:
193193
exa\ \-\-long\ \-\-tree\ \-\-level=3
194194
\f[]
195195
.fi
196+
.SH ENVIRONMENT VARIABLES
197+
.PP
198+
exa responds to the following environment variables:
199+
.SS \f[C]COLUMNS\f[]
200+
.PP
201+
Overrides the width of the terminal, in characters.
202+
For example, \f[C]COLUMNS=80\ exa\f[] will show a grid view with a
203+
maximum width of 80 characters.
204+
.PP
205+
This option won\[aq]t do anything when exa\[aq]s output doesn\[aq]t
206+
wrap, such as when using the \f[C]\-\-long\f[] view.
207+
.SS \f[C]EXA_STRICT\f[]
208+
.PP
209+
Enables \f[I]strict mode\f[], which will make exa error when two
210+
command\-line options are incompatible.
211+
Usually, options can override each other going right\-to\-left on the
212+
command line, so that exa can be given aliases: creating an alias
213+
\f[C]exa=exa\ \-\-sort=ext\f[] then running \f[C]exa\ \-\-sort=size\f[]
214+
with that alias will run \f[C]exa\ \-\-sort=ext\ \-\-sort=size\f[], and
215+
the sorting specified by the user will override the sorting specified by
216+
the alias.
217+
In strict mode, the two options will not co\-operate, and exa will
218+
error.
219+
.PP
220+
This option is intended for use with automated scripts and other
221+
situations where you want to be \f[I]certain\f[] you\[aq]re typing in
222+
the right command.
223+
.SS \f[C]EXA_GRID_ROWS\f[]
224+
.PP
225+
Limits the grid\-details view (\f[C]exa\ \-\-grid\ \-\-long\f[]) so
226+
it\[aq]s only activated when at least the given number of rows of output
227+
would be generated.
228+
With widescreen displays, it\[aq]s possible for the grid to look very
229+
wide and sparse, on just one or two lines with none of the columns
230+
lining up.
231+
By specifying a minimum number of rows, you can only use the view if
232+
it\[aq]s going to be worth using.
233+
.SS \f[C]LS_COLORS\f[] and \f[C]EXA_COLORS\f[]
234+
.PP
235+
The \f[C]EXA_COLORS\f[] variable is the traditional way of customising
236+
the colours used by \f[C]ls\f[].
237+
.PP
238+
You can use the \f[C]dircolors\f[] program to generate a script that
239+
sets the variable from an input file, or if you don\[aq]t mind editing
240+
long strings of text, you can just type it out directly.
241+
These variables have the following structure:
242+
.IP \[bu] 2
243+
A list of key\-value pairs separated by \f[C]=\f[], such as
244+
\f[C]*.txt=32\f[].
245+
.IP \[bu] 2
246+
Multiple ANSI formatting codes are separated by \f[C];\f[], such as
247+
\f[C]*.txt=32;1;4\f[].
248+
.IP \[bu] 2
249+
Finally, multiple pairs are separated by \f[C]:\f[], such as
250+
\f[C]*.txt=32:*.mp3=1;35\f[].
251+
.PP
252+
The key half of the pair can either be a two\-letter code or a file
253+
glob, and anything that\[aq]s not a valid code will be treated as a
254+
glob, including keys that happen to be two letters long.
255+
.PP
256+
\f[C]LS_COLORS\f[] can use these ten codes:
257+
.IP \[bu] 2
258+
\f[B]di\f[], directories
259+
.IP \[bu] 2
260+
\f[B]ex\f[], executable files
261+
.IP \[bu] 2
262+
\f[B]fi\f[], regular files
263+
.IP \[bu] 2
264+
\f[B]pi\f[], named pipes
265+
.IP \[bu] 2
266+
\f[B]so\f[], sockets
267+
.IP \[bu] 2
268+
\f[B]bd\f[], block devices
269+
.IP \[bu] 2
270+
\f[B]cd\f[], character devices
271+
.IP \[bu] 2
272+
\f[B]ln\f[], symlinks
273+
.IP \[bu] 2
274+
\f[B]or\f[], symlinks with no target
275+
.IP \[bu] 2
276+
\f[B]mi\f[], a missing symlink target
277+
.PP
278+
\f[C]EXA_COLORS\f[] can use many more:
279+
.IP \[bu] 2
280+
\f[B]ur\f[], the user\-read permission bit
281+
.IP \[bu] 2
282+
\f[B]uw\f[], the user\-write permission bit
283+
.IP \[bu] 2
284+
\f[B]ux\f[], the user\-execute permission bit for regular files
285+
.IP \[bu] 2
286+
\f[B]ue\f[], the user\-execute for other file kinds
287+
.IP \[bu] 2
288+
\f[B]gr\f[], the group\-read permission bit
289+
.IP \[bu] 2
290+
\f[B]gw\f[], the group\-write permission bit
291+
.IP \[bu] 2
292+
\f[B]gx\f[], the group\-execute permission bit
293+
.IP \[bu] 2
294+
\f[B]tr\f[], the others\-read permission bit
295+
.IP \[bu] 2
296+
\f[B]tw\f[], the others\-write permission bit
297+
.IP \[bu] 2
298+
\f[B]tx\f[], the others\-execute permission bit
299+
.IP \[bu] 2
300+
\f[B]su\f[], setuid, setgid, and sticky permission bits for files
301+
.IP \[bu] 2
302+
\f[B]sf\f[], setuid, setgid, and sticky for other file kinds
303+
.IP \[bu] 2
304+
\f[B]xa\f[], the extended attribute indicator
305+
.IP \[bu] 2
306+
\f[B]sn\f[], the numbers of a file\[aq]s size
307+
.IP \[bu] 2
308+
\f[B]sb\f[], the units of a file\[aq]s size
309+
.IP \[bu] 2
310+
\f[B]df\f[], a device\[aq]s major ID
311+
.IP \[bu] 2
312+
\f[B]ds\f[], a device\[aq]s minor ID
313+
.IP \[bu] 2
314+
\f[B]uu\f[], a user that\[aq]s you
315+
.IP \[bu] 2
316+
\f[B]un\f[], a user that\[aq]s someone else
317+
.IP \[bu] 2
318+
\f[B]gu\f[], a group that you belong to
319+
.IP \[bu] 2
320+
\f[B]gn\f[], a group you aren\[aq]t a member of
321+
.IP \[bu] 2
322+
\f[B]lc\f[], a number of hard links
323+
.IP \[bu] 2
324+
\f[B]lm\f[], a number of hard links for a regular file with at least two
325+
.IP \[bu] 2
326+
\f[B]ga\f[], a new file in Git
327+
.IP \[bu] 2
328+
\f[B]gm\f[], a modified file in Git
329+
.IP \[bu] 2
330+
\f[B]gd\f[], a deleted file in Git
331+
.IP \[bu] 2
332+
\f[B]gv\f[], a renamed file in Git
333+
.IP \[bu] 2
334+
\f[B]gt\f[], a file with modified metadata in Git
335+
.IP \[bu] 2
336+
\f[B]xx\f[], "punctuation", including many background UI elements
337+
.IP \[bu] 2
338+
\f[B]da\f[], a file\[aq]s date
339+
.IP \[bu] 2
340+
\f[B]in\f[], a file\[aq]s inode number
341+
.IP \[bu] 2
342+
\f[B]bl\f[], a file\[aq]s number of blocks
343+
.IP \[bu] 2
344+
\f[B]hd\f[], the header row of a table
345+
.IP \[bu] 2
346+
\f[B]lp\f[], the path of a symlink
347+
.IP \[bu] 2
348+
\f[B]cc\f[], an escaped character in a filename
349+
.PP
350+
Values in \f[C]EXA_COLORS\f[] override those given in
351+
\f[C]LS_COLORS\f[], so you don\[aq]t need to re\-write an existing
352+
\f[C]LS_COLORS\f[] variable with proprietary extensions.
353+
.PP
354+
Unlike some versions of \f[C]ls\f[], the given ANSI values must be valid
355+
colour codes: exa won\[aq]t just print out whichever characters are
356+
given.
357+
The codes accepted by exa are:
358+
.IP \[bu] 2
359+
\f[C]1\f[], for bold
360+
.IP \[bu] 2
361+
\f[C]4\f[], for underline
362+
.IP \[bu] 2
363+
\f[C]31\f[], for red text
364+
.IP \[bu] 2
365+
\f[C]32\f[], for green text
366+
.IP \[bu] 2
367+
\f[C]33\f[], for yellow text
368+
.IP \[bu] 2
369+
\f[C]34\f[], for blue text
370+
.IP \[bu] 2
371+
\f[C]35\f[], for purple text
372+
.IP \[bu] 2
373+
\f[C]36\f[], for cyan text
374+
.IP \[bu] 2
375+
\f[C]37\f[], for white text
376+
.IP \[bu] 2
377+
\f[C]38;5;\f[]\f[I]\f[C]nnn\f[]\f[], for a colour from 0 to 255 (replace
378+
the \f[I]nnn\f[] part)
379+
.PP
380+
Many terminals will treat bolded text as a different colour, or at least
381+
provide the option to.
382+
.PP
383+
exa provides its own built\-in set of file extension mappings that cover
384+
a large range of common file extensions, including documents, archives,
385+
media, and temporary files.
386+
Any mappings in the environment variables will override this default
387+
set: running exa with \f[C]LS_COLORS="*.zip=32"\f[] will turn zip files
388+
green but leave the colours of other compressed files alone.
389+
.PP
390+
You can also disable this built\-in set entirely by including a
391+
\f[C]reset\f[] entry at the beginning of \f[C]EXA_COLORS\f[].
392+
So setting \f[C]EXA_COLORS="reset:*.txt=31"\f[] will highlight only text
393+
files; setting \f[C]EXA_COLORS="reset"\f[] will highlight nothing.
394+
.SS Examples
395+
.IP \[bu] 2
396+
Disable the "current user" highlighting: \f[C]EXA_COLORS="uu=0:gu=0"\f[]
397+
.IP \[bu] 2
398+
Turn the date column green: \f[C]EXA_COLORS="da=32"\f[]
399+
.IP \[bu] 2
400+
Highlight Vagrantfiles: \f[C]EXA_COLORS="Vagrantfile=1;4;33"\f[]
401+
.IP \[bu] 2
402+
Override the existing zip colour: \f[C]EXA_COLORS="*.zip=38;5;125"\f[]
403+
.IP \[bu] 2
404+
Markdown files a shade of green, log files a shade of grey:
405+
\f[C]EXA_COLORS="*.md=38;5;121:*.log=38;5;248"\f[]
406+
.SS BUILT\-IN EXTENSIONS
407+
.IP \[bu] 2
408+
"Immediate" files are the files you should look at when downloading and
409+
building a project for the first time: READMEs, Makefiles, Cargo.toml,
410+
and others.
411+
They\[aq]re highlighted in yellow and underlined.
412+
.IP \[bu] 2
413+
Images (png, jpeg, gif) are purple.
414+
.IP \[bu] 2
415+
Videos (mp4, ogv, m2ts) are a slightly purpler purple.
416+
.IP \[bu] 2
417+
Music (mp3, m4a, ogg) is a deeper purple.
418+
.IP \[bu] 2
419+
Lossless music (flac, alac, wav) is deeper than \f[I]that\f[] purple.
420+
In general, most media files are some shade of purple.
421+
.IP \[bu] 2
422+
Cryptographic files (asc, enc, p12) are a faint blue.
423+
.IP \[bu] 2
424+
Documents (pdf, doc, dvi) are a less faint blue.
425+
.IP \[bu] 2
426+
Compressed files (zip, tgz, Z) are red.
427+
.IP \[bu] 2
428+
Temporary files (tmp, swp, ~) are grey.
429+
.IP \[bu] 2
430+
Compiled files (class, o, pyc) are faint orange.
431+
A file is also counted as compiled if it uses a common extension and is
432+
in the same directory as one of its source files: \[aq]styles.css\[aq]
433+
will count as compiled when next to \[aq]styles.less\[aq] or
434+
\[aq]styles.sass\[aq], and \[aq]scripts.js\[aq] when next to
435+
\[aq]scripts.ts\[aq] or \[aq]scripts.coffee\[aq].
196436
.SH AUTHOR
197437
.PP
198438
\f[C]exa\f[] is maintained by Benjamin \[aq]ogham\[aq] Sago and many

0 commit comments

Comments
 (0)