1fimrc(5)                      File Formats Manual                     fimrc(5)
2
3
4

NAME

6       fimrc -  fim  configuration file and language reference
7
8

SYNOPSIS

10       ~/.fimrc
11       /usr/local/etc/fimrc
12       fim --script-from-stdin [ {options} ] < {scriptfile}
13       fim --execute-script {scriptfile} [ {options} ]
14       fim --execute-commands {commands} [ {options} ]
15       fim --final-commands {commands} [ {options} ]
16       fim --write-scriptout {scriptfile} [ {options} ]
17       fim --write-scriptout /dev/stdout [ {options} ]
18       fim --chars-press :{commands} [ {options} ]
19       fim --chars-press :{commands} --chars-press '' [ {options} ]
20
21

DESCRIPTION

23       This  page  explains the fim language, which is used for the fimrc con‐
24       figuration files, {scriptfile}s, or {commands} passed via command  line
25       {options}.   This  language can be used to issue commands (or programs)
26       from the internal program command line accessed  interactively  through
27       the  ":"  key  (or rather, the key code specified by the "_console_key"
28       variable).  One may exit from command line mode by pressing  the  Enter
29       key  on  an empty line (a non empty command line would be submitted for
30       execution), or the Esc key  (only in SDL mode).  The general form of  a
31       fim command/program is shown in the next section.
32
33
34

FIM LANGUAGE GRAMMAR

36       This section specifies the grammar of the fim language.
37
38       Language elements surrounded by a single quote ("'") are literals.
39
40       Warning: at the present state, this grammar has conflicts. A future re‐
41       lease shall fix them.
42
43         program: %empty
44                | statement_list
45
46         statement_list: statement
47                       | statement ';' statement_list
48                       | non_atomic_statements_block statement_list
49                       | statements_block
50
51         non_atomic_statements_block: '{' statement_list '}'
52                                    | INTEGER '{' statement_list '}'
53                                    | conditional_statement
54
55         statements_block: atomic_statements_block
56                         | non_atomic_statements_block
57
58         conditional_statement: if_statement
59                              | loop_statement
60
61         if_statement: 'if' '(' expression ')' statements_block
62                     | 'if' '(' expression ')' statements_block 'else'  state‐
63       ments_block
64
65         loop_statement: 'while' '(' expression ')' statements_block
66                       | 'do' statements_block 'while' '(' expression ')'
67
68         atomic_statements_block: statement ';'
69                                | statement ';' ';'
70                                | statement ';' ';' ';'
71
72         statement: '!' arguments
73                  | INTEGER ',' INTEGER IDENTIFIER
74                  | INTEGER ',' INTEGER IDENTIFIER arguments
75                  | INTEGER IDENTIFIER
76                  | SLASH_AND_REGEXP
77                  | '+' UNQUOTED_FLOAT '%'
78                  | '+' QUOTED_FLOAT '%'
79                  | '+' INTEGER '%'
80                  | '*' UNQUOTED_FLOAT
81                  | '*' QUOTED_FLOAT
82                  | '*' INTEGER
83                  | UNQUOTED_FLOAT '%'
84                  | QUOTED_FLOAT '%'
85                  | INTEGER '%'
86                  | '-' UNQUOTED_FLOAT '%'
87                  | '-' QUOTED_FLOAT '%'
88                  | '-' INTEGER '%'
89                  | INTEGER
90                  | '-' INTEGER
91                  | IDENTIFIER
92                  | IDENTIFIER FILE_PATH
93                  | IDENTIFIER arguments
94                  | INTEGER IDENTIFIER arguments
95                  | IDENTIFIER '=' expression
96
97         arguments: expression
98                  | expression arguments
99
100         expression: '(' expression ')'
101                   | expression '.' expression
102                   | '!' expression
103                   | expression '%' expression
104                   | expression '+' expression
105                   | expression '-' expression
106                   | expression '*' expression
107                   | expression '/' expression
108                   | expression '<' expression
109                   | expression '>' expression
110                   | expression '||' expression
111                   | expression BOR expression
112                   | expression '&&' expression
113                   | expression BAND expression
114                   | expression '>=' expression
115                   | expression '<=' expression
116                   | expression '!=' expression
117                   | expression '==' expression
118                   | expression '=~' expression
119                   | '-' expression
120                   | IDENTIFIER
121                   | INTEGER
122                   | QUOTED_FLOAT
123                   | UNQUOTED_FLOAT
124                   | STRING
125
126       A  STRING  can  be  either  a  single  quoted string or a double quoted
127       string.   A  floating  point  number  can  be  either   unquoted   (UN‐
128       QUOTED_FLOAT)  or  quoted (QUOTED_FLOAT).  A QUOTED_FLOAT is a floating
129       point number, either single ("'") or double (""") quoted.   An  INTEGER
130       shall be an unsigned integer number.  An IDENTIFIER shall be one of the
131       valid fim commands (see COMMANDS REFERENCE ) or a valid alias.  A VARI‐
132       ABLE  shall  be  an  already declared or undeclared variable identifier
133       (see VARIABLES REFERENCE ) or a valid alias, created  using  the  alias
134       command.   The  "=~"  operator treats the right expression as a STRING,
135       and uses it  as  a  regular  expression  for  matching  purposes.   The
136       SLASH_AND_REGEXP  is a slash ("/") followed by a STRING, interpreted as
137       a regular expression.  If 'INTEGER , INTEGER IDENTIFIER  arguments'  is
138       encountered,  command  IDENTIFIER  will be repeated on each file in the
139       interval between the two INTEGERs, and substituting the given file name
140       to  any  '{}'  found in the commands arguments (which must be quoted in
141       order to be treated as strings).  See regex(1) for  regular  expression
142       syntax.
143
144       The way some one-line statements are evaluated:
145
146       :       enter command line mode
147       :{number}       jump to {number}^th image in the list
148       :^           jump to first image in the list
149       :$           jump to last image in the list
150       :*{factor}      scale the image by {factor}
151       :{scale}%       scale the image to the desired {scale}
152       :+{scale}%       scale the image up to the desired percentage {scale} (relatively to the original)
153       :-{scale}%       scale the image down to the desired percentage {scale} (relatively to the original)
154
155       /{regexp}       entering the pattern {regexp} (with /) makes fim jump to the next image whose filename matches {regexp}
156       /*.png$         entering this pattern (with /) makes fim jump to the next image whose filename ends with 'png'
157       /png       a shortcut for /.*png.*
158
159       2,4 stdout '{}'     print three filenames to standard output.
160
161
162       !{syscmd}      executes the {syscmd} quoted string as an argument to the  "system" fim command.
163
164
165

COMMANDS REFERENCE

167       alias
168       alias [{identifier} [{commands} [{description}]]]
169       Without arguments, lists the current aliases.
170       With one, shows an identifier's assigned command.
171       With two, assigns to an identifier a user defined command or sequence
172       of commands.
173       With three, also assigns a help string.
174
175       align
176       align ['bottom'|'top'|'left'|right']: if image larger than drawing
177       area, align one side of the image to the border.
178       align 'center': align equally far from all sides.
179       align 'info': print internal alignment information.
180
181       autocmd
182       autocmd {event} {pattern} {commands}: manipulate autocommands (inspired
183       from Vim autocmd's).
184       Without arguments, list autocommands.
185       With arguments, specifies for which type of event and which current
186       file open, which commands to execute.
187       See the default built-in configuration files for examples.
188
189       autocmd_del
190       autocmd_del: specify autocommands to delete.
191       Usage: autocmd_del {event} {pattern} {commands}.
192
193       basename
194       basename {filename}: returns the basename of {filename} in the
195       '_last_cmd_output' variable.
196
197       bind
198       bind [{keysym} [{commands}]]: bind a keyboard symbol/shortcut {keysym}
199       to {commands}.
200       If {keysym} is at least two characters long and begins with 0 (zero),
201       the integer number after the 0 will be treated as a raw keycode to bind
202       the specified {keysym} to.
203       Use the '_verbose_keys' variable to discover (display device dependent)
204       raw keys.
205       Key binding is dynamical, so you can rebind keys even during program's
206       execution.
207       You can get a list of valid symbols (keysyms) by invoking
208       dump_key_codes or in the man page.
209
210       cd
211       cd {path}: change the current directory to {path}.
212       If {path} is a file, use its base directory name.
213       cd '-' will change to the previous current directory (before the last
214       ':cd {path}' command).
215
216       clear
217       clear: clear the virtual console.
218
219       commands
220       commands: display the existing commands.
221
222       color
223       color [desaturate]: desaturate the displayed image colors.
224       color [negate]: negate the displayed image colors.
225       color [colorblind|c|deuteranopia|d]: simulate a form of the deutera‐
226       nopia color vision deficiency (cvd).
227       color [protanopia|p]: simulate a form of the protanopia cvd.
228       color [tritanopia|t]: simulate a form of the tritanopia cvd.
229       color [daltonize|D]: if following a cvd specification, will attempt
230       correcting it.
231       color [identity]: populate the image with 'RGB identity' pixels.
232       To get back the original you will have to reload the image.
233
234       crop
235       crop: crop image to a centered rectangle, half the width and half the
236       height.
237       crop {p}: crop image to the middle {p} horizontal percent and {p} ver‐
238       tical percent of the image.
239       crop {w} {h}: crop image to the middle {w} horizontal percent and {h}
240       vertical percent of the image.
241       crop {x1} {y1} {x2} {y2}: crop image to the area between the upper left
242       ({x1},{y1}) and lower right ({x2},{y2}) corner.
243       Units are intended as percentage (0 to 100).
244       Note: still experimental functionality.
245
246       desc
247       desc 'load' {filename} [{sepchar}]: load description file {filename},
248       using the optional {sepchar} character as separator.
249       desc 'reload': load once again description files specified at the com‐
250       mand line with --load-image-descriptions-file, with respective separa‐
251       tors.
252       desc ['-all'] ['-append'] ['-nooverw'] 'save' {filename} [{sepchar}]:
253       save current list descriptions to file {filename}, using the optional
254       {sepchar} character as separator, and if '-all' is present will save
255       the variables, and if '-append' is present, will only append, and if
256       '-nooverw' is present, will not overwrite existing files.
257       See documentation of --load-image-descriptions-file for the format of
258       {filename}.
259
260       display
261       display ['reinit' {string}]|'resize' {w} {h}]: display the current file
262       contents.
263       If 'reinit' switch is supplied, the '{string}' specifier will be used
264       to reinitialize (e.g.: change resolution, window system options) the
265       display device.
266       See documentation for the --output-device command line switch for al‐
267       lowed values of {string}.
268       If 'resize' and no argument, will ask the window manager to size the
269       window like the image.
270       If 'resize' and two arguments, these will be used as width and height
271       of window, to set.
272
273       dump_key_codes
274       dump_key_codes: dump the active key codes (unescaped, for inspection
275       purposes).
276
277       echo
278       echo {args}: print the {args} on console.
279
280       else
281       if(expression){action;}['else'{action;}]: see else.
282
283       eval
284       eval {args}: evaluate {args} as commands, executing them.
285
286       exec
287       exec {filename(s)}: execute script {filename(s)}.
288
289       font
290       font 'scan' [{dirname}]: scan {dirname} or /usr/share/consolefonts
291       looking for fonts in the internal fonts list.
292       font 'load' {filename}: load font {filename}.
293       font 'next'/'prev': load next/previous font in the internal fonts list.
294       font 'info': print current font filename.
295
296       getenv
297       getenv {identifier}: create a variable with the same value as the
298       '{identifier}' environment variable, but with an identifier prefixed by
299       'ENV_'. So e.g. getenv 'DISPLAY' creates 'ENV_DISPLAY'. Nothing is be‐
300       ing printed; no variable is created if {identifier} is empty.
301
302       goto
303       goto {['+'|'-']{number}['%']['f'|'p'|'F'|'P']} | {/{regexp}/} |
304       {?{filename}} | {'+//'} | {'+/'|'-/'}[C] | {{'+'|'-'}{identi‐
305       fier}['+']}: jump to an image.
306       If {number} is given, and not surrounded by any specifier, will go to
307       image at index {number}.
308       If followed by '%', the effective index will be computed as a percent‐
309       age to the current available images.
310       If prepended by '-' or '+', the jump will be relative to the current
311       index.
312       The 'f' specifier asks for the jump to occur within the files (same for
313       'F', but accelerates if keep pressing).
314       The 'p' specifier asks for the jump to occur in terms of pages, within
315       the current file (same for 'P', but accelerates if keep pressing).
316       If /{regexp}/ is given, will jump to the first image matching the given
317       /{regexp}/ regular expression pattern.
318       If the argument starts with ?, jump to the filename following ?.
319       If given '+//', will jump to the first different image matching the
320       last given regular expression pattern.
321       With '+/'C or '-/'C will jump to next or previous file according to C:
322       if 's' if same directory, if 'd' if down the directory hierarchy, if
323       'u' if down the directory hierarchy, if 'b' if same basename, if upper
324       case match is negative, if missing defaults to 'S' (jump to file in
325       different dir).
326       If {identifier|identifier2...}] is encountered after a '+' or '-' sign,
327       jump to next or previous image having a different value for any corre‐
328       sponding i:{identifier} (a trailing '+' will require a non empty
329       value).
330       Match will occur on both file name and description, possibly loaded via
331       desc or --load-image-descriptions-file; see also '_lastgotodirection'
332       and '_re_search_opts'.
333        You can specify multiple arguments to goto: those after the first
334       triggering a jump will be ignored.
335       Executes autocommands for events PreGoto and PostGoto. Keeping pressed
336       shall accelerate images browsing.
337
338       help
339       help [{identifier}]: provide online help, assuming {identifier} is a
340       variable, alias, or command identifier.
341       If {identifier} begins with '/', the search will be on the help con‐
342       tents and a list of matching items will be given instead.
343       A list of commands can be obtained simply invoking 'commands'; a list
344       of aliases with 'alias'; a list of bindings with 'bind'.
345
346       if
347       if(expression){action;}['else'{action;}]: see 'else'.
348
349       info
350       info: display information about the current file.
351
352       limit
353       limit  {'-list'|'-listall'} 'variable'|['-further'|'-merge'|'-sub‐
354       tract'] [{expression} |{variable} {value}]: A browsable file list fil‐
355       tering function (like limiting in the 'mutt' program). Uses information
356       loaded via --load-image-descriptions-file.
357        If invoked with '-list'/'-listall' only, will list the current de‐
358       scription variable ids.
359        If invoked with '-list'/'-listall' 'id', will list set values for the
360       variable 'id'.
361        If '-further' is present, will start with the current list; if not,
362       with the full list.
363        If '-merge' is present, new matches will be merged in the existing
364       list and sorted.
365        If '-subtract' is present, sort and filter out matches.
366        If {variable} and {values} are provided, limit to files having prop‐
367       erty {variable} set to {value}.
368        If {expression} is one exclamation point ('!'), will limit to the cur‐
369       rently marked files only.
370        If {expression} is '~!' will limit to files with unique basename.
371        if '~=', to files with duplicate basename.
372        if '~^', to the first of the files with duplicate basename.
373        if '~$', to the last of the files with duplicate basename.
374        On '~i' [MINIDX][-][MAXIDX], (each a number possibly followed by a
375       multiplier 'K') will limit on filenames in position MINIDX to MAXIDX.
376        On '~z' will limit to files having the current file's size.
377        on '~z' [MINSIZE][-][MAXSIZE], (each a number possibly followed by a
378       multiplier among 'k','K','m','M') will limit on filesize within these
379       limits.
380        on '~d' will limit to files having the current file's date +- one day.
381        on '~d' [MINTIME][-][MAXTIME], (each the count of seconds since the
382       Epoch (First of Jan. of 1970) or a date as DD/MM/YYYY) will limit on
383       file time (struct stat's 'st_mtime', in seconds) within this interval.
384        For other values of {expression}, limit to files whose description
385       string matches {expression}.
386        Invoked with no arguments, the original browsable files list is re‐
387       stored.
388
389       list
390       list: display the files list.
391       list 'random_shuffle': randomly shuffle the file list.
392       list 'reverse': reverse the file list.
393       list 'clear': clear the file list.
394       list 'sort': sort the file list.
395       list 'sort_basename': sort the file list according to base name.
396       list 'sort_comment': sort the file list according to the value of the
397       _comment variable.
398       list 'sort_var' {var}: sort the file list according to the value of the
399       i:{var} variable.
400       list 'vars|variables': list variables in all i:* read from description
401       file.
402       list 'sort_fsize': sort the file list according to file size.
403       list 'sort_mtime': sort the file list according to modification date.
404       list 'pop': remove the current file from the files list, and step back.
405       list 'remove' [{filename(s)}]: remove the current file, or the {file‐
406       name(s)}, if specified.
407       list 'push' {filename(s)}: push {filename(s)} to the back of the files
408       list.
409       list 'filesnum': display the number of files in the files list.
410       list 'mark' [{args}]: mark image file names for stdout printing at
411       exit, with {args} mark the ones matching according to the rules of the
412       'limit' command, otherwise the current file.
413       list 'unmark' [{args}]: unmark marked image file names, with {args} un‐
414       mark the ones matching according to the rules of the 'limit' command,
415       otherwise the current file.
416       list 'marked': show which files have been marked so far.
417       list 'dumpmarked': dump to stdout the marked files (you will want usu‐
418       ally to 'unmarkall' afterwards).
419       list 'markall': mark all the current list files.
420       list 'unmarkall': unmark all the marked files.
421       list 'pushdir' {dirname}: will push all the files in {dirname}, when
422       matching the regular expression in variable _pushdir_re or, if empty,
423       from constant regular expression
424       '.(JPG|PNG|GIF|BMP|TIFF|TIF|JPEG|JFIF|PPM|PGM|PBM|PCX|WEBP)$'.
425       list 'pushdirr' {dirname}: like pushdir, but will also push encountered
426       directory entries recursively.
427       list 'swap': will move the current image filename to the first in the
428       list (you'll have to invoke reload to see the effect).
429       Of the above commands, several will be temporarily non available for
430       the duration of a background load (enabled by --background-recursive),
431       which will last until _loading_in_background is 0.
432
433       load
434       load: load the image, if not yet loaded (see also 'reload').
435       Executes autocommands for events PreLoad and PostLoad.
436
437       pan
438       pan {vsteps}% {hsteps}%: pan the image to {vsteps} percentage steps
439       from the top and {hsteps} percentage steps from left.
440       pan {vsteps} {hsteps}: pan the image to {vsteps} pixels from the top
441       and {hsteps} pixels from left.
442       pan {'down'|'up'|'left'|'right'|'ne'|'nw'|'se'|'sw'}[+-]
443       [{steps}['%']]: pan the image {steps} pixels in the desired direction.
444       If the '%' specifier is present, {steps} will be treated as a percent‐
445       age of current screen dimensions.
446       If {steps} is not specified, the '_steps' variable will be used.
447       If present, the '_hsteps' variable will be considered for horizontal
448       panning.
449       A '+' or '-' sign at the end of the first argument will make jump to
450       next or prev if border is reached.
451       If present, the '_vsteps' variable will be considered for vertical pan‐
452       ning.
453       The variables may be terminated by the '%' specifier.
454       Executes autocommands for events PrePan and PostPan.
455
456       popen
457       popen {syscmd}: pipe a command, invoking popen(): spawns a shell, in‐
458       voking '{syscmd}' and executing as fim commands the output of
459       '{syscmd}'.
460
461       pread
462       pread {args}: execute {args} as a shell command and read the output as
463       an image file (using 'popen').
464
465       prefetch
466       prefetch: prefetch (read into the cache) the two nearby image files
467       (next and previous), for a faster subsequent opening.
468       Executes autocommands for events PrePrefetch and PostPrefetch.
469       See also the '_want_prefetch' variable.
470
471       pwd
472       pwd: print the current directory name, and updates the '_pwd' variable.
473
474       quit
475       quit [{number}]: terminate the program.
476       If {number} is specified, use it as the program return status.
477       Note that autocommand 'PostInteractiveCommand' does not trigger after
478       this command.
479
480       recording
481       recording 'start': start recording the executed commands.
482       recording 'stop': stop  recording the executed commands.
483       recording 'dump': dump in the console the record buffer.
484       recording 'execute': execute the record buffer.
485       recording 'repeat_last': repeat the last performed action.
486
487       redisplay
488       redisplay: re-display the current file contents.
489
490       reload
491       reload [{arg}]: load the image into memory.
492       If {arg} is present, will force reloading, bypassing the cache (see
493       also 'load').
494       Executes autocommands for events PreReload and PostReload.
495
496       rotate
497       rotate {number}: rotate the image the specified amount of degrees. If
498       unspecified, by one. If you are interested in orthogonal rotations, see
499       '_orientation' and related aliases.
500       Executes autocommands for events PreScale and PostScale.
501
502       scale
503       scale
504       {['+'|'-']{value}['%']|'*'{value}|'w'|'h'|'a'|'b'|'+[+-*/]'|['<'|'>']|'shadow'}:
505       scale the image according to a scale {value} (e.g.:
506       0.5,40%,'w','h','a','b').
507       If given '*' and a value, will multiply the current scale by that
508       value.
509       If given 'w', will scale according to the screen width.
510       If given 'h', scale to the screen height.
511       If given 'a', to the minimum of 'w' and 'h'.
512       If given 'b', like 'a', provided that the image width exceeds 'w' or
513       'h'.
514       If {value} is a number, will scale relatively to the original image
515       width.
516       If the number is followed by '%', the relative scale will be treated on
517       a percent scale.
518       If given '++'('+-'), will increment (decrement) the '_magnify_factor',
519       '_reduce_factor' variables by '_scale_factor_delta'.
520       If given '+*'('+/'), will multiply (divide) the '_magnify_factor',
521       '_reduce_factor' variables by '_scale_factor_multiplier'.
522       If given '<' or '>', will shrink or magnify image using nearest mipmap
523       (cached pre-scaled version). If given 'shadow' as a parameter, search a
524       same-named file in one of the directories specified to
525       --load-shadow-dir.
526       Executes autocommands for events PreScale and PostScale.
527
528       scroll
529       scroll: scroll down the image, going next when hitting the bottom.
530       scroll 'forward': scroll the image as we were reading left to right
531       (see '_scroll_skip_page_fraction' variable).
532       Executes autocommands for events PrePan and PostPan.
533
534       set
535       set: returns a list of variables which are set.
536       set {identifier}: returns the value of variable {identifier}.
537       set {identifier} {commands}: sets variable {identifier} to value {com‐
538       mands}.
539
540       set_commandline_mode
541       set_commandline_mode: set console mode.
542
543       set_interactive_mode
544       set_interactive_mode: set interactive mode.
545
546       sleep
547       sleep [{number}=1]: sleep for the specified (default 1) number of sec‐
548       onds.
549
550       status
551       status: set the status line to the collation of the given arguments.
552
553       stderr
554       stderr {args}: writes to stderr its arguments {args}.
555
556       stdout
557       stdout {args}: writes to stdout its arguments {args}.
558
559       system
560       system {syscmd}: get the output of executing the {syscmd} system com‐
561       mand. Uses the popen() system call. Usually popen invokes "/bin/sh -c
562       {syscmd}". This might not handle a multi-word command; in that case you
563       will have to put it into a script. See 'man popen' for more.
564
565       variables
566       variables: display the existing variables.
567
568       unalias
569       unalias {identifier} | '-a': delete the alias {identifier} or all
570       aliases (use '-a', not -a).
571
572       unbind
573       unbind {keysym}: unbind the action associated to a specified {keysym}
574       If {keysym} is at least two characters long and begins with 0 (zero),
575       the integer number after the 0 will be treated as a raw keycode to bind
576       the specified {keysym} to.
577       Use the '_verbose_keys' variable to discover (display device dependent)
578       raw keys.
579
580       while
581       while(expression){action;}: A conditional cycle construct.
582       May be interrupted by hitting the 'Esc' or the ':' key.
583
584       window
585       window {args}: this command is disabled.
586
587

KEYSYMS REFERENCE

589       " "  "!"  """  "#"  "$"  "%"  "&"  "'"  "("  ")"  "*"  "+"  ","  "-"
590       "."  "/"  "0"  "1"  "2"  "3"  "4"  "5"  "6"  "7"  "8"  "9"  ":"  ";"
591       "<"  "="  ">"  "?"  "@"  "A"  "Any"  "B"  "BackSpace"  "Backspace"  "C"
592       "C-a"  "C-b"  "C-c"  "C-d"  "C-e"  "C-f"  "C-g"  "C-h"  "C-i"  "C-j"
593       "C-k"  "C-l"  "C-m"  "C-n"  "C-o"  "C-p"  "C-q"  "C-r"  "C-s"  "C-t"
594       "C-u"  "C-v"  "C-w"  "C-x"  "C-y"  "C-z"  "D"  "Del"  "Down"  "E"
595       "End"  "Enter"  "Esc"  "F"  "F1"  "F10"  "F11"  "F12"  "F2"  "F3"  "F4"
596       "F5"  "F6"  "F7"  "F8"  "F9"  "G"  "H"  "Home"  "I"  "Ins"  "J"  "K"
597       "L"  "Left"  "M"  "N"  "O"  "P"  "PageDown"  "PageUp"  "Q"  "R"
598       "Right"  "S"  "T"  "Tab"  "U"  "Up"  "V"  "W"  "X"  "Y"  "Z"  "["  "\"
599       "]"  "^"  "_"  "`"  "a"  "b"  "c"  "d"  "e"  "f"  "g"  "h"  "i"  "j"
600       "k"  "l"  "m"  "n"  "o"  "p"  "q"  "r"  "s"  "t"  "u"  "v"  "w"  "x"
601       "y"  "z"  "{"  "|"  "}"  "~"
602
603

AUTOCOMMANDS REFERENCE

605       Available autocommands are: PreScale, PostScale, PrePan, PostPan, Pre‐
606       Redisplay, PostRedisplay, PreDisplay, PostDisplay, PrePrefetch, Post‐
607       Prefetch, PreReload, PostReload, PreLoad, PostLoad, PreGoto, PostGoto,
608       PreConfigLoading, PostConfigLoading, PreHardcodedConfigLoading,
609       PostHardcodedConfigLoading, PreUserConfigLoading, PostUserConfigLoad‐
610       ing, PreGlobalConfigLoading, PostGlobalConfigLoading, PreInterac‐
611       tiveCommand, PostInteractiveCommand, PreExecutionCycle, PostExecution‐
612       Cycle, PreExecutionCycleArgs, PreWindow, PostWindow,  and they are
613       triggered on actions as suggested by their name.
614        Those associated to actual commands are mentioned in the associated
615       commands reference.
616

VARIABLES REFERENCE

618       If undeclared, a variable will evaluate to 0.
619
620       When assigning a variable to a string, use single or double quoting,
621       otherwise it will be treated as a number.
622
623       The namespaces in which variables may exist are: current image, global.
624       A namespace is specified by a prefix, which can be: 'i:', be prepended
625       to the variable name. The global namespace is equivalent to the empty
626       one:''. The special variable i:* expands to the collation of all the
627       name-value pairs for the current image.
628
629       In the following, the [internal] variables are the ones referenced in
630       the source code (not including the hardcoded configuration, which may
631       be inspected and/or invalidated by the user at runtime).
632
633       _TERM [out,g:] the environment TERM variable.
634       __exif_flipped [out,i:] flipping information, read from the EXIF tags
635       of a given image.
636       __exif_mirrored [out,i:] mirroring information, read from the EXIF tags
637       of a given image.
638       __exif_orientation [out,i:] orientation information in the same format
639       of _orientation, read from the orientation EXIF tags (i:EXIF_Orienta‐
640       tion).
641       _all_file_loaders [out,g:] space-separated list of hardcoded file load‐
642       ers usable with _file_loader.
643       _archive_files [in,g:] Regular expression matching filenames to be
644       treated as (multipage) archives. If empty,
645       ".(RAR|ZIP|TAR|TAR.GZ|TGZ|TAR.BZ2|TBZ|TBZ2|CBR|CBZ|LHA|7Z|XAR|ISO)$"
646       will be used. Within each archive, only filenames matching the regular
647       expression in the _pushdir_re variable will be considered for opening.
648       _autocmd_trace_stack [in,g:] dump to stdout autocommands (autocmd)
649       stack trace during their execution (for debugging purposes).
650       _autodesaturate [in,g:] if 1, will desaturate images by default.
651       _autoflip [in,g:] if 1, will flip images by default.
652       _automirror [in,g:] if 1, will mirror images by default.
653       _autonegate [in,g:] if 1, will negate images by default.
654       _autotop [in,g:] if 1, will align to the top freshly loaded images.
655       _buffered_in_tmpfile [out,i:] if an image has been temporarily con‐
656       verted and decoded from a temporary file, its name is here.
657       _cache_control [in,g:] string for cache control. if it starts with 'm'
658       mipmaps will be cached; if it starts with 'M' then not. otherwise de‐
659       faults will apply.
660       _cache_status [out,g:] string with current information on cache status.
661       _cached_images [out,g:] the number of images currently cached.
662       _caption_over_image [in,g:] if set not to 0, will display a custom com‐
663       ment string specified according to the value of_caption_over_image_fmt;
664       if larger than 1, with black background; if 3, image will be drawn pos‐
665       sibly below. It will take at most half of the screen.
666       _caption_over_image_fmt [in,g:] custom info format string, displayed in
667       a caption over the image; if unset: i:_comment; otherwise a custom for‐
668       mat string specified just as _info_fmt_str.
669       _command_expansion [in,g:] if 1, will enable autocompletion (on execu‐
670       tion) of alias and command strings.
671       _comment [i:,out] the image comment, extracted from the image file (if
672       any).
673       _console_buffer_free [out,g:] amount of unused memory in the output
674       console buffer.
675       _console_buffer_total [out,g:] amount of memory allocated for the out‐
676       put console buffer.
677       _console_buffer_used [out,g:] amount of used memory in the output con‐
678       sole buffer.
679       _console_key [in,g:] the key binding (an integer variable) for spawning
680       the command line; will have precedence over any other binding.
681       _console_lines [out,g:] the number of buffered output console text
682       lines.
683       _console_offset [in,out,g:] position of the text beginning in the out‐
684       put console, expressed in lines.
685       _debug_commands [in,g:] debugging option string for printing out . if
686       containing 'a', print out autocmd info; if containing 'c', print out
687       each command; if containing 'k', print out each pressed key; if con‐
688       taining 'j', print interpreter internal steps; if containing 'B', clear
689       screen and print background loading files; if containing 'C', print
690       cache activity.
691       _device_string [out,g:] the current display device string.
692       _display_as_binary [in,g:] will force loading of the specified files as
693       pixelmaps (no image decoding will be performed); if 1, using one bit
694       per pixel;  if 24, using 24 bits per pixel; otherwise will load and de‐
695       code the files as usual.
696       _display_as_rendered_text [in,g:] will force loading of the specified
697       files as text files (no image decoding will be performed); if 1; other‐
698       wise will load and decode the files as usual.
699       _display_busy [in,g:] if 1, will display a message on the status bar
700       when processing.
701       _display_console [in,g:] if 1, will display the output console.
702       _display_status [in,g:] if 1, will display the status bar.
703       _display_status_bar [in,g:] if 1, will display the status bar.
704       _display_status_fmt [in,g:] custom info format string, displayed in the
705       lower left corner of the status bar; if unset: full pathname; otherwise
706       a custom format string specified just as _info_fmt_str.
707       _do_sanity_check [in,experimental,g:] if 1, will execute a sanity check
708       on startup.
709       _downscale_huge_at_load [in,g:] if 1, will downscale automatically huge
710       images at load time.
711       _exiftool_comment [out,g:] comment extracted via the exiftool inter‐
712       face; see _use_exiftool.
713       _fbfont [out,g:] The current console font file string. If the internal
714       hardcoded font has been used, then its value is "fim://".
715       _fbfont_as_screen_fraction [in,g:] The rendered text will be scaled at
716       least to this (integer) fraction of the screen. Disable font autoscal‐
717       ing with -1. (Only enabled if configured with --with-font-magnify‐
718       ing-factor=FACTOR, with FACTOR<1).
719       _fbfont_magnify_factor [in,g:] The rendered text will use a font magni‐
720       fied by this (integer) factor. Maximal value is "16". (Only enabled if
721       configured with --with-font-magnifying-factor=FACTOR, with FACTOR<1).
722       _fbfont_verbosity [in,g:] if > 0, verbose font loading
723       _file_load_time [out,i:] time taken to load the file and decode the im‐
724       age, in seconds.
725       _file_loader [in,i:,g:] if not empty, this string will force a file
726       loader (among the ones listed in the -V switch output); [out]
727       i:_file_loader stores the loader of the current image.
728       _fileindex [out,g:] the current image numeric index.
729       _filelistlen [out,g:] current image list length (number of visible im‐
730       ages).
731       _filename [out,i:] the current file name string.
732       _fim_bpp [out,g:] the bits per pixel count.
733       _fim_default_config_file_contents [out,g:] the contents of the default
734       (hardcoded) configuration file (executed after the minimal hardcoded
735       config).
736       _fim_default_grammar_file_contents [out,g:] the contents of the default
737       (hardcoded) grammar file.
738       _fim_scriptout_file [in,g:] the name of the file to write to when
739       recording sessions.
740       _fim_version [out,g:] fim version number; may be used for keeping com‐
741       patibility of fim scripts across evolving versions.
742       _hsteps [in,g:] the default steps, in pixels, when panning images hori‐
743       zontally (overrides steps).
744       _ignorecase [in,g:] if 1, will allow for case insensitive regexp-based
745       match in autocommands (autocmd).
746       _info_fmt_str [in,g:] custom info format string, displayed in the lower
747       right corner of the status bar; may contain ordinary text and special
748       'expando' sequences. These are: %p for current scale, in percentage; %w
749       for width; %h for height; %i for image index in list; %k for the value
750       of i:_comment (comment description) variable in square brackets; %l for
751       current image list length; %L for flip/mirror/orientation information;
752       %P for page information; %F for file size; %M for screen image memory
753       size; %m for memory used by mipmap; %C for memory used by cache; %T for
754       total memory used (approximation); %R for total max memory used (as de‐
755       tected by getrusage()); %n for the current file path name; %N for the
756       current file path name basename; ; %c for centering information; %v for
757       the fim program/version identifier string; %% for an ordinary %. A se‐
758       quence like %?VAR?EXP? expands to EXP if i:VAR is set; EXP will be
759       copied verbatim except for contained sequences of the form %:VAR:,
760       which will be expanded to the value of variable i:VAR; this is meant to
761       be used like in e.g. '%?EXIF_DateTimeOriginal?[%:EXIF_DateTimeOrigi‐
762       nal:]?', where the EXIF-set variable EXIF_DateTimeOriginal (make sure
763       you have libexif for this) will be used only if present.
764       _inhibit_display [internal,g:] if 1, will inhibit display.
765       _last_cmd_output [out,experimental,g:] the last command output.
766       _last_file_loader [out,g:] after each image load, _last_file_loader
767       will be set to the last file loader used.
768       _last_system_output [out,experimental,g:] the standard output of the
769       last call to the system command.
770       _lastfileindex [out,g:] the last visited image numeric index. Useful
771       for jumping back and forth easily between two images with 'goto _last‐
772       fileindex'.
773       _lastgotodirection [out,g:] the last file goto direction (either string
774       '+1' or string '-1').
775       _load_default_etc_fimrc [in,g:] if 1 at startup, will load the system
776       wide initialization file.
777       _load_fim_history [in,g:] if 1 on startup, will load the ~/.fim_history
778       file on startup.
779       _load_hidden_dirs [in,g:] if not 1, when pushing directories/files,
780       those whose name begins with a dot (.) will be skipped.
781       _loading_in_background [out,g:] 1 if program has been invoked with
782       --background-recursive and still loading in background.
783       _loop_only_once [internal,g:] if 1 and doing a --slideshow, do it once.
784       _lwidth [in,g:] if>0, will force the output console text width.
785       _magnify_factor [in,g:] the image scale multiplier used when magnifying
786       images size.
787       _max_cached_images [in,g:] the maximum number of images after which
788       evictions will be forced. Setting this to 0 (no limits) is ok provided
789       _max_cached_memory is set meaningfully.
790       _max_cached_memory [in,g:] the maximum amount of memory (in KiB) at
791       which images will be continued being added to the cache. Setting this
792       to 0 (no limit) will lead to a crash (there is no protection cur‐
793       rently).
794       _max_iterated_commands [g:] the iteration limit for N in "N[command‐
795       name]" iterated command invocations.
796       _min_cached_images [in,g:] the minimum number of images to keep from
797       eviction; if less than four can lead to inefficiencies: e.g. when jump‐
798       ing between two images, each time an erase and a prefetch of neighbor‐
799       ing images would trigger. default value is 4.
800       _no_default_configuration [in,g:] if 0, a default, hardcoded configura‐
801       tion will be executed at startup, after the minimal hardcoded one.
802       _no_external_loader_programs [in,g:] if 1, no external loading programs
803       will be tried for piping in an unsupported type image file.
804       _no_rc_file [in,g:] if 1, the ~/.fimrc file will not be loaded at
805       startup.
806       _open_offset [in,optional,g:,i:] offset (specified in bytes) used when
807       opening a file; [out] i:_open_offset will be assigned to images opened
808       at a nonzero offset.
809       _open_offset_retry [in,optional,g:] number of adjacent bytes to probe
810       in opening the file.
811       _orientation [internal,i:] Orthogonal clockwise rotation (orientation)
812       is controlled by: 'i:_orientation', 'g:_orientation' and applied on a
813       per-image basis. In particular, the values of the three variables are
814       summed up and the sum is interpreted as the image orientation.  If the
815       sum is 0, no rotation will apply; if it is 1, a single ( 90') rotation
816       will apply; if it is 2, a double (180') rotation will apply; if it is
817       3, a triple (270') rotation will apply.  If the sum is not one of
818       0,1,2,3, the value of the sum modulo 4 is considered.  Therefore,
819       ":i:_orientation=1" and ":i:_orientation=5" are equivalent: they rotate
820       the image one time by 90'.
821       _pread_cmd [in,g:] a user-specified shell command emitting an image on
822       stdout, in a format readable by the convert utility. If the current
823       filename matches "^[/A-Za-z0-9_.][/A-Za-z0-9_.-]*$", it will be substi‐
824       tuted to any occurrence of '{}'.
825       _preferred_rendering_dpi [in,optional,g:] if >0, pdf, ps, djvu render‐
826       ing will use this value for a default document dpi (instead of a de‐
827       fault value).
828       _preferred_rendering_width [in,optional,g:] if >0, bit based rendering
829       will use this value for a default document width (instead of a default
830       value).
831       _push_checks [in,experimental,g:] if 1 (default), will check with
832       stat() existence of input files before push'ing them (set this to 0 to
833       speed up loading very long file lists; in these cases a trailing slash
834       (/) will have to be used to tell fim a pathname is a directory). This
835       only works after initialization (thus, after command line files have
836       been push'ed); use --no-stat-push if you wish to set this to 0 at com‐
837       mand line files specification.
838       _push_pushes_dirs [in,g:] if 1, the push command will also accept and
839       push directories (using pushdir). if 2, will also push hidden files/di‐
840       rectories, that is, ones whose names begin with a dot (.).
841       _pushdir_re [in] regular expression to match against when pushing files
842       from a directory or an archive. By default this is
843       ".(JPG|PNG|GIF|BMP|TIFF|TIF|JPEG|JFIF|PPM|PGM|PBM|PCX|WEBP)$".
844       _pwd [out,g:] the current working directory; will be updated at startup
845       and whenever the working directory changes.
846       _re_search_opts [in,g:] affects regexp-based searches; if an empty
847       string, defaults will apply; if contains 'i' ('I'), case insensitive
848       (sensitive) searches will occur; if contains 'b', will match on base‐
849       name, if contains 'f' on full pathname.
850       _reduce_factor [in,g:] the image scale multiplier used when reducing
851       images size.
852       _retry_loader_probe [in,g:] if 1 and user specified a file loader and
853       this fails, will probe for a different loader.
854       _rows [in,g:] if >0, will set the number of displayed text lines in the
855       console.
856       _save_fim_history [in,g:] if 1 on exit, will save the ~/.fim_history
857       file on exit.
858       _scale_factor_delta [in,g:] value used for incrementing/decrementing
859       the scaling factors.
860       _scale_factor_multiplier [in,g:] value used for scaling up/down the
861       scaling factors.
862       _scale_style [in,g:] if non empty, this string will be fed to the scale
863       command; see its documentation for possible values.
864       _screen_height [out] the screen height.
865       _screen_width [out,g:] the screen width.
866       _scroll_skip_page_fraction [int,g:] if >1, fraction of page which will
867       be skipped in when scrolling (e.g. 'scrollforward'); if 1, auto chosen;
868       if <1, disabled.
869       _seek_magic [optional,g:] will seek a 'magic' signature in the file af‐
870       ter opening it, and will try decoding it starting within the range of
871       that signature (use like this: fim -C '_seek_magic=MAGIC_STRING;push
872       filename').
873       _status_line [in,g:] if 1, will display the status bar.
874       _steps [in,g:] the default steps, in pixels, when panning images.
875       _sys_rc_file [in,g:] string with the global configuration file name.
876       _use_exiftool [in,g:] if >0 and supported, exiftool will be used to get
877       additional information. if 1, this will be appened to _comment; if 2,
878       will go to _exiftool_comment.
879       _use_mipmaps [in,g:] if >0, will use mipmaps to speed up downscaling of
880       images (this has a memory overhead equivalent to one image copy);
881       mipmaps will not be cached. If 2, will use every fourth source pixel
882       instead of averaging (good for photos, not for graphs).
883       _verbose_errors [in,g:] if 1, will display on stdout internal errors,
884       while parsing commands.
885       _verbose_keys [in,g:] if 1, after each interactive mode key hit, the
886       console will display the hit key raw keycode.
887       _verbosity [in,experimental,g:] program verbosity.
888       _vsteps [in,g:] the default steps, in pixels, when panning images ver‐
889       tically (overrides steps).
890       _want_autocenter [in,g:] if 1, the image will be displayed centered.
891       _want_exif_orientation [in,g:] if 1, will reorient images using infor‐
892       mation from EXIF metadata (and stored in in __exif_orientation,
893       __exif_mirrored, __exif_flipped ).
894       _want_prefetch [in,g:] if 1, will prefetch further files just after
895       display of the first file; if 2 (and configured with --enable-cxx11)
896       will load in the background.
897       _want_sleep_seconds [in,g:] number of seconds of sleep during slideshow
898       mode.
899       _want_wm_caption_status [in,g:] this works only if supported by the
900       display device (currently only SDL). if set to a number that is not 0,
901       will show the status (or command) line in the window manager caption;
902       if set to a non-empty string, will interpret it just as a file info
903       format string (see _info_fmt_str); if empty, will show the program ver‐
904       sion.
905       _want_wm_mouse_ctrl [in,g:] if at least 9 chars long, enable mouse
906       click/movement behaviour when in SDL mode; the 9 chars will correspond
907       to a 3x3 screen clickable grid and the equivalent command keys; click‐
908       ing middle or right button will toggle on-screen usage info.
909       angle [in,out,i:] a floating point number specifying the rotation an‐
910       gle, in degrees.
911       ascale [in,out,i:] the asymmetric scaling of the current image.
912       desaturated [out,i:] 1, if the image is desaturated.
913       flipped [out,i:] 1, if the image is flipped.
914       fresh [in,out,i:,experimental] 1 if the image was loaded, before all
915       autocommands (autocmd) execution.
916       height [out,i:] the current image original height.
917       mirrored [out,i:] 1, if the image is mirrored.
918       negated [out,i:] 1, if the image is negated.
919       page [out,experimental,g:] the current page.
920       pages [out,experimental,i:] the current number of pages of an image.
921       random [out] a pseudorandom number.
922       scale [in,i:] the scale of the current image.
923       sheight [out,i:] the current image scaled height.
924       swidth [out,i:] the current image scaled width.
925       width [out,i:] the current image original width.
926

DEFAULT ALIASES REFERENCE

928       Hardcoded aliases are:
929
930       alias "A" "'_autotop=1-_autotop;'"
931       alias "magnify" "scale '+'" # magnify the displayed image by the _mag‐
932       nify_factor variable or {args}
933       alias "next" "goto '+1'" # go to the next page or picture file
934       alias "next_file" "goto '+1f'" # go to the next file in the list
935       alias "next_page" "goto '+1p'" # go to the next page in the file
936       alias "prev" "goto '-1'" # go to the previous page or picture file
937       alias "prev_file" "goto '-1f'" # go to the previous file in the list
938       alias "prev_page" "goto '-1p'" # go to the previous page in the file
939       alias "reduce" "scale '-'" # reduce the displayed image by _reduce_fac‐
940       tor or {args}
941       alias "scale_factor_decrease" "scale '+-'" # subtract _scale_fac‐
942       tor_delta to the scale factors _reduce_factor and _magnify_factor
943       alias "scale_factor_grow" "scale '+*'" # multiply the scale factors
944       _reduce_factor and _magnify_factor by _scale_factor_multiplier
945       alias "scale_factor_increase" "scale '++'" # add _scale_factor_delta to
946       the scale factors _reduce_factor and _magnify_factor
947       alias "scale_factor_shrink" "scale '+/'" # divide the scale factors
948       _reduce_factor and _magnify_factor by _scale_factor_multiplier
949
950       They can be redefined with alias or deleted with the unalias command.
951       Further default aliases are usually loaded at startup -- see the CON‐
952       FIGURATION FILE EXAMPLE section below.
953

COMMAND LINE USAGE EXAMPLES

955       # jump to the third image:
956       3;
957       # jump to first image:
958       ^;
959       # jump to last image:
960       $;
961       # magnify the image two times:
962       *2;
963       # scale the image to the 30% of the original:
964       30%;
965       # scale the image up by 30%:
966       +30%;
967       # scale the image down by 30%:
968       -30%;
969       # jump to the next image whose filename matches the ".*jpg" regular expression:
970       /.*jpg;
971       # executes the "date" system command
972       !"date";
973
974

CONFIGURATION FILE EXAMPLE

976       Part of the default configuration comes from the _fim_default_con‐
977       fig_file_contents variable, shown here.
978       One can skip its loading by using the _no_default_configuration variable.
979
980       # $LastChangedDate: 2023-03-09 00:38:06 +0100 (Thu, 09 Mar 2023) $
981       # Contents of the default 'fimrc' file, hardcoded in the fim executable.
982       # Read the documentation (man fimrc) to discover how to change this default hardcoded file and how to make your own.
983       # Note that usually a ~/.fimrc file is read after these options take effect, so you could reset all of this with ease.
984       # Lines beginning with a pound (#) are ignored by fim (they are treated as comments).
985       #
986       # Internal variables.
987       # Some of these variables influence fim's behaviour (input variables), some are set by fim (output variables).
988       # It is wise the input variables are set at the beginning of the file, so the bottom may issue commands correctly affected by them.
989       if(_cache_control==''){_cache_control='m';}
990       if(_debug_commands==''){_debug_commands='';}
991       if(_command_expansion==''){_command_expansion=1;}
992       if(_display_status==''){_display_status=0;}
993       if(_max_cached_images==''){_max_cached_images=5;}
994       if(_min_cached_images==''){_min_cached_images=4;}
995       if(_max_cached_memory==''){_max_cached_memory=81920;}
996       if(_max_iterated_commands==''){_max_iterated_commands=100;}
997       if(_want_prefetch==''){_want_prefetch=1;}
998       if(_no_external_loader_programs==''){_no_external_loader_programs=0;}
999       if(_scale_style==''){_scale_style='b';}
1000       if(_save_fim_history==''){_save_fim_history=1;}
1001       if(_load_fim_history==''){_load_fim_history=1;}
1002       if(_verbose_keys==''){_verbose_keys=0;}
1003       if(_display_busy==''){_display_busy=1;}
1004       if(_ignorecase==''){_ignorecase=1;}
1005       if(_re_search_opts==''){_re_search_opts='bi';}
1006       if(_console_offset==''){_console_offset=0;}
1007       if(_console_key==''){_console_key=58;}
1008       if(_display_as_binary==''){_display_as_binary=0;}
1009       if(_push_checks==''){_push_checks=1;}
1010       #if(_want_wm_caption_status==''){_want_wm_caption_status=0;}
1011       if(_want_exif_orientation==''){_want_exif_orientation=1;}
1012       if(ascale==''){ascale="1.0";}
1013       if(_use_mipmaps==''){_use_mipmaps=1;}
1014       if(_downscale_huge_at_load==''){_downscale_huge_at_load=1;}
1015       if(_scroll_skip_page_fraction==''){_scroll_skip_page_fraction=0;}
1016       if(_want_wm_mouse_ctrl==''){_want_wm_mouse_ctrl="'pP+a-=nN";}
1017       #
1018       # External variables (not used internally).
1019       if(allow_round_scroll==''){allow_round_scroll=0;}
1020       if(console_scroll_n==''){console_scroll_n=3;}
1021       #
1022       alias "toggleautoflip" "_autoflip=1-_autoflip" "";
1023       alias "toggleautonegate" "_autonegate=1-_autonegate" "";
1024       alias "toggleflip" "i:flipped=1-i:flipped" "toggles flipped property on the current image";
1025       alias "flip" "toggleflip;redisplay"        "flip the current image along the horizontal axis";
1026       alias "fliponce" "flip;toggleflip"         "flip, but just for one display";
1027       alias "toggleautomirror" "_automirror=1-_automirror" "";
1028       alias "togglemirror" "i:mirrored=1-i:mirrored" "toggles mirrored property on the current image";
1029       alias "mirror" "togglemirror;redisplay"         "mirror the image along the vertical axis" "";
1030       alias "mirroronce" "mirror;togglemirror"        "mirror, but just for one display";
1031       alias 'toggleLimitMarked' '__pre_limit_fileindex=_fileindex;_limit_mode=1-_limit_mode; if(_limit_mode==1){limit "!";} else { limit; } if(_filelistlen<1){_limit_mode=0;limit;goto __pre_limit_fileindex;} i:fresh=1;redisplay; ' "toggle between limiting file list to the marked files and the full list";
1032       alias "unlimit" "limit" "calling limit with no arguments restores the original list";
1033       # Warning : binding to C-s, C-z and C-c won't make effect, as these
1034       # codes are get caught by the console driver and will have no effect in fim.
1035       # Moreover, C-z will crash fim and C-c will terminate it.
1036       # Some other combinations (e.g.:C-l) may have similar problems in your console.
1037       bind 'f' "flip";
1038       bind 'F' "fliponce";
1039       bind 'm' "mirror";
1040       bind 'M' "mirroronce";
1041       bind 'q'   "quit";
1042       bind 'Esc' "quit";
1043       #bind 'n' "next_file";
1044       #bind 'n' "next";
1045       bind 'C-h' "help";
1046       #bind '?' "help"; # assigned to back-search
1047       #bind '/' "help"; # assigned to forward-search
1048       bind '=' "scale '100%'";
1049       #bind 'p' "prev_file";
1050       bind 'Del' "list 'remove';reload";
1051       #bind 's' "list 'sort'";
1052       bind ' ' "scroll 'forward'";
1053       bind 'S' "toggleDisplayStatus";
1054       bind 'I' "toggleautonegate";
1055       bind 'i' "color 'negate';redisplay";
1056       bind 'g' "color 'desaturate';redisplay";
1057       bind '[' 'font_reduce;redisplay';
1058       bind ']' 'font_magnify;redisplay';
1059       bind '|' 'toggle_font_auto_scale;redisplay';
1060       bind '{' 'font "prev";redisplay';
1061       bind '}' 'font "next";redisplay';
1062       bind 'G' "toggleDesaturate";
1063       bind 'r' "rotate90";
1064       bind 'R' "rotate270";
1065       bind '+' "magnify";
1066       bind 'a' "scale 'a'";
1067       bind 'H' "scale 'H'";
1068       bind 'Tab'  "toggleVerbosity";
1069       bind 'Menu' "toggleVerbosity";
1070       bind 'v' "toggleDisplayStatus";
1071       bind 'A' "A";
1072       bind 'C-m' "list 'mark'";
1073       bind 'u'   "list 'unmark'";
1074       bind 'Enter' "list 'mark';goto _lastgotodirection";
1075       bind '-' "reduce";
1076       bind "Up" "pan_up";
1077       bind 'k' "pan_up";
1078       bind "Right" "pan_right";
1079       bind 'l' "pan_right";
1080       bind "Down" "pan_down";
1081       bind 'j' "pan_down";
1082       bind "Left" "pan_left";
1083       bind 'h' "pan_left";
1084       bind 't' "align 'top'";
1085       bind 'C-g' "system 'fbgrab' 'fim_'._device_string.'.png'"; # grab a screenshot
1086       #bind 'C-r' "recording 'start'";
1087       bind 'C-r' "reload ''";
1088       bind 'Q' "recording 'stop'";
1089       bind 'D' "recording 'dump'";
1090       bind 'E' "recording 'execute'";
1091       bind 'C-e' "recording 'execute'";
1092       bind 'C-x' "recording 'execute'";
1093       bind '.' "recording 'repeat_last'";
1094       bind '`' "toggleLimitMarked";
1095       alias "toggleVerbosity" "_display_console=1-_display_console;i:fresh=1;redisplay" "";
1096       alias "toggleKeyVerbosity" "_verbose_keys=1-_verbose_keys;redisplay" "";
1097       alias "toggleDesaturate" "_autodesaturate=1-_autodesaturate;redisplay" "";
1098       alias "idempotent_cmd" "goto ''";
1099       #
1100       # Autocommands examples:
1101       #autocmd "PostInteractiveCommand" "fim.png" "echo '\nmatched an interactive command on fim.png\n'";
1102       #autocmd "PostDisplay" ".*png" "echo 'this is a png file'";
1103       #autocmd "PostDisplay" ".*jpg" "echo 'this is a jpg file'";
1104       #autocmd "PostDisplay" "" "echo '\nthis is a file\n'";
1105       #autocmd "PostGoto"   "" "set_interactive_mode";
1106       autocmd "PostGoto"      "" "reload";
1107       autocmd "PostWindow" ""   "i:fresh=1;redisplay;";
1108       autocmd "PreRedisplay"  "" "i:_will_display=1";
1109       autocmd "PreRedisplay"  "" "if(_scale_style!='' && i:fresh){i:fresh=0;scale _scale_style ;i:fresh=0;}";
1110       autocmd "PostRedisplay" ""   "i:_will_display=0";
1111       # Display device specific config
1112       alias "aalib_fix_do" "{if(aascale==''){ascale='2.0';}else{ascale=aascale;} i:fresh=1;display;if(_TERM=~'screen'){echo 'screen+aalib?expect binding problems!'}}" "See aalib_fix.";
1113       alias "aalib_fix" "if(_device_string=='aa'){aalib_fix_do;scale 'a';}" "When using the aalib (ASCII art) library we face a problem: glyph proportions are seldom square (as pixels are), and are tricky to detect; for this reason, we need to reshape the image with respect to the font ratio, but we have to make a guess in the scaling factor to compensate. If at runtime a better value is known for the terminal font height/with ratio, it may be fed in the 'aascale' variable for an accurate scaling.";
1114       alias "cacalib_fix_do" "{if(cacascale==''){ascale='1.18';}else{scale=cacascale;} i:fresh=1;display;if(_TERM=~'screen'){echo 'screen+cacalib?expect binding problems!'}}" "See cacalib_fix.";
1115       alias "cacalib_fix" "getenv 'DISPLAY';if(_device_string=='caca' && ENV_DISPLAY==''){cacalib_fix_do;scale 'a';}" "When using the libcaca (Coloured ASCII art) library we face a problem: glyph proportions are seldom square (as pixels are), and are tricky to detect; for this reason, we need to reshape the image with respect to the font ratio, but we have to make a guess in the scaling factor to compensate. If at runtime a better value is known for the terminal font height/with ratio, it may be fed in the 'cacascale' variable for an accurate scaling.";
1116       autocmd "PostReload"  "" "aalib_fix";
1117       autocmd "PostLoad"    "" "aalib_fix";
1118       autocmd "PostReload"  "" "cacalib_fix";
1119       autocmd "PostLoad"    "" "cacalib_fix";
1120       alias "refresh" "desc 'reload';redisplay;" "reloads and displays image description";
1121       bind "F5" "refresh";
1122       bind "F11" "if(_device_string=='sdl' && !_fullscreen){_old_sw=_screen_width;_old_sh=_screen_height;display 'reinit' 'mW0:0';_fullscreen=1;}else if(_device_string=='sdl' && _old_sw*_old_sh*_fullscreen){display 'reinit' 'rwm'._old_sw.':'._old_sh;_fullscreen=0;}" "Toggles full screen. Will show mouse cursor in full screen.";
1123
1124       autocmd "PostReload"  "" "i:fresh=1" ;
1125       autocmd "PostScale"   "" "if(0==i:_will_display){i:fresh=1;display;}" ;
1126       autocmd "PostPan"     "" "{i:fresh=1;display;}" ;
1127       autocmd "PostReload"   "" "if(i:fresh){redisplay;}";
1128       autocmd "PostInteractiveCommand"   "" "if(i:fresh){display;i:fresh=0;}";
1129       autocmd "PostInteractiveCommand"   "" "if(_want_prefetch>0){prefetch;}";
1130       autocmd "PostInteractiveCommand"   "" "if(_display_console==0 && i:fresh){redisplay;i:fresh=0;}";
1131       autocmd "PostInteractiveCommand"   "" "idempotent_cmd"; # Bug workaround: without it console scroll is broken.
1132
1133       alias "next10" "i=0;while(i<10){i=i+1;next;display;sleep '1';}" "goes forward 10 images";
1134       alias "prev10" "i=0;while(i<10){i=i+1;prev;display;sleep '1';}" "goes backward 10 images";
1135       bind 'N' 'next10';
1136       bind 'P' 'prev10';
1137       bind 'C-n' "goto '+//'";
1138       bind 'C-p' "goto '-//'";
1139       bind 'C-b' "goto '-//'"; # Warning: many configurations cannot detect C-b.
1140       bind 'W' "display 'resize'" "if supported, resizes the window to match the current image pixels size";
1141       #bind 'C-w' "scale '100%';display 'resize'" "if supported, scales the image to 100% and resizes the window to match its size (if fits)";
1142       bind 'C-w' "if(_scale_style!='w'){_scale_style='w';scale 'w';}else{_scale_style='';scale '100%';}" "scale to width";
1143       alias "endless_slideshow" "while(1){display;sleep '1';next;}" "performs an automated slideshow, endlessly";
1144       alias "bookview"          "while(1){display;sleep '2';scroll 'down';}" "";
1145       alias "comicview"         "while(1){display;sleep '1';scroll 'down';}" "";
1146       alias "read"              "while(1){display;sleep '1';scroll 'forward';}" "";
1147       alias "slowread"          "while(1){display;sleep '2';scroll 'forward';}" "";
1148       alias "fastread"          "while(1){display;scroll 'forward';}" "proceeds like in a book bug very fast";
1149       alias "pornview"          "echo 'press any key repeatedly to terminate' ;endless_slideshow" "enters an endless slideshow";
1150       autocmd "PreExecutionCycle" "/fbps-" "_display_busy=0;_display_status=0" ;
1151       autocmd "PreExecutionCycle" "" "i:fresh=1;reload";
1152       autocmd "PreExecutionCycle" "/fbps-.*ps001.png" "i:fresh=1;redisplay";
1153       ## Example in imposing a file loader to an extension:
1154       #autocmd "PreReload"    ".*mtx.gz" "_file_loader='MatrixMarket'";
1155       #autocmd "PostReload"   ".*mtx.gz" "_file_loader=''";
1156       bind '*' "_display_console=0;toggleVerbosity;echo i:*";
1157       bind 'w' "scale 'w'";
1158       bind '<' "rotate10_ccw;display";
1159       bind '>' "rotate10;display";
1160       bind '_' "_scale_style='';scale '100%'";
1161       bind ',' "_display_console=1;echo _last_system_output";
1162       bind 'C-a' "if(_scale_style!='a'){_scale_style='a';scale 'a';}else{_scale_style='';scale '100%';}" "scale to height";
1163       #
1164       alias "pan_nw" "pan 'nw'" "pans the image to the upper left";
1165       alias "pan_ne" "pan 'ne'" "pans the image to the upper right";
1166       alias "pan_se" "pan 'se'" "pans the image to the lower left";
1167       alias "pan_sw" "pan 'sw'" "pans the image to the lower right";
1168       alias "pan_down" "if(_display_console==0){pan 'down';}else{scd;}" "pans the image down / scrolls console down";
1169       alias "pan_up"   "if(_display_console==0){pan 'up'  ;}else{scu;}"   "pans the image up / scrolls console up";
1170       alias "pan_left" "pan 'left'" "pans the image left";
1171       alias "pan_right" "pan 'right'" "pans the image right";
1172       alias "diagonal_nw" "pan_nw" "pans the image to the upper left";
1173       alias "diagonal_ne" "pan_ne" "pans the image to the upper right";
1174       alias "diagonal_se" "pan_se" "pans the image to the lower left";
1175       alias "diagonal_sw" "pan_sw" "pans the image to the lower right";
1176       bind 'd' "diagonal_nw";
1177       bind 'D' "diagonal_se";
1178       bind 'x' "diagonal_ne";
1179       bind 'X' "diagonal_sw";
1180       alias "toggleDisplayStatus" "_display_status=1-_display_status;redisplay" "";
1181       alias "toggleDisplayBusy"   "_display_busy=1-_display_busy" "";
1182       alias "sort" "list 'sort'"  "sorts the files list ordered";
1183       bind 'o' "sort";
1184       bind 'b' "prev";
1185       bind 'B' "toggleDisplayBusy";
1186       alias "random_slideshow" "while(1){goto random;}" "performs a shuffled slideshow";
1187       alias "rotate90_ccw" "i:_orientation=i:_orientation+3;i:fresh=1;i:fresh=1;redisplay" "rotate 90 degrees counter clockwise";
1188       alias "rotate90_cw"  "i:_orientation=i:_orientation+1;i:fresh=1;i:fresh=1;redisplay" "rotate 90 degrees clockwise";
1189       alias "rotate180"  "i:_orientation=i:_orientation+2;i:fresh=1;i:fresh=1;redisplay" "rotate 180 degrees";
1190       alias "rotate90" "rotate90_cw;display" "rotate 90 degrees clockwise";
1191       alias "rotate270" "rotate90_ccw;display" "rotate 90 degrees counter clockwise";
1192       alias "rotate10"     "rotate  '10';display" "rotate 10 degrees counter clockwise";
1193       alias "rotate10_ccw" "rotate -10  ;display" "rotate 10 degrees clockwise";
1194
1195       bind 'K' 'if(_display_console==0){echo i:_filename.": ".i:_comment;toggleVerbosity}else{toggleVerbosity;}';
1196       bind 'C-k' 'crop' # still experimental
1197
1198       alias 'cache' 'echo _cache_status' "displays cached images status";
1199       bind 'c' 'align "center"';
1200       alias 'widen'  'i:ascale=i:ascale*"1.1";*1.0' "widen the current image";
1201       alias 'narrow' 'i:ascale=i:ascale/"1.1";*1.0' "narrow the current image";
1202       bind  'y' "widen" "widen horizontally the image";
1203       bind  'Y' "narrow" "shrink horizontally the image";
1204       alias 'console_scroll_up' 'if(_console_offset<_console_lines+console_scroll_n-_rows){_console_offset=_console_offset+console_scroll_n;}' "scrolls up the virtual console";
1205       alias 'console_scroll_down' 'if(allow_round_scroll || (_console_offset>=console_scroll_n)){_console_offset=_console_offset-console_scroll_n;}' "scrolls down the virtual console";
1206       alias 'console_scroll_reset' '{_console_offset=0;}';
1207       alias 'scu'    'console_scroll_up'   "";
1208       alias 'scd'    'console_scroll_down' "";
1209       alias 'scz'    'console_scroll_reset' "";
1210       alias 'center' 'align "center"';
1211       alias 'left'   'align "left"';
1212       alias 'right'  'align "right"';
1213       alias 'top'    'align "top"';
1214       alias 'bottom' 'align "bottom"';
1215       alias "font_magnify_auto" "if(_fbfont_as_screen_fraction>1){_fbfont_as_screen_fraction=_fbfont_as_screen_fraction-1;}else{_fbfont_as_screen_fraction=_screen_width/100+_screen_height/100;}" "";
1216       alias "font_magnify_manual"      "_fbfont_magnify_factor=_fbfont_magnify_factor+1" "";
1217       alias "font_reduce_auto"  "if(_fbfont_as_screen_fraction>1){_fbfont_as_screen_fraction=_fbfont_as_screen_fraction+1;}" "";
1218       alias "font_reduce_manual"       "_fbfont_magnify_factor=_fbfont_magnify_factor-1" "";
1219       alias "toggle_font_auto_scale" "if(_fbfont_as_screen_fraction<0){_fbfont_as_screen_fraction=0;echo 'Auto font scaling on.';}else{_fbfont_as_screen_fraction=-1;echo 'Auto font scaling off.';}" "toggles between manual and auto font scaling control";
1220       alias 'next_file_dir_same'      "goto '+/s';" "go to next file in same dir";
1221       alias 'next_file_dir_other'     "goto '+/S';" "go to next file in other dir";
1222       alias 'next_file_dir_up'        "goto '+/u';" "go to next file up the dir hierarchy";
1223       alias 'next_file_dir_down'      "goto '+/d';" "go to next file down the dir hierarchy";
1224       alias 'next_file_same_basename' "goto '+/b';" "go to next file with same basename";
1225       alias 'prev_file_dir_same'      "goto '-/s';" "go to prev file in same dir";
1226       alias 'prev_file_dir_other'     "goto '-/S';" "go to prev file in other dir";
1227       alias 'prev_file_dir_up'        "goto '-/u';" "go to prev file up the dir hierarchy";
1228       alias 'prev_file_dir_down'      "goto '-/d';" "go to prev file down the dir hierarchy";
1229       alias 'prev_file_same_basename' "goto '-/b';" "go to prev file with same basename";
1230       #alias "font_magnify" "if(_fbfont_as_screen_fraction<0) {font_magnify_manual;}else{font_magnify_auto;}" "increase font size (either relative or absolute)";
1231       #alias "font_reduce"  "if(_fbfont_as_screen_fraction<0) {font_reduce_manual;} else{font_reduce_auto;}"  "increase font size (either relative or absolute)";
1232       alias "font_magnify" "_fbfont_as_screen_fraction=-1;font_magnify_manual" "increase absolute font size and set manual font control";
1233       alias "font_reduce"  "_fbfont_as_screen_fraction=-1;font_reduce_manual"  "decrease absolute font size and set manual font control";
1234       bind "PageUp" "if(_display_console==0){prev;}else{scu;}";
1235       bind "PageDown" "if(_display_console==0){next;}else{scd;}";
1236       bind "Home" "0;";
1237       bind "End" "$;";
1238       bind "^" "0;";
1239       bind "$" "$;";
1240       #bind "Backspace" "prev"; # console code for C-h and Backspace is the same :-)
1241       bind "'" "goto _lastfileindex";
1242       bind '"' "scale 'shadow';i:fresh=1;redisplay;";
1243       bind '(' "goto '^p'";
1244       bind ')' "goto '$p'";
1245       bind 'Z' "sleep 1";
1246       _display_status=1; # lower status line
1247       _want_wm_caption_status="fim:%N@%p%%%L[%i/%l]";
1248       _info_fmt_str="%p%% %wx%h%L %i/%l%P %F %T %c"; # lower right line part
1249       #_display_status_fmt="%N:%k"; #
1250       _display_status_fmt="%N%?EXIF_DateTimeOriginal?[%:EXIF_DateTimeOriginal:]?%?EXIF_ExposureTime?[%:EXIF_ExposureTime:]?%?EXIF_FNumber?[%:EXIF_FNumber:]?%?EXIF_ApertureValue?[%:EXIF_ApertureValue:]?%?EXIF_ISOSpeedRatings?[ISO%:EXIF_ISOSpeedRatings:]?:%k"; # lower left line part
1251       #_fbfont_as_screen_fraction=-1; # disable auto font scaling
1252       echo "WELCOME: to switch to the command line interface press ':'";
1253       # More examples:
1254       #alias "plisten" 'popen "nc -l -p 9999 "' "executes fim commands coming from port 9999 on this computer";
1255       #alias "wlisten" "while(1){sleep;plisten;}" "listen to a pipe, endlessly";
1256       #alias "musicplay"  "system 'mpc' 'play'" "";
1257       #alias "musicpause" "system 'mpc' 'pause'" "";
1258       #alias "rdjpgcom" 'system "rdjpgcom" i:_filename';
1259       # offsetscan usage : need a mechanism for popping all images before.
1260       #alias "offsetscan" "while(i:width<1){list 'push' 'blob.jpg';stdout _open_offset ;_open_offset=_open_offset+1;reload;}";
1261       #alias "webcam" "pread 'vgrabbj -d /dev/video0'";
1262       #alias "webcam_cycle" "while(1){webcam;reload;sleep 1;}";
1263       # This is a FIM initialization file.
1264       # Without it FIM cannot work like it should.
1265       # Feel free to modify it, but with caution!
1266
1267

NOTES

1269       This manual page could be improved.  Certain side effects of commands
1270       are not documented.  Neither a formal description of the various com‐
1271       mands.  Interaction of commands and variables is also not completely
1272       documented.
1273

BUGS

1275       The fim language shall be more liberal with quoting.
1276

SEE ALSO

1278       fim(1), fimgs(1), regex(1).
1279

AUTHOR

1281       Michele Martone <dezperado _CUT_ autistici _CUT_ org>
1282
1284       See copyright notice in fim(1).
1285
1286
1287
1288
1289
1290                         (c) 2011-2023 Michele Martone                fimrc(5)
Impressum