#autocmd "Prev" ""  "echo 'PREV'" ;
#autocmd "Prev" "1"  "echo 'PREV1'" ;
#autocmd "Prev" "2"  "echo 'PREV2'" ;
#autocmd "Next" ""  "echo 'NEXT'" ;
#quit;
#info;
#next;
#autocmd;
#bind 29 "scale_factor_increase";
#bind 31 "scale_factor_decrease";
#bind 29 "scale_factor_grow";
#bind 31 "scale_factor_shrink";
_display_status=0;
#autowidth=1;
alias "toggleautoflip" "autoflip=1-autoflip;";
alias "flip" "toggleautoflip;redisplay;";
alias "fliponce" "flip;toggleautoflip;";
alias "toggleautomirror" "automirror=1-automirror;";
alias "mirror" "toggleautomirror;redisplay;";
alias "mirroronce" "mirror;toggleautomirror;";
alias "q" "quit;";
bind 'f' "flip;";
bind 'F' "fliponce;";
bind 'm' "mirror;";
bind 'M' "mirroronce;";
bind 'q' "quit";
bind 'Esc' "quit";
#bind 'f' "file";
bind 'n' "next;display;";
bind 'h' "help";
bind 'H' "help";
bind 'x' "echo";
bind 'e' "echo";
bind 'p' "prev;display;";
bind 'P' "pop";
bind 's' "sort";
bind 'S' "toggleDisplayStatus";
bind 'R' "reload";
#bind 'R' "redisplay";
bind 'r' "rotate";
#bind 'C-d' "display";
bind '+' "magnify";
bind 'a' "auto_scale;";
bind 'Tab' "toggleVerbosity";
bind 'C-v' "toggleKeyVerbosity";
bind 'C-k' "toggleKeyVerbosity";
bind 'v' "toggleDisplayStatus";
bind 'A' "A";
bind 'C-m' "mark";
bind 'Enter' "mark;next";
bind '-' "reduce";
bind "Up" "panup";
bind 'k' "panup";
bind "Right" "panright";
bind 'l' "panright";
bind "Down" "pandown";
bind 'j' "pandown";
bind "Left" "panleft";
bind 'h' "panleft";
bind ' ' "scrolldown";
bind 't' "top_align;";
bind "PageUp" "next;";
bind "PageDown" "prev;";
bind 'i' "info";
bind 'P' "f=`files`/2;prev  --f";
bind 'N' "f=`files`/2;next  --f";

bind 'C-g' "system 'fbgrab fim.png'";
bind 'C-r' "start_recording;";
bind 'Q' "stop_recording";
bind 'D' "dump_record_buffer;";
bind 'E' "execute_record_buffer;";
bind 'C-e' "execute_record_buffer;";
bind 'C-x' "execute_record_buffer;";
bind 'X' "execute_record_buffer;";
bind '.' "repeat_last;";

reload;
#_display_status=1;
#display;
alias 'A' "'autotop=1-autotop;'";
alias "toggleVerbosity" "_display_console=1-_display_console;fresh=1;reload;";
alias "toggleKeyVerbosity" "_verbose_keys=1-_verbose_keys;redisplay;";

auto_scale_v=1;
_verbose_keys=0;
_display_busy=1;
_display_status=1;
#_verbose_keys=1;

#autocmd "Next"     "" "echo 'rendering next image..'";
#autocmd "Prev"     "" "echo 'rendering prev image..'";
#autocmd "PostDisplay" "" "echo '\\nthis is a file\\n'";
#autocmd "PostGoto"   "" "set_interactive_mode;";
autocmd "PostGoto" "" "reload;";
autocmd "PostNext" "" "reload;";
autocmd "PostPrev" "" "reload;";
#autocmd "PostDisplay"   "" "fresh=1" ;
autocmd "PreRedisplay"   ".*/fbps-.*" "if(fresh){fresh=0;auto_width_scale;fresh=0;}";
autocmd "PreRedisplay"   "" "if(autowidth*fresh){fresh=0;auto_width_scale;fresh=0;}";
autocmd "PreRedisplay"   "" "if(auto_scale_v*fresh){fresh=0;auto_scale;fresh=0;}";
autocmd "PostReload"  "" "fresh=1" ;
autocmd "PostScale"   "" "{fresh=1;display;}" ;
autocmd "PostPan"     "" "{fresh=1;display;}" ;
autocmd "PostReload"   "" "if(fresh){redisplay;}";
#autocmd "PostInteractiveCommand"   "" "if(fresh){display;}";
alias "next10" "i=0;while(i<10){i=i+1;next;display;sleep '1';};";
bind 'N' 'next10';
bind 'C-n' "regexp_goto_next";
alias "endless_slideshow" "while(1){display;sleep '1';next;};";
alias "bookview"          "while(1){display;sleep '2';scrolldown;};";
alias "comicview"         "while(1){display;sleep '1';scrolldown;};";
alias "read"              "while(1){display;sleep '1';scrollforward;};";
alias "slowread"          "while(1){display;sleep '2';scrollforward;};";
alias "fastread"          "while(1){display;scrollforward;};";
alias "pornview"          "echo 'press any key repeatedly to terminate' ;endless_slideshow;";
bind  "C-p" "pornview";
bind  "C-b" "bookview";
autocmd "PreExecutionCycle" "/fbps-" "_display_busy=0;_display_status=0;" ;
autocmd "PreExecutionCycle" "" "fresh=1;reload;";
autocmd "PreExecutionCycle" "" "redisplay;";
autocmd "PreExecutionCycle" "/fbps-.*ps001.png" "fresh=1;redisplay;";
#autocmd "PostInteractiveCommand" "" "fresh=0;";
#extra..
bind 'w' "auto_width_scale";
bind 'C-h' "auto_height_scale";
alias "diagonal_nw" "pan_nw;";
alias "diagonal_ne" "pan_ne;";
alias "diagonal_se" "pan_se;";
alias "diagonal_sw" "pan_sw;";
bind 'd' "diagonal_nw;";
bind 'D' "diagonal_se;";
bind 'x' "diagonal_ne;";
bind 'X' "diagonal_sw;";
alias "toggleDisplayStatus" "_display_status=1-_display_status;";
alias "toggleDisplayBusy" "_display_busy=1-_display_busy;";
#bind 'C-a' "auto_scale";
#autocmd "PostInteractiveCommand" "fim.png" "echo '\\nmatched an interactive command on fim.png\\n';";
#autocmd "PostDisplay" ".*png" "echo 'this is a png file';";
#autocmd "PostDisplay" ".*jpg" "echo 'this is a jpg file';";
#autocmd "PostDisplay" ".*gif" "echo 'this is a gif file';";
####_display_status=1;
#push "media/fim.png";
#push "media/image.png";
#push "media/image.jpg";
#push "media/icon_smile.gif";
echo "WELCOME : to switch to the command line interface press ':' ";
alias "toggleAutoScale" "auto_scale_v=1-auto_scale_v;autowidth=0;reload;";
alias "toggleAutoWidth" "autowidth=1-autowidth;auto_scale_v=0;reload;";
bind 'C-w'   'toggleAutoWidth;';
bind 'C-a' "toggleAutoScale;";
bind 'C-c' "toggleAutoScale;";
bind 'C-l' "clear;";
bind 'A'   "toggleAutoScale;";
#toggleVerbosity;
#bind 'f' "next;display;";
bind 'b' "prev;display;";
bind 'B' "toggleDisplayBusy";
alias "plisten" 'popen "nc -l -p 9999 "';
alias "wlisten" "while(1){sleep;plisten;}";
alias "random_slideshow" "while(1){goto random;}";
alias "rotate_ccw" "orientation=orientation+1;fresh=1;redisplay;";
alias "rotate_cw" "orientation=orientation-1;fresh=1;redisplay;";
alias "rotate" "rotate_cw";
#This is a FIM initialization file. 
#Without one of these FIM is nothing.
#So use it, but with caution! FIM is still bugged! 
