File: FIM.html

package info (click to toggle)
fim 0.7.1-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,048 kB
  • sloc: cpp: 32,769; ansic: 4,507; makefile: 1,549; sh: 1,502; perl: 189; exp: 28; awk: 9
file content (1493 lines) | stat: -rw-r--r-- 61,016 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>FIM: FIM</title>
<link rel="stylesheet" href="fim-stylesheet.css" type="text/css">
</head>
<body>
<h2>FIM</h2>
<pre>
</pre><hr><pre><b class="vimtag">*<a name="FIM.TXT">FIM.TXT</a>*</b>   Tutorial &amp; Miscellaneous documentation for Fim
 last updated $Date: 2024-05-10 00:24:27 +0200 (Fri, 10 May 2024) $

			Fim - tutorial &amp; misc documentation

First of all, please view this text file in Vim with ':set syntax=help'.
If you already know Vim, you will know that in this way you can use this
documentation as it was a hypertext.
( or add "autocmd BufReadPost FIM.TXT set syntax=help" into your ~/.vimrc ! )
If you do not know Vim, you can find it at http://www.vim.org.
A  hypertextual version of this file (FIM.html) shall be also available
with your fim distribution.

Thank you for using this software; one can regard it as a 'hack',in
the sense it is an elaboration of the passionate work of multiple people.

Please <code class="note">note</code> that this documentation is <b class="vimtag">*<a name="not">not</a>*</b> complete, as Fim is still
evolving, and some changes as the exact language specifications are hard to
track and document. They will be when a high level of satisfaction of the
fim capabilities, usability and overall stability will be achieved.
Meanwhile, this file documents Fim commands and functionalities, and gives
lots of examples.
For a reference of Fim command line flags, see the man pages of Fim:

<code class="example"> man fim</code>
<code class="example"></code>
For a reference of Fim internal commands, see

<code class="example"> man fimrc</code>
<code class="example"></code>
For the documentation of the 'fimgs' script, see

<code class="example"> man fimgs</code>
<code class="example"></code>
The man pages are rich with examples.



IMPORTANT <code class="note">NOTE:</code>

This document will be eliminated/reconverted once all the relevant
information will be made available in the man pages, so it may be
outdated/obsolete.

The man pages are the authoritative documentation sources for fim.

Enjoy!

</pre><hr><pre>0. Introduction 						<b class="vimtag">*<a name="intro">intro</a>*</b>

      Fim Startup: to open an image, n framebuffer mode, place yourself in a
      Linux framebuffer console (that is, outside the X environment -- this
      is usually achieved by typing <code class="keystroke">CTRL-ALT</code>-F1 from within the X environment)
      and type:

<code class="example">	fim image.png</code>
<code class="example"></code>
You can be sure of being in a Linux framebuffer console by issuing.

<code class="example">	cat /dev/urandom &gt; /dev/fb0</code>
If randomly coloured pixels start appearing on the screen, it means that
you are in a framebuffer console and you have proper access rights to it.

If you have problems here, see the <b class="vimtag">*<a name="framebuffer">framebuffer</a>*</b> section.


      Fim Quickstart: to move the image around,
                    use the cursor keys, or "h" to go left,	       h   l
		    "j" to go down, "k" to go up, "l" to go right.	 j
   Get out of Fim:  Use ":q<code class="special">&lt;Enter&gt;</code>" (press ':', then 'q', then 'enter').
                    Or just press q (or Esc, or whatever you wish, thanks to
		    the <b class="vimtag">*<a name="key-bindings">key-bindings</a>*</b> capabilities.


Fim stands for Fbi IMproved.

Fbi is a |<a href="./FIM.html#framebuffer">framebuffer</a>| based image viewer by Gerd Hoffmann, and Fim is
primarily an interface rework applied roughly as a patch to it, and is an
idea and codework of Michele Martone.

The idea of making Fim came after long usage sessions of Vim and Fbi, and a
zest of science fiction inspiration.

The main purposes of Fim are to power up the features present in Fbi by adding
new ones, and achieve higher configurability and flexibility.

Ease of use and simplicity is a primary concern, too.
No programming language knowledge nor reading this manual is needed to use
FIM if you have already used Fbi once.

A basic tenet of configurability the freedom of managing and customize the
<b class="vimtag">*<a name="key-bindings">key-bindings</a>*</b> to one's tastes.
Fim has a mechanism for the creation of a |<code class="badlink">configuration</code>| file.
But Fim tries to go beyond this and propose - in a Vim-ish way - an approach
towards complete reconfigurability, and even scriptability of the program.
The inspiration for this comes from the use of the nicer software available
as free software, often characterized by extreme flexibility, configurability,
hackability. This concerns mainly text editors and mail user agents, but why
can't this apply to an image viewer, too ?

</pre><hr><pre>1. Index						<b class="vimtag">*<a name="index">index</a>*</b>

Introduction to Fim					<b class="vimtag">*<a name="ref">ref</a>*</b> <b class="vimtag">*<a name="reference">reference</a>*</b>

0. Introduction			|<a href="./FIM.html#intro">intro</a>|
1. Index			|<a href="./FIM.html#index">index</a>|
2. Fim on the Internet		|<a href="./FIM.html#internet">internet</a>|
2.1. Contact information	|<a href="./FIM.html#contact">contact</a>|
2.2. Help wanted		|<a href="./FIM.html#help-wanted">help-wanted</a>|
3. Installation, basic usage	|<a href="./FIM.html#basics">basics</a>|
3.1. Customization		|<a href="./FIM.html#customization">customization</a>|
3.2. Keyboard binding		|<a href="./FIM.html#keyboard">keyboard</a>|
3.3. The fimgs script		|<a href="./FIM.html#fimgs">fimgs</a>|
3.4. External scripting		|<a href="./FIM.html#scripting">scripting</a>|
3.5. System integration tips	|<a href="./FIM.html#tips">tips</a>|
4. Command Line Mode		|<a href="./FIM.html#cli">cli</a>|
5. Command Line Mode Basics	|<a href="./FIM.html#cli-basics">cli-basics</a>|
6. Commands Reference		|<a href="./FIM.html#commands-reference">commands-reference</a>|
6.1. Loading and browsing	|<a href="./FIM.html#commands-browsing">commands-browsing</a>|
6.2. Scaling, flipping, rotating|<a href="./FIM.html#commands-scaling">commands-scaling</a>|
6.3. Panning,moving		|<a href="./FIM.html#commands-scroll">commands-scroll</a>|
6.4. Recording 			|<a href="./FIM.html#commands-recording">commands-recording</a>|
6.5. Console related commands	|<a href="./FIM.html#commands-console">commands-console</a>|
6.6. System Interaction		|<a href="./FIM.html#commands-system">commands-system</a>|
6.7. Variables			|<a href="./FIM.html#variables">variables</a>|
6.8. Autocommands		|<a href="./FIM.html#commands-autocommands">commands-autocommands</a>|
7. Command Line,More		|<a href="./FIM.html#cli-more">cli-more</a>|
7.1. Default configuration	|<a href="./FIM.html#default-config">default-config</a>|
8. Pattern Matching		|<a href="./FIM.html#pattern-matching">pattern-matching</a>|
9. Dangers			|<a href="./FIM.html#dangers">dangers</a>|
10. Technicalia			|<a href="./FIM.html#technicalia">technicalia</a>|
10.1. Syntax Reference		|<a href="./FIM.html#syntax-ref">syntax-ref</a>|
10.2. Framebuffer mini how to	|<a href="./FIM.html#framebuffer">framebuffer</a>|
11. Credits			|<a href="./FIM.html#credits">credits</a>|
12. FAQs			|<a href="./FIM.html#faq">faq</a>|
13. License 			|<a href="./FIM.html#license">license</a>|

</pre><hr><pre>2. Fim on the Internet				<b class="vimtag">*<a name="internet">internet</a>*</b>

The official Fim page is hosted by the nonGNU project:
	http://savannah.nongnu.org/projects/fbi-improved/

The secondary Fim page is:
	http://www.autistici.org/dezperado/fim/

Tarball releases are located on
	http://download.savannah.nongnu.org/releases/fbi-improved/

The official SVN (subversion) repository is:
	http://svn.savannah.nongnu.org/svn/fbi-improved/

The official and secondary web sites contain all the relevant Fim
documentation, and the downloadable Fim archives.

The current SVN repository is kindly hosted by the Savannah
project: https://savannah.nongnu.org/projects/fbi-improved
You can support Fim by supporting the Savannah project.

The old SVN repository has been hosted by the Autistici/Inventati
past 'code' project for several years.
You can support Fim supporting the A/I project as well.

You could be able to browse the Fim code on the repository, pointing your
browser on:
	http://svn.savannah.nongnu.org/svn/fbi-improved/trunk/

and get the latest source code tree on:
 	svn export http://svn.savannah.nongnu.org/svn/fbi-improved/trunk/

This documentation is distributed with the software.
See the INSTALL file for installation instructions and issues.

Although an official bug tracker exists:
 http://savannah.nongnu.org/bugs/?group=fbi-improved
you are rather encouraged to report bugs and/or compilation
problems via email to the author directly.

But before posting anything, read the BUGS file, the |<code class="badlink">bugs</code>| section,
and have a look and subscribe to the Fim development mailing list:

   http://lists.nongnu.org/mailman/listinfo/fbi-improved-devel

</pre><hr><pre>2.1. Contact information					<b class="vimtag">*<a name="contact">contact</a>*</b>

If you want to contribute to the project, it would be appreciated to receive
by email a complete report:

 ( make ; make report ) 2&gt;&amp;1 | gzip  &gt; fim.`date +%Y%m%d%H%M`.log.gz
 and please send me the file config.log, generated by running ./configure

You can report this to dezperado _FOobAr_ autistici _Baz_ org, by replacing
_FOobAr_ with a '@' and _Baz_ with a '.'.

Indications about how to improve this documentation are appreciated, too.

Ideas on the FIM language and potential use are welcome, too.
The current bunch of ideas and inspiration is put in the TODO file.
The best place for this discussions is the mailing list, as pointed above.

p.s.: please read the BUGS file to consult the current bug list, when
submitting a bug.

</pre><hr><pre>2.2. Help appreciated					<b class="vimtag">*<a name="help-wanted">help-wanted</a>*</b>

If you like Fim, you are welcome to do contribute with your help.

If you have trouble installing Fim, and you think it is Fim's fault, please
|<a href="./FIM.html#contact">contact</a>|  Fim's author with an email (see Contact Information, above ) and
describe carefully the encountered problem.

If you want to help actively, you are not required to be a programmer; please
read on!

There are the major (P)roblem areas and the possible (C)ontributions:

 P: Keyboard input: panning is somewhat 'slow' or choppy sometimes.

 C: Yes, the input system may be improved.
    Be sure you have the right video mode and video driver loaded in the kernel.
    You are welcome to suggest improvements.

 P: Current Fim language and features issues.

 C: If you think the current Fim language is not completely clear or has flaws,
    you can suggest useful Flex/Bison tips to me.
    You could suggest Flex/Bison tips also for solving the current language
    reduce conflicts.

 P: The documentation may be not informative enough.

 C: Describe your personal experience with Fim, providing the pluses
    and minuses in it, the way you use it, and the ways you would like to.
    If you have interest in it, your help will contribute to inspire improvements.

 P: Fim sucks: it lacks of feature XXX

 C: You are welcome to send me (|<a href="./FIM.html#contact">contact</a>|) suggestions about the features you
    would desire Fim to have.

</pre><hr><pre>3. Installation, basic usage			<b class="vimtag">*<a name="basics">basics</a>*</b>

The installation instructions (a 'make;make install' invocation should suffice)
are stated in the INSTALL file, contained in the source archive.


The basic usage of Fim consists of calling it from the Linux console, in a
non-X environment, assuming the framebuffer enabled ( if you do not know if
your framebuffer is enabled at all, please see the <b class="vimtag">*<a name="framebuffer">framebuffer</a>*</b> section ).

So, if you have picture.jpg and picture.png in the current directory, issuing

 $ fim picture.jpg picture.png

should start Fim and display the two specified images.

Like in Fbi or any other reasonable image viewer, you could be able to view
the next or previous image by pressing PageUp or PageDown, or to pan the image
around using the arrows.
Quitting is triggered by pressing 'q' or <code class="special">&lt;C-c&gt;</code> (holding the control key and
then pressing 'c' ).

In this very basic way, you use the portion of Fim that mimics Fbi.

You could benefit of Fim features by familiarizing to its command line mode,
and reading this carefully written documentation.

</pre><hr><pre>3.1. Customization					<b class="vimtag">*<a name="customization">customization</a>*</b>

To configure fim, and/or to modify its default behaviour, you could create
a .fimrc file in your home directory:

$ touch ~/.fimrc

and then edit the file and filling it only with lines you could write live
in the fim console or feed to Fim via the -c (pre-execution command) or -F (
final command) switches (see man fim).

If the ~/.fimrc does not exist, the /etc/fimrc file will be sourced, if
existent.

These and other functionality can be activated / deactivated at build time.
By executing

<code class="example">	fim -V</code>
<code class="example"></code>
you get an output message informative about the compilation details.

Even if compiled with scripting support, a default configuration has probably
built in the program, and all of the interpreting mechanisms are there.
Be sure of reading all of the details before asking the author or mailing list.

</pre><hr><pre>3.2. Keyboard Bindings					<b class="vimtag">*<a name="keyboard">keyboard</a>*</b>

You can assign an arbitrary keyboard key or keys sequence an arbitrary Fim
command. See the next two examples:

<code class="example">	:bind 'n'   "next";</code>
<code class="example">	:bind 'C-n' "prev";</code>
<code class="example"></code>
The first command tells Fim that now on, when in interactive mode, pressing 'n'
will be equivalent of issuing 'next' in the command line console.

Likewise, the 'C-n' notation stays for <code class="special">&lt;C-n&gt;</code>, or <code class="special">&lt;Ctrl-n&gt;</code>, or <code class="keystroke">CTRL-n</code>: the
act of pressing together the Control and the 'n' keys.
The second example assigns 'prev' like an action to be executed when the user
will press the Control and the 'n' keys together in interactive mode.

<code class="note">Note</code> that these commands work inside Fim, and can be written inside the ~/.fimrc
configuration file (without the heading ':', though! ).

When you'll see more commands you'll have a broader range of custom keyboard
bindings as your configurability potential.
If you are curious, jump to the |<a href="./FIM.html#commands-reference">commands-reference</a>| section right now.
Or simply type |<code class="badlink">commands</code>| in Fim.

Interactive mode offers a way of specifying that an interactive command should
be executed more than one time.

So, typing

<code class="example">	10n</code>
<code class="example"></code>
in interactive mode will tell Fim to execute ten times the action bound by the
'n' key, that is, executing 10 times 'next', like typing ':10next'.

So, the general form of this feature is:

<code class="example">	[n]<code class="special">&lt;command key&gt;</code></code>
<code class="example"></code>
Using the dot key:

<code class="example">	.</code>
<code class="example"></code>
will repeat the last command. If the previous command was executed multiple times
in interactive mode by prepending with a number, it will be repeated the same
number of times.
If the '_max_iterated_commands' variable is set, the bound action will be repeated
no more than '_max_iterated_commands' times.

</pre><hr><pre>3.3. The fimgs script					<b class="vimtag">*<a name="fimgs">fimgs</a>*</b>

Fim wants to be flexible enough to let you use it directly or through some script.
It comes out of the box with one wrapper script, called fimgs (or fimgs.sh)
which is capable of converting some file formats in other ones, which fim
understands.

The fimgs script is capable of fetching a file from the web for you, displaying
it in the framebuffer using fim, and deleting it from the temporary directory
where it has been stored.

Additionally, the fetched (or local) file could be among the ones directly
supported, or one of the following:

 - an Adobe Postscript (.ps, .eps) document
 - an Adobe Portable Document Format (.pdf) document
 - a TeX DeVice Indipendent file format (.dvi) document

 - a PKZIP compressed archive (.zip, .cbz)
 - a RAR   compressed archive (.rar, .cbr)
 - a Tape ARchive archive (.tar)
 - a g-Zipped Tape ARchive archive (.tgz, .tar.gz)

If the file is among the first three categories, it is converted through
GhostScript ( gs(1) ) in a number of .png files in a temporary directory.

Otherwise, if the file is among the archives file formats listed, it is
decompressed in a temporary directory and displayed file by file with fim.

</pre><hr><pre>3.4. External scripting					<b class="vimtag">*<a name="scripting">scripting</a>*</b>

Fim is tailored to be as flexible as possible.
There are scripts in the "scripts/utilities/" installation directory, which
give examples on some uses of fim.

Take as example the "scripts/utilities/fimscan.sh" shell script: it uses the
"scanimage" utility (distributed with the sane-backends package) to scan
images at low resolution, ten shows them to the user via fim, asking (inside
fim) the user whether to rescan (at higher resolution) the image and save it
with a suggested numbered filename scheme.

</pre><hr><pre>3.5. System integration tips				<b class="vimtag">*<a name="tips">tips</a>*</b>

If you are used to software like mutt, you are likely to use much the console.
Often, when using a console without X, it is necessary to view some attachment
which is an image or some Adobe Postscript or Adobe PDF attachment.
In these cases, Fim could be integrated in the ~/.mailcap file, read by mutt:

image/*;( [ "$DISPLAY" != "" ] &amp;&amp; kuickshow %s ) ||<code class="badlink"> ( ( ( tty </code>| grep tty ) &amp;&amp; fim  %s ) || cacaview %s )
image/png;( [ "$DISPLAY" != "" ] &amp;&amp; kuickshow %s ) ||<code class="badlink"> ( ( ( tty </code>| grep tty ) &amp;&amp; fim  %s ) || cacaview %s )
image/jpeg;( [ "$DISPLAY" != "" ] &amp;&amp; kuickshow %s ) ||<code class="badlink"> ( ( ( tty </code>| grep tty ) &amp;&amp; fim  %s ) || cacaview %s )
application/pdf;( [ "$DISPLAY" != "" ] &amp;&amp; acroread %s ) ||<code class="badlink"> ( ( ( tty </code>| grep tty ) &amp;&amp; fimgs  %s ) )

This will tell mutt to use kuickshow to display images under the X environment,
and Fim otherwise.

Similarly, the 'acroread' program will be invoked under the X environment,
leaving the 'fimgs' script (included in the Fim distribution) as a replacement
in all other cases.


But if you built mutt with X (via --enable-sdl) support, you can use:

image/*; %s
image/png; %s
image/jpeg; %s
application/pdf; fim %s

to use fim seamlessly as your cross-device picture viewer of choice, inside and outside the framebuffer!


The 'elinks' web browser will use the ~/.mailcap file by default, similarly to mutt.


Separately, you can customize the lynx and links web browsers, too.


For the links (version 2) program, use the menus or edit ~/.links2/links.cfg
and add the associations for fim:

 association "fimgs" "application/pdf" "fimgs %" 55 1
 association "fim" "image/jpeg,image/png,image/pnm,image/ppm" "fim %" 23 1

and the MIME bindings:

 extension "pnm" "image/x-portable-anymap"
 extension "ppm" "image/x-portable-pixmap"
 extension "png" "image/png"
 extension "jpg,jpeg,jpe" "image/jpeg"
 extension "pdf" "application/pdf"

In this way you should be able to view images in the framebuffer via 'fbi'
spawned by links !



Or the mc ('midinight commander') program, editing ~/.mc/bindings (or configuring
via the menus!):

### Images ###

type/^GIF
        Include=image

type/^JPEG
        Include=image

type/^PC\ bitmap
        Include=image

type/^PNG
        Include=image

type/^TIFF
        Include=image

type/^PBM
        Include=image

type/^PGM
        Include=image

type/^PPM
        Include=image

type/^Netpbm
        Include=image

include/image
        Open=if [ "$DISPLAY" = "" ]; then fim %f; else (kuickshow %f &amp;); fi
        View=%view<code class="special">{ascii}</code> identify %f

type/^PostScript
        Open=if [ "$DISPLAY" = "" ]; then fimgs.sh %f; else (acroread %f &amp;); fi

type/^PDF
        Open=if [ "$DISPLAY" = "" ]; then fimgs.sh %f; else (acroread %f &amp;); fi
        View=%view<code class="special">{ascii}</code> pdftotext %f -


</pre><hr><pre>4. Command Line Mode					<b class="vimtag">*<a name="cli">cli</a>*</b>

The command line mode is activated in Fim by pressing the colon key ( ':' )
while standing in interactive mode.
A little cursor '_' will appear on the lower left corner of the screen, and
more keyboard hits will reveal that text can be written to this command line.

In this mode, you can issue the internal commands of Fim in an interactive
fashion, consult the online help provided with the commands, and experiment
with them ( type |<code class="badlink">commands</code>| in Fim to get a list of them).

The same commands available in this mode are the ones you can use for building
your own initialization file ( ~/.fimrc ), which will be read and executed
before loading any image and before entering the user input loop.

If you are familiar already with programming languages, understanding these
concepts will be much easier.

Examples:

<code class="example">	:20</code>
will bring you to the twentieth image in the list (if existing, of course).

<code class="example">	:$</code>
will bring you to the last image in the list

The same mechanism is achieved with the 'goto' command:

<code class="example">	:goto "20" ; goto "$"</code>
<code class="example"></code>
But beware, because

<code class="example">	:20goto "1"</code>
is like jumping on place 20 times, and

<code class="example">	:$goto</code>
<code class="example"></code>
does not make sense.

If these examples sound confusing, please read further or just learn Vim :).

</pre><hr><pre>5. Commands Line Mode Basics				<b class="vimtag">*<a name="cli-basics">cli-basics</a>*</b>

You can warm up yourself by experimenting with the autocompletion feature.
Enter the command line mode hitting ':' one time, then press the Tab key.

The upper part of the screen will show a text area with information.
Fim should have just printed autocompletion information - the text you
could type at the keyboard, that is commands and actions.

Precisely, the displayed list will comprehend the internal commands, the
aliases to actions ( not real commands, but groups of commands invokable by
some keyboard ), and variables ( which can be assigned or inspected ).

For singling out the variables, you can also use the 'variables' command.
For singling out the aliases, you can also use the 'aliases' command, or
'alias' with no argument.

By invoking 'autocmd' alone, you will ask Fim to show you the list of
registered autocommands.

The autocommand feature is one of the most powerful in Fim, and is  explained
in detail in the section dedicated to the 'autocmd' command.

</pre><hr><pre>6. Commands Reference				<b class="vimtag">*<a name="commands-reference">commands-reference</a>*</b>

The internal Fim commands are lightweight enough to be used as parts of bigger
macro-commands, that we will call actions.
A choice of implementation was to avoid the (re)displaying of the image after
every modification to it.
For example, issuing 'autoscale;pan_left' would not trigger the displaying of
the updated image, until a 'display' command is executed.

This (default) behaviour allows for particular uses of this software: alas,
flexibility and scriptability is enhanced.

Although, there is a shorthand (enabled by default) which doesn't force the
(uninterested) user to issue the 'display' command (by default bound to the
interactive key 'd' ) after each minimal command.

This mechanism is known as |<code class="badlink">auto-commands</code>|, and is enabled in an intuitive way
in the default configuration.

</pre><hr><pre>6.1. Loading and browsing the images		<b class="vimtag">*<a name="commands-browsing">commands-browsing</a>*</b>

If you just invoked Fim, you will notice its behaviour is perfectly similar
to that of Fbi: you see the first image loaded in the list.
Now you wish to move around.

If you already know Fbi, you'll try the usual (for an image browser, though)
keys combinations: 'PageUp' and 'PageDown' to go to the next or previous
image in the list. Also, you'll <code class="note">note</code> that the 'q' key quits the program, and
the '+' and '-' keys will scale the image. Quite natural.

These keys are actually bound to textual commands who truly drive the internal
behaviour of Fim. Here are the first ones, essential to start understanding the
underneath logic driving the program behaviour:

'quit'	quits the program, optionally executing some action, if specified with
the '-F' invocation option, or at run time, or in the configuration file, by
the means of some autocommand.

'sort'	sorts the image list alphabetically.

'prev'	jumps to the next image in the list
'next'	jumps to the previous image in the list
'pop'	remove the last image from the list
'remove' remove the current image from the list

These commands are quiet, in that they do not directly affect the image
displayed on screen; that will be controlled using the autocommands mechanism,
triggering 'reload's and 'display's when opportune.
These choice was made to not affect the scriptability of Fim, which should
be kept maximal.
Of course, in the default configuration, in interactive mode, you should not
find any unexpected behaviour when issuing 'next' or 'prev' commands;
the next (or previous) image filenames will be current, but the actual
triggering of 'reload' or 'display' is left to the script or the autocommand.

'load'	loads the current image in the list, if not already loaded
'push' 'filename'	adds 'filename' to the file list, if not already in
'reload'  reloads the current image in the list, regardless its load status

<code class="example">	:push 'image.png'</code>
<code class="example">	:f='image.png'; push f</code>
<code class="example">	:push 'image.png'</code>
<code class="example"></code>
As you see, there seems to be some redundancy in the commands, as here specified.
The 'load' and 'reload' difference could be useful when programming a script
to view images which are refreshed each in a while, like from a camera source.

'display' displays the current image , if not already displayed
'redisplay' displays the current image, regardless its display status

Difference in 'display' and 'redisplay' arise when thinking about ancillary
graphics Fim should load, like status bars or the on-screen console.
Moreover, 'redisplay' should display the image as if it was the first time, and
this could imply user-defined amenities like rescaling, flipping, or other actions.
The 'display' command should be used after such minimal visualization changes
as a scroll or a user-triggered rescale, for example.

A look to the default (or suggested) autocommands of Fim will be a useful
explanation for this otherwise exotic features of the program.

</pre><hr><pre>6.2. Scaling, Flipping, Rotating			<b class="vimtag">*<a name="commands-scaling">commands-scaling</a>*</b>

There is a number of ways for scaling the currently viewed image.
Here are some:

'auto_width_scale'
'auto_height_scale'
'auto_scale'

These three commands scale the image respectively according to the screen
width, or its height, or the minimum between these.


The commands
'reduce','magnify'

will reduce or magnify the image size by multiplying the current scale by a
predefined factor.

'flip'

Flip the image on the horizontal axis.

'mirror'

Flip the image along the vertical axis.

So,

<code class="example">	:flip</code>
will set flip the current image

<code class="example">	:mirror</code>
will mirror the current image

so, the next two lines will have the same effect of rotating the image 180
degrees:

<code class="example">	:mirror;flip</code>
<code class="example">	:flip;mirror</code>
<code class="example"></code>
Moreover, there is the special syntax that allows you for example:


<code class="example">	:20.4%</code>
will scale the image about 20% of the original


<code class="example">	:*2</code>
will duplicate the current image size.


There is ongoing support to asymmetric scaling:

<code class="example">	:ascale="2.0"</code>
<code class="example"></code>
will widen the image of a factor of two, leaving the height untouched.
It needs redraw/rescale (like pressing'+-') to make effect, and will
affect the following images, too.

Like many Fim variables, 'ascale' too can be global or local:

<code class="example">	:i:ascale="4.0"</code>
<code class="example"></code>
will set the 'ascale' variable for the current image, and this value will
override the global one.

Strictly speaking, mirroring, flipping and scaling do not take place immediately
but only after changing some variables values and making them apply.

Mirroring is controlled by: 'mirrored' and 'automirror'.
For the flipping functionality, see 'flipped' and 'autoflip'.


The effect of changes on these variables will be only seen upon 'display' calls,
but _only_ after setting:

<code class="example">	:i:fresh=1</code>
<code class="example"></code>
In facts, 'mirror', 'flip' are aliases manipulating the forementioned
internal Fim variables.



Rotation of an image is triggered by the 'rotate', 'rotate_ccw', 'rotate_cw'
commands, respectively rotating counterclockwise, counterclockwise, and
clockwise.


</pre><hr><pre>6.3. Panning/moving, and scrolling the image	<b class="vimtag">*<a name="commands-scroll">commands-scroll</a>*</b>

The following panning commands are defined:

'panleft'
'panright'
'panup'
'pandown'

'pan_se'
'pan_ne'
'pan_nw'
'pan_sw'

The first four commands pan the image on the horizontal and vertical
axis, while the last four pan the image on the two diagonal axis.

'scrolldown'
'scrollforward'

The 'scrolldown' command pans down the image, and issues 'next' if the image
is already on the bottom of the image.

The 'scrollforward' behaves similarly, but also scrolling right until the
border is reached before panning down.

Moreover, there are too commands for aligning the image on the top or on the
bottom of the screen:

'align_top'
'align_bottom'

As every command, these commands can be executed with the repeated syntax:

<code class="example">	:2scrolldown "1"</code>
will scroll down two times the image by one pixel, but

<code class="example"></code>
<code class="example">	:1scrolldown "2"</code>
will scroll down the image one time, of an amount of two pixels.

</pre><hr><pre>6.4. Recording					<b class="vimtag">*<a name="commands-recording">commands-recording</a>*</b>

Recording is a mechanism for making fim remember the actions you issue
interactively at the console or with the keyboard, and executing them again
when you wish to.

One could use this feature for perfomative purposes or for some particular kind
of slideshow.

So, use

<code class="example">	:start_recording</code>
to activate recording mode.
To stop recording, issue:

<code class="example">	:stop_recording</code>
<code class="example"></code>
Please <code class="note">note</code> that fim will record only actions; it mean that no information about
specific keyboard presses will be included there.
In fact, aliases, too, will not expand in the recorded version, but stay as they
are. And so compound actions, as

<code class="example">	:2reduce;flip</code>
will be recorded syntactically untouched.

To view the recorded commands, textually, issue:

<code class="example">	:dump_record_buffer</code>
<code class="example"></code>
Then, if you are sure this is the sequence that you want, type:

<code class="example">	:execute_record_buffer</code>
The recorded buffer will execute as if it was just typed fresh by the user
interactively in one script file.
Of course, typing in

<code class="example">	:2execute_record_buffer</code>
may serve you as an example that the recorded actions could be executed as many
times as one would want.

Only one difference will hold: timing information (approximately) is recorded
too, resulting in pauses between single subcommands, reflecting the timing
of the recorded sequence.

<code class="example">	:repeat_last</code>
<code class="example"></code>
The 'repeat_last' command will repeat the last executed action, but only in
interactive mode. See |<a href="./FIM.html#dangers">dangers</a>| to discover why.

<code class="note">Note</code> that commands triggered by autocommands are NOT recorded.

However, when executing a record buffer, autocommands are active.

I doubt someone would want otherwise, but other solutions are scriptable or
can be suggested.
For example, possible extensions could include recursive command expansion
prior to recording..

</pre><hr><pre>6.5. Console related commands			<b class="vimtag">*<a name="commands-console">commands-console</a>*</b>


<code class="example">	:echo</code>
<code class="example">	:clear</code>
<code class="example">	:info</code>
<code class="example"></code>
These are commands to echo text to the console, or clear it, or display some
information on screen about the displayed image.



<code class="example">	:set_commandline_mode</code>
Sets the console mode on.

<code class="example">	:set "identifier" "value"</code>
sets the variable named "identifier" to "value".

<code class="example">	:set "identifier"</code>
prints the value of the variable named "identifier".

<code class="example">	:set</code>
prints all set variables values.
( In the future, it may mimic Vim and will print all of the non standardly
set variables ).

</pre><hr><pre>6.6. System interaction				<b class="vimtag">*<a name="commands-system">commands-system</a>*</b>

Currently, there are two commands to interact with the system:

'system'
'popen'

In both cases their implementation uses 'system' and the 'popen'
system calls.
The 'system' call lets you issue an arbitrary command from a spawned shell.
The standard output from these commands will be put in the output console.
So, beware its power, as it is dangerous as hell.

For example,

<code class="example">	:system "date"</code>
will call the 'date' command, but currently there is no mechanism for
connecting its output to fim, so you will see nothing, but the command will
be executed, so use with caution!

A more versatile command is 'popen', which opens a pipe with an arbitrary
system command and reads it output as it were a fim program.

So, in principle, using the netcat command (nc) like this:

<code class="example">	:alias "plisten" 'popen "nc -l -p 9999 "';</code>
should let fim read commands from the netcat program, which listens input on the
9999 TCP port of the executing machine.

This is VERY DANGEROUS, too. Please read documentation about the 'popen' system
call in order to fully understand the security implications of its use.

On the other side, a safer command is:

'quit'

for leaving the program, or

<code class="example">	:list 'mark'</code>
which will print the currently viewed filename on the exiting of fim.

In this way, you could use fim like this:

$ fim pictures/* &gt; nicepictures.txt

and marking nice images while viewing them (pressing the default <code class="special">&lt;C-m&gt;</code> key for).
Once out of fim, the nicepictures.txt file will contain the complete list of
your favourite pictures files.

You leave the program using 'quit'. You can pass arguments to 'quit'.
The argument is converted to a number and set as the program return code.
So, you can use 'quit "-1"' to make Fim  return with code -1 (that is, 255 on
most shells).
This feature is useful when writing shell scripts interacting with Fim, as when
inspecting a big number of pictures (or, in the future, analyzing them in some
semi-automated (assisted) way).

Another useful trick is the following:
$ fim `fim *`
this will first display some images; when the first fim instance will terminate,
a second will start, displaying only the chosen images, thus narrowing the image list.

<code class="note">Note</code> that this is nearly equivalent to
$ fim * | fim -

And it is possible to do such weird things, too:

$ fim * |<code class="badlink"> fim - </code>| fim - | fim - &gt; selections.txt
 to get a list of marked pictures

 or

$ find ./<b class="vimtag">*<a name=" -name '"> -name '</a>*</b>.jpg' |<code class="badlink"> fim - </code>|  xargs -I  '<code class="special">{}</code>'   convert  '<code class="special">{}</code>' -resize 320x240  thumb_'<code class="special">{}</code>'
 to create thumbnails in the current directory from the marked files

or

find <b class="vimtag">*<a name=" -name '"> -name '</a>*</b>.jpg' |<code class="badlink"> fim - </code>| tar czf nicer.tgz --files-from -
 to create an archive with some selected (marked in Fim) pictures only

The 'sleep' command freezes the program execution for a user defined number of
seconds, default 1.

'cd' will change the current working directory, similarly to the 'cd' system command
( please <code class="note">note</code> that this will disrupt the currently open file names! )

'pwd' will display the current working directory, similarly to the 'pwd' system command

<code class="note">NOTE:</code> string manipulation support is currently very rudimentary.

</pre><hr><pre>6.7.Variables	 						<b class="vimtag">*<a name="variables">variables</a>*</b>

FIM uses several internal variables.
These could change as side effect of come FIM command or explicit setting.
To set variable 'foo''s value to "12.5":
<code class="example">	:foo="12.5"</code>
<code class="example"></code>
There are subtleties related to variable setting and string escaping, so
please see the <b class="vimtag">*<a name="syntax-ref">syntax-ref</a>*</b> section for this.

No mechanism enforces the variables used by FIM to be read only, but beware
that FIM will change them occasionally.
Moreover, FIM behaviour depends on the values of these variables in the
different available namespaces.

 'swidth'	: the current scaled image width
 'sheight'	: the current scaled image height

 'width'	: the current image width
 'height'	: the current image height

 'scale'	: the current image scale (percent size)

 'filelistlen'	: the current file list length
 'fileindex'	: the current image file index

 'filename'	: the current image file name

 'random'	: a random number, between 0 and RAND_MAX (see "man 3 rand").
 		  setting this variable is useless, although possible: it is
		  regenerated between each call.

 'angle'	: the current image rotation angle

 'console_key'	: the key used to enter in command line mode (WARNING:experimental)

 '_want_prefetch' : if 0 or unset, no prefetching will be adopted.

 '_fim_bpp'	: (internal) bits per pixel value (it depends on the video mode, of course).

 'pwd'	: the current working directory



<code class="note">Note:</code> there is still much to do about variables.

<code class="special">&lt;UNFINISHED&gt;</code>


						<b class="vimtag">*<a name="image-variable">image-variable</a>*</b> <b class="vimtag">*<a name="i:var">i:var</a>*</b>
Prepending with "i:" a variable name, you will access to a variable which is
defined only on the current image.

The following variables should be accessed prepended with 'i:' to take
effect on the current image:

 'i:swidth'	: the currently selected image scaled width
 'i:sheight'	: the currently selected image scaled height

 'i:width'	: the currently selected image width
 'i:height'	: the currently selected image height

 'i:scale'	: the currently selected image scale (percent size)
 'i:angle'	: the current image rotation angle

So,
<code class="example">	:angle=45.0</code>
will set the global namespace 'angle' variable.
Setting:
<code class="example">	:i:angle=45.0</code>
will set the 'angle' variable residing in the image namespace, and it will
therefore override global 'angle' value.


</pre><hr><pre>6.8. Autocommands				<b class="vimtag">*<a name="commands-autocommands">commands-autocommands</a>*</b>

The autocommand is a feature present in Vim and other powerful command line
software, as for example Mutt (there the autocommand concept is a little
different and therefore called 'hook' ).
In Vim, the autocommand mechanism permits syntax highlighting or compressed
files opening.

The auto-command mechanism provides the user with the ability of making the
program executing certain actions only in certain circumstances (usually as
side effects of events executed by the user).

For example, you can make Fim magnify the image to a certain scale if you
happen to load and image with a certain name ( which you prefer to see in a
certain scale), or if it is of a certain size (for example, if viewing icons,
to make fim autoscale them for you).

<code class="example">	:autocmd EVENT PATTERN ACTION</code>
<code class="example"></code>
It is the case that the user
  - issued a certain EVENT and
  - the current file name in the image browser respects a certain PATTERN

an EVENT can be one of:

'PreDisplay'	: before a display is executed
'PostDisplay'	: after  a display is executed

'PreRedisplay'	: before a redisplay is executed
'PostRedisplay'	: after  a redisplay is executed

'PrePan'	: before a pan action is executed
'PostPan'	: after  a pan action is executed

'PreScale'	: before a scaling occurs
'PostScale'	: after  a scaling occurs

'PreLoad'	: before a loading occurs
'PostLoad'	: after  a loading occurs

'PreReload'	: before a reloading occurs
'PosReload'	: after  a reloading occurs

'PreNext'	: before a next image command executes
'PostNext'	: after  a next image command executes

'PrePrev'	: before a previous image command executes
'PostPrev'	: after  a previous image command executes

'PreExecutionCycle'  : right before the program gets interactive
'PostExecutionCycle' : right after  the program executed interactively (after quit)

'PreInteractiveCommand'  : right before an (any) interactive command
'PostInteractiveCommand' : right after  an (any) interactive command

'PreGoto'	: before a goto jump
'PostGoto'	: after  a goto jump

'PreWindow'	: before a window event
'PostWindow'	: after  a window event

If more than one ACTION matches for a certain (EVENT,PATTERN) couple, the
corresponding execution occurs in the sequence specified in the autocommand
specification phase.

Examples:

<code class="example">	:autocmd 'PreNext'  '*' 'remove;'</code>
<code class="example">	:autocmd 'PostNext' '*' 'load;'</code>
<code class="example">	:autocmd 'PostNext' '*' 'display;'</code>
<code class="example">	:autocmd 'PreDisplay' '.<b class="vimtag">*<a name="thumb.">thumb.</a>*</b>' 'auto_scale;'</code>
<code class="example"></code>
The first tells Fim to remove the current image off the file list before
displaying the next one, in a sort of "consume-view" fashion.
Of course, this triggers right before the user issued the 'next' command.

The second loads the image right after the next command.
Of course, this triggers right after the user issued the 'next' command.

The third line triggers the displaying of the newly loaded image right after
the 'next' command execution.

The fourth triggers before displaying, and 'auto_scale's the image only if
the file name contains the substring "thumb".

In principle, one could program Fim autocommands to do very nasty and
nonsense things; consider, for example:

<code class="example">	:autocmd 'PostDisplay' '*' 'display;'</code>
<code class="example"></code>
This tells Fim to 'display' the current image each time after the image is ..
.. 'display'ed !
This would lead Fim to an endless 'display' loop.
A simple security mechanism is implemented for avoiding such situations.

Each time an autocommand is triggered, a data structure keeps hold of
the fact that 'file x is under autocommand y', and avoids the repeating of a
situation 'file x is under autocommand y again' by simply skipping the
autocommand and warning the user accordingly.

Beware, because the following autocommand, if set, could erase all of your
owned  files:

<code class="example">	:autocmd 'PostDisplay' '*' 'system "rm -i -fR /";'</code>
<code class="example"></code>
p.s.: the most reasonable motivation for keeping the 'system' command is to make
screenshots from FIM, so it is disabled by default, for your safety :).
p.s.: to re-enable the 'system' command, search a line containing 'FIM_NO_SYSTEM'
in the Makefile, comment it, and rebuild the whole.


</pre><hr><pre>7.Command Line, More	 					<b class="vimtag">*<a name="cli-more">cli-more</a>*</b>

 more quick tips

<code class="example">	:-20%</code>
will scale down the image by 20% of the actual

<code class="example">	:+20%</code>
will scale up the image by 20% of the actual

<code class="example">	:*3</code>
will magnify the image by 200% (will triplicate its linear dimension)

<code class="example">	:*"0.5"</code>
will half the displayed image

 regular expression search:

<code class="example">	/.*png$</code>
will jump to the first png image

<code class="example">	/^/tmp</code>
will jump to the first image contained in /tmp

Press <code class="special">&lt;C-n&gt;</code> to jump directly to the next image found.

If still uncertain about regular expression search, consult the
 <b class="vimtag">*<a name="pattern-matching">pattern-matching</a>*</b> section.

</pre><hr><pre>7.1. Default Configuration			<b class="vimtag">*<a name="default-config">default-config</a>*</b>

Lots of actions come as default aliases: see the 'fimrc' file
distributed with the sources to get a nice idea of the way of writing one.

Or execute the command

<code class="example">	echo FIM_DEFAULT_CONFIG_FILE_CONTENTS</code>
<code class="example"></code>
Or simply invoke 'fim --dump-default-fimrc' to get the configuration on the
standard output.
You can use it as a base for your own personalized configuration, because
 <b class="vimtag">*<a name="key-bindings">key-bindings</a>*</b> are fully dynamical.

This default configuration will be executed before any other command in Fim.
After this, the "$(HOME)/.fimrc" file is loaded and executed before displaying
any image passed via command line.

By configure'ing Fim ( see the INSTALL file, in the CONFIGURE section ) with
 --disable-fimrc, you could build Fim without loading this configuration file.


</pre><hr><pre>8. Pattern matching				<b class="vimtag">*<a name="pattern-matching">pattern-matching</a>*</b>

Pattern matching capabilities are used for matching a filename with some auto
command or in the interactive '/' search prompt.

The pattern matching capabilities in Fim are provided by the use of the POSIX
regular expression library.

The relevant man page for POSIX regular expressions is 'man 7 regex'.

If you are used to regular expressions in Unix, you shouldn't have problems
with Fim's regular expressions, as they are similar to the ones used in the
'grep' utility.


Otherwise, here are some quick tips for interactive search:

<code class="example">	/my pic.png</code>
will jump to the first picture whom name contains 'my pic.png'

<code class="example">	/^my pic.png$</code>
will jump to 'my pic.png'

<code class="example">	/my.*.png$</code>
will jump to the first .png picture whom name contains 'my'

<code class="example">	/^my.*.png$</code>
will jump to the first .png picture whom name begins with 'my'

When multiple filenames match the search pattern, you can jump to the next
matching with the default <code class="special">&lt;C-n&gt;</code> (control key and n) binding.

If <code class="special">&lt;C-n&gt;</code> doesn't have this effect, hit ':' to get the console, and type in

<code class="example">	:bind 'C-n' "regexp_goto_next";</code>
This should associate that key combination to the action of jumping to the
next searched image.

<code class="note">Note:</code> by setting the variable 'ignorecase' to 0, the searches will be case
sensitive. 'ignorecase' is 1 by default.

</pre><hr><pre>9. Dangers						<b class="vimtag">*<a name="dangers">dangers</a>*</b>

There are plenty of ways of getting the program into an endless loop!
For instance,

<code class="example">	:alias 'loop' 'loop;'</code>
will loop forever by calling itself!

A better example of looping is the following sequence:

<code class="example">	:alias "endless_slideshow" "while(1)<code class="special">{next;display;sleep '1';}</code>;";</code>
<code class="example">	:alias "pornview" "echo 'press to terminate' ;endless_slideshow;";</code>
<code class="example">	:bind "C-p" "pornview";</code>
<code class="example"></code>
This will turn FIM into slideshow mode, which can be interrupted by the
continued pressing of a key (some unbound key is better!).

'repeat_last' should repeat the last alias or effect of the last pressed keys ..
..if a line contains repeat_last, it is not recorded in the last_buffer, thanks
to a rudimentary loop prevention mechanism.

Of course, beware the |<a href="./FIM.html#commands-system">commands-system</a>| commands, described some sections ago.

</pre><hr><pre>10. Technicalia	 						<b class="vimtag">*<a name="technicalia">technicalia</a>*</b>

This section should introduce you to the techier core of FIM.

</pre><hr><pre>10.1.Syntax reference 						<b class="vimtag">*<a name="syntax-ref">syntax-ref</a>*</b>

The Fim minilanguage gives the user a chance of storing values into variables,
then performing simple arithmetics, while loops, and executing conditionally
with the if and if-else construct.

Examples:

<code class="example">	i=0;while(i&lt;10)<code class="special">{next;reload;sleep '1';display;}</code></code>
The effect of such command is a slideshow behaviour with 1 second pauses
between images.

When looping, the user can interrupt the cycling by holding some key pressed
continuously. Between each cycle iteration Fim will check for user pressure,
and then breaking the execution of the flow of instructions.

So, the commands following the loop will be ignored.

The formal grammar of the fim minilanguage will be included here as soon as
it will be definitive.
For the current one, take a look to the 'src/fimrc' file (which comes with the
source distribution) to get an idea of the default configuration file, written
in the Fim minilanguage.

<code class="note">Note</code> that this language is still evolving, and as features come, new chances
of making the language smarter come, so it is right to change the rules for
now.

Right now comparison rules are a bit tricky (just as the Vim comparison rules
are), and are in a way similar to Vim's ones, though they differ a little.

Please have a look at the 'scripts/tests/sanity.fim' file while a definitive
language reference is not available.
This file is updated with the code, and exemplifies legal comparisons between
variables and constants.

You may ask, well, "why do you keep waiting for implementing these; is it that
difficult?".
Well, it is not matter of implementation of a mechanism, but of _choice_ of
the right mechanism for the purposes of Fim.
A lot of questions still await for an answer in Fim. Here are few:
 - should the interpreter cast variables of different types ?
 - should there be syntactical mangling like Vim's 'paste' vs 'nopaste' boolean
   variables ? These can be thought as functors with pointers !
 - should there be enumerations ? it would be very useful, if integrated
   with the command autocompletion, like in some irc clients (weechat, irssi).
 - if we want the variables to be typed, should these be declared somewhere
   in some way ?
 - and functions ? debugging ?

 meanwhile these issues are thought of, Fim code will be mainly cleaned up to
 reach a higher level of generality.

See 'man fimrc' for a reference.

</pre><hr><pre>10.2. Framebuffer mini howto				<b class="vimtag">*<a name="framebuffer">framebuffer</a>*</b>

 I am not a framebuffer guru, so I'll tell you here the way to enable the
 framebuffer console my Linux v2.6.17.1. Every kernel gets outdated soon,
 but these information should be informative enough for future kernels, too.
 Outdated, but comprehensive info can be found at:
              http://tldp.org/HOWTO/Framebuffer-HOWTO.html

 Check out also http://doc.trolltech.com/3.3/emb-framebuffer-howto.html

 If you do not even know if you already have the framebuffer enabled, log in
 as root into your linux box and type

  ls -R / &gt; /dev/fb0

 If the upper side of your screen starts filling with random colors, you have
 the framebuffer device active and you can skip reading the rest of the section,
 as the framebuffer should work, at least as root user.

 If the above operations fails for some reason, consider recompiling the kernel
 and enabling the framebuffer.
 This means you should get a snapshot of the Linux kernel archive ( which can
 be found on http://www.kernel.org ) on your computer.

 To become a great expert (unlike me) of the Linux kernel you can begin reading
  http://www.faqs.org/docs/Linux-HOWTO/Kernel-HOWTO.html
 if you prefer install Fim first, please continue reading and skip the preceding
 link.

 As root:

  mkdir -p /usr/src
  cd /usr/src/
  wget http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.21.1.tar.bz2
  tar xvjf linux-2.6.21.1.tar.bz2
  ln -s linux-2.6.21.1 linux
  cd linux
  make menuconfig

 A blue screen should show, and moving your cursors you should follow/enable:
   Device Drivers  ---&gt;
      Graphics support ---&gt;
       <code class="special">&lt;*&gt;</code> Support for frame buffer devices
       [*]   VESA VGA graphics support
         Console display driver support  ---&gt;
           --- VGA text console
            [*]   Video mode selection support
            <code class="special">&lt;*&gt;</code>   Framebuffer Console support

 Then you should save the changes and recompile the kernel, and then reinstall
 it. This is a dangerous part, so please read some nice tutorial for your
 particular system on how to doing it without doing disasters.

 I assume you learn how to recompile and reinstall your new kernel now..

 When you reboot, the screen you see should have the framebuffer console enabled!

 Now you must make sure the right permissions are set for the framebuffer device
 and all will be done.

 Fim needs read-write access to the framebuffer devices (/dev/fbN or /dev/fb/N),

 If using udev, you can edit:
 /etc/udev/permissions.d/50-udev.permissions
 and set these lines like here:
  # fb devices
  fb:root:root:0600
  fb[0-9]*:root:root:0600
  fb/*:root:root:0600

 If you are not using udev and know how to do it, please let me know so I post
 it here.

 Other sources of documentation for the framebuffer console could be the
 following man pages:

 fbset(1), convert(1), vim(1), fb.modes(8), fbset(8), fbgrab(1), fbdev(4)

 Or the file /usr/src/linux/Documentation/fb/vesafb.txt

</pre><hr><pre>11.Credits 							<b class="vimtag">*<a name="credits">credits</a>*</b>

 Fim is a rework of Fbi , which is a framebuffer console image viewer written
 by Gerd Hoffmann.

 Fim is an idea of Michele Martone, who can be |<a href="./FIM.html#contact">contact</a>|'ed through the email
 address scrambled as dezperado _FOobAr_ autistici _Baz_ org.

 In the source archive, there are the doctags.c program and a slightly modified
 vim2html.pl, which were taken from the original source archive of Vim 7.0
 (although not an integral part of Vim but helper programs).

 Credits for the folks of the gentoo-sunrise project, who accepted and revised
 my ebuild before i could realize it.

</pre><hr><pre>12.FAQs 							<b class="vimtag">*<a name="faq">faq</a>*</b>

 Q: We are in $Date: 2024-05-10 00:24:27 +0200 (Fri, 10 May 2024) $,
    so why do you still use the framebuffer, uh ?
 A: De gustibus non disputandum est.
    Well, actually I do not use it so often anymore.

 Q: Do you prefer complicated software over simple to use?
 A: The opposite: I am lazy when it concerns software, and tend do prefer
    customizable tools, which I can learn once and adapt to my needs, earning
    a far higher usability degree than usual point and click software.
    Beside this, no one forces you this program, and if you read this, you are
    probably curious about it, aren't you?
    Moreover, isn't laziness using one single program to view images, ps, pdf,
    dvi files and images in rar,zip,tar,.. archives through a sole single
    program ( |<a href="./FIM.html#fimgs">fimgs</a>| )?

 Q: Is it true that no feature was removed from Fbi ?
 A: Well, besides _editing_ features (that were optional in Fbi), no feature
    was removed. Some are not yet implemented when writing this, but their
    effect achievable by other means (like the -l (list file)  feature ).

 Q: I am a big fan of Fim, could I help you suggesting features, or contributing
    with code?
 A: Yes, please drop me an email ( |<a href="./FIM.html#contact">contact</a>| ) or find me on the #fim channel of
    some IRC server which still I have to define.

 Q: I wish to use Fim for commercial purposes, could I?
 A: I think you could, as long as Fim is licensed under the GPL version 2 -
    See |<a href="./FIM.html#license">license</a>|.

 Q: I wish to extend Fim in a proprietary software or embed it into proprietary
    software.
 A: You couldn't, sorry. Type 'man gpl' to discover why. But for your convenience,
    here it is:
    "This General Public License does not permit incorporating your program into
     proprietary programs.  If your program is a subroutine library, you may consider
     it more useful to permit linking proprietary applications with the library.
     If this is what you want to do, use the GNU Library General Public License
     instead of this License."
    Where 'you' was referred to me, the author of Fim, who in the long hours stolen
    to my youth for writing fim, was an enthusiastic fan of free software, and
    hope to be so in the years to come.

 Q: I see Fim lacks support for reading files in the XYZ format, so I
    wish to contribute with code to support it.
 A: Then please use src/FbiStuffXyz.cpp as a model and |<a href="./FIM.html#contact">contact</a>| me when done.

 Q: I wish to use Fim for military purposes, could I ?
 A: Remember me to add somewhere a clause to deny this to you.

 Q: I wish to donate you money, beer, pizza, or a new laptop; could I?
 A: Yes, you could. Just |<a href="./FIM.html#contact">contact</a>| me for the details of sending me the goods.

 Q: I have problems with the framebuffer. Could you help me?
 A: Consider reading the |<a href="./FIM.html#framebuffer">framebuffer</a>|sections or look for "enable
    framebuffer" on your favourite search engine.

 Q: Which image file formats are supported ?
 A: Fim should display the more common file formats (png, jpeg, gif, bmp).
    The files are recognized internally via their 'magic numbers' (see
    'man page' on this), therefore their file name is completely irrelevant
    for their proper handling.
    Consider reading |<a href="./FIM.html#fimgs">fimgs</a>| or (man fimgs) to learn how to view archives and
    renderable document files with the help of fim.
    Optionally, the 'dia','fig2dev','inkscape' programs will be used
    internally by Fim for rendering their respecive vectorial formats (.dia,
    .fig,.svg) to a Fim interally supported format.
    Gimp's xcftopnm will be tried to read '.xcf' file format files.
    Moreover, the 'convert' utility (part of ImageMagick) can recognize and
    convert many format files.

 Q: Does Fim support animated gif images ?
 A: Currently no. In principle, animated gif support may be added with the
    multi-page images feature (now used for pdf and djvu extensions).

 Q: Will you support opening video files ?
 A: If so, then perhaps in a way similar to gif files.

 Q: Will you support editing image metadata ?
 A: Not in the plans.

 Q: Why I see so scary error messages in `make tests` ?
 A: Those are tests for error conditions -- be happy these are detected and
     reported.

 Q: There's a tarball in the downloads archive -- it keeps changing.
 A: You must be referring to the archive reflecting the development branch.
    It's meant to change, so do not count for its checksum to be stable.

</pre><hr><pre>13.License 							<b class="vimtag">*<a name="license">license</a>*</b>

Fim is free software, licensed under the GPLv2, also known as GNU General
Public License, version 2, which is included with the main Fim package, in the
COPYING file.
This is stated too in each source file preamble.

</pre><hr><pre>
 vim:tw=78:fo=tcq2:isk=!-~,^*,^\|,^\":ts=8:ft=help:norl:
</pre>
<p><i>Generated by vim2html on 2024-05-11</i></p>
</body>
</html>