{{{ sets ( defset word-char ( alpha digit "_ )) (defset close-fence ( "} "] ") )) (defset open-fence ( "{ "[ "( )) (defset fence ( open-fence close-fence )) }}} {{{ aliases ( alias space ( " ) ) @if-using not( ATARI ) {{{ terminal sun ( terminal ( sun ) ( alias backspace ( C-H ) ) ( alias delete ( C-? ) ) ( alias tab ( C-I ) ) ( alias down ( C-[ "[ "B ) ) ( alias left ( C-[ "[ "D ) ) ( alias right ( C-[ "[ "C ) ) ( alias up ( C-[ "[ "A ) ) ( alias f1 ( C-[ "[ "2 "2 "4 "z ) ) ( alias f2 ( C-[ "[ "2 "2 "5 "z ) ) ( alias f3 ( C-[ "[ "2 "2 "6 "z ) ) ( alias f4 ( C-[ "[ "2 "2 "7 "z ) ) ( alias f5 ( C-[ "[ "2 "2 "8 "z ) ) ( alias f6 ( C-[ "[ "2 "2 "9 "z ) ) ( alias f7 ( C-[ "[ "2 "3 "0 "z ) ) ( alias f8 ( C-[ "[ "2 "3 "1 "z ) ) ( alias f9 ( C-[ "[ "2 "3 "2 "z ) ) ) }}} {{{ terminal SUN ( terminal ( SUN ) ( alias backspace ( C-H ) ) ( alias delete ( C-? ) ) ( alias tab ( C-I ) ) ( alias f1 ( C-[ "[ "2 "2 "4 "z ) ) ( alias f2 ( C-[ "[ "2 "2 "5 "z ) ) ( alias f3 ( C-[ "[ "2 "2 "6 "z ) ) ( alias f4 ( C-[ "[ "2 "2 "7 "z ) ) ( alias R1 ( C-[ "[ "2 "0 "8 "z ) ) ( alias R2 ( C-[ "[ "2 "0 "9 "z ) ) ( alias R3 ( C-[ "[ "2 "1 "0 "z ) ) ( alias R4 ( C-[ "[ "2 "1 "1 "z ) ) ( alias R5 ( C-[ "[ "2 "1 "2 "z ) ) ( alias R6 ( C-[ "[ "2 "1 "3 "z ) ) ( alias R7 ( C-[ "[ "2 "1 "4 "z ) ) ( alias R8 ( C-[ "[ "2 "1 "5 "z ) ) ( alias R9 ( C-[ "[ "2 "1 "6 "z ) ) ( alias R10 ( C-[ "[ "2 "1 "7 "z ) ) ( alias R11 ( C-[ "[ "2 "1 "8 "z ) ) ( alias R12 ( C-[ "[ "2 "1 "9 "z ) ) ( alias R13 ( C-[ "[ "2 "2 "0 "z ) ) ( alias R14 ( C-[ "[ "2 "2 "1 "z ) ) ( alias R15 ( C-[ "[ "2 "2 "2 "z ) ) ( alias up ( C-[ "[ "A ) ) ( alias left ( C-[ "[ "D ) ) ( alias right ( C-[ "[ "C ) ) ( alias down ( C-[ "[ "B ) ) ) }}} {{{ terminal PC ( terminal ( PC ) @if-using not($ext) ( alias ext ( C-@ ) ) @fi ( alias backspace ( C-H ) ) ( alias delete ( $ext "S ) ) ( alias tab ( C-I ) ) ( alias dos-left ( $ext "K ) ) ( alias dos-right ( $ext "M ) ) ( alias dos-up ( $ext "H ) ) ( alias dos-down ( $ext "P ) ) ( alias dos-prev-page ( $ext "I ) ) ( alias dos-next-page ( $ext "Q ) ) ( alias dos-home ( $ext "G ) ) ( alias dos-end ( $ext "O ) ) ( alias dos-ins ( $ext "R ) ) ) }}} {{{ terminal xterm ( terminal ( xterm ) ( alias backspace ( C-H ) ) ( alias delete ( C-? ) ) ( alias tab ( C-I ) ) ( alias down ( C-[ "O "B ) ) ( alias left ( C-[ "O "D ) ) ( alias right ( C-[ "O "C ) ) ( alias up ( C-[ "O "A ) ) ( alias f1 ( C-[ "[ "1 "1 "~ ) ) ( alias f2 ( C-[ "[ "1 "2 "~ ) ) ( alias f3 ( C-[ "[ "1 "3 "~ ) ) ( alias f4 ( C-[ "[ "1 "4 "~ ) ) ) }}} {{{ terminal vt100 ( terminal ( vt100 ) ( alias backspace ( C-H ) ) ( alias delete ( C-? ) ) ( alias tab ( C-I ) ) ( alias down ( C-[ "O "B ) ) ( alias left ( C-[ "O "D ) ) ( alias right ( C-[ "O "C ) ) ( alias up ( C-[ "O "A ) ) ( alias f1 ( C-[ "O "P ) ) ( alias f2 ( C-[ "O "Q ) ) ( alias f3 ( C-[ "O "R ) ) ( alias f4 ( C-[ "O "S ) ) ) }}} {{{ terminal mgr ( terminal ( mgr ) ( alias backspace ( C-H ) ) ( alias delete ( C-? ) ) ( alias tab ( C-I ) ) ( alias down ( C-[ "[ "B ) ) ( alias left ( C-[ "[ "D ) ) ( alias right ( C-[ "[ "C ) ) ( alias up ( C-[ "[ "A ) ) ( alias f1 ( C-[ "[ "2 "2 "4 "z ) ) ( alias f2 ( C-[ "[ "2 "2 "5 "z ) ) ( alias f3 ( C-[ "[ "2 "2 "6 "z ) ) ( alias f4 ( C-[ "[ "2 "2 "7 "z ) ) ( alias f5 ( C-[ "[ "2 "2 "8 "z ) ) ( alias f6 ( C-[ "[ "2 "2 "9 "z ) ) ( alias f7 ( C-[ "[ "2 "3 "0 "z ) ) ( alias f8 ( C-[ "[ "2 "3 "1 "z ) ) ( alias f9 ( C-[ "[ "2 "3 "2 "z ) ) ) }}} @fi @if-using ( ATARI ) {{{ st aliases {{{F st-termalias :::F st-termalias }}} ( alias R1 ( $KP_openbr )) ( alias R2 ( $KP_closebr )) ( alias R3 ( $KP_slash )) ( alias R4 ( $KP_7 )) ( alias R5 ( $KP_8 )) ( alias R6 ( $KP_9 )) ( alias R7 ( $KP_4 )) ( alias R8 ( $KP_5 )) ( alias R9 ( $KP_6 )) ( alias R10 ( $KP_1 )) ( alias R11 ( $KP_2 )) ( alias R12 ( $KP_3 )) ( alias R13 ( $KP_0 )) ( alias R14 ( $KP_point )) ( alias R15 ( $KP_enter )) }}} @fi {{{ default-pseudo-fx ( alias EF1 ( $esc "F "1 ) ) ( alias EF2 ( $esc "F "2 ) ) ( alias EF3 ( $esc "F "3 ) ) ( alias EF4 ( $esc "F "4 ) ) }}} }}} {{{ forward (forward go-line) (forward enter-command-mode) }}} {{{ variables (defvar ( go-line-arg; Argument for go-line macro matching; matching mode? if non zero then the return address in case of an abort modec; current mode starting-up; is this the first time that read-new-file macro has been called? still-reading; blx; want-newline; to keep ex mode happy tc; target character for tTFf and r diffx; diffy; delete line or fold? isactive; delete, fold indent or which other function tot; vi prefix totaliser. extended; extended or normal mode wrap; wrap mode or normal mode tabx; position on line for tabin or tabout stop-at-eol; FfTt~ stops at eol or continues... fast-gotol; Use goto or go line? stepping; stepping? read-tab-width; new tab width hard-tab; internal tab width old-mode; mode to goto after leaving paramter mode. mo; temp to determine old mode in exit-parameter-mode mode-temp; temp var command; mc; mark character counter mtemp; temporary var vor gotos ) ) (defvar 26 ( mx; x coordinate of the mark my; hashed (mark) y coordinate of the mark ) ) }}} {{{ global bindings {{{ @uses @use (SCR-OFF mouse FE-G-T-BUFF) {{{ dont read this yet... ; QUICHE means cursor keys in insert mode and double escape for command mode ; insert mode is the default at startup ; if QUICHE is not defined, then real user vi is set up ; keyboard aliases are ignored if possible and only one escape, or a tab is needed. ; command mode is the default startup. }}} }}} (defbinding ViOri-0.a) (keybind abort (C-C)) (defmodes comrepmv-mode insert-mode parameter-mode ex-mode direct-mode resize-mode) {{{ internal mode identifiers ; 0 command mode ; 1 motion mode ; 2 insert mode ; 3 parameter mode }}} {{{ mode strings ;these strings are for novice mode or for debugging use. (defmodestring com "Command "Com) (defmodestring ins "Insert "Ins) (defmodestring prm "parameter "Prm) (defmodestring mot "Motion "Mot) (defmodestring ex "Ex-mode "Ex) (defmodestring rep "Repeat "Rep) }}} {{{ abort macro (deffun abort-tidy ( if >(matching 0) ( set go-line-arg matching go-line ) fi enter-command-mode ) ) }}} {{{ no-modes (defmac no-modes ( reset-user-mode com reset-user-mode ins reset-user-mode prm reset-user-mode mot reset-user-mode ex ) ) }}} {{{ mode entry macros {{{ enter-command-mode (deffun enter-command-mode ( add-mode-view no-modes set-user-mode com comrepmv-mode set modec 0 set old-mode 0 ) ) }}} {{{ enter-insert-mode (deffun enter-insert-mode ( set old-mode modec set modec 2 delete-mode-view no-modes set-user-mode ins insert-mode ) ) }}} {{{ enter-parameter-mode (deffun enter-parameter-mode ( set old-mode modec set modec 3 no-modes set-user-mode prm parameter-mode ) ) }}} {{{ enter-motion-mode (deffun enter-motion-mode (add-mode-view no-modes set-user-mode mot set modec 1 comrepmv-mode ) ) }}} {{{ enter-ex-mode (deffun enter-ex-mode ( delete-mode-view no-modes set-user-mode ex ex-mode ) ) }}} {{{ enter-resize-mode (deffun enter-resize-mode ( resize-mode) ) }}} }}} {{{ mode exit macros {{{ exit-parameter-mode (deffun exit-parameter-mode ( newline-and-indent set modec old-mode comrepmv-mode ) ) }}} {{{ exit-ex-mode (deffun exit-ex-mode ( if =(still-reading 0) ( ; there is no point in calling ex mode from motion mode ? enter-command-mode ) fi ) ) }}} }}} {{{ automatic macros {{{ enter-prompt-fix ;deffun enter-prompt-fix ;E }}} {{{ exit-prompt-fix }}} {{{ read-newfile-macro (deffun vi-read-newfile-macro ( add-mode-position add-mode-autosave "10 newline-and-indent enter-command-mode ) ) }}} ;(auto-save-macro) (read-newfile-macro vi-read-newfile-macro) ;(change-buffer-macro name) (begin-prompt-macro enter-parameter-mode ) (end-prompt-macro exit-parameter-mode) (key-not-bound-macro enter-command-mode) ;(view-macro name) (abort-macro abort-tidy) ;(key-not-bound-macro name) ;(sigquit-macro name) ;(sigusr1-macro name) ;(sigusr2-macro name) {{{ pascal (defmark pascal ( ("< "< "<) (". ". ".) (": ": ":) ("> "> ">) ) ) (defmark script (("# "# "@) (". ". ".) ("# "# ":) ("# "# "$) ) ) }}} }}} }}} {{{ external macros and functions @lib exit @lib vi-fun/stdmac @use (REGIONS-INDENT) @lib regions @use not(REGIONS-INDENT) @lib xsel @lib mt-fold @lib fillpara @lib buff-chg @lib buff-size @lib tags-mac @lib np-file {{{ set fill column ( deffun vi-set-fill-column ( direct-mode set-fill-column comrepmv-mode ) ) }}} {{{ space to cope with wrap mode ( defmac space ( wrap-word ) ) }}} {{{ functions to hack ex and parameter modes, and arguments (deffun newline-or-exit-mode ( if =(want-newline 0) ( enter-command-mode ) else (newline-and-indent) fi ) ) }}} {{{ macro to enter command mode from insert mode (deffun enter-command-from-insert ( set mode-temp -(modec 2) if =(mode-temp 0) ( ; then commmand mode enter-command-mode ) fi ) ) }}} {{{ vi-fun/viwrdmac as there are a few slight differences. {{{ blank-left skip the whitespace left to next word (deffun blank-left ( while not(test-char-set word-char) {{{ back or line up ( if pre (set blx -(store-pos 1)) =(blx 0) ( word-line-up ) else ( backward-character ) fi ) }}} )) }}} {{{ blank-right skip the whitespace right to next word (deffun blank-right ( while not(test-char-set word-char) {{{ right or down ( if test-end-line ( word-line-down ) else ( forward-character ) fi ) }}} )) }}} (deffun vi-forward-word ( enter-command-from-insert {{{ end word or next-line if test-end-line ( word-line-down ) else ( end-word ) fi }}} blank-right )) (deffun vi-backward-word ( enter-command-from-insert {{{ one step left if test-begin-line ( word-line-up ) else ( backward-character ) fi }}} blank-left start-word )) (deffun vi-forward-WORD ( enter-command-from-insert {{{ end word or next-line if test-end-line ( word-line-down ) else ( end-word ) fi }}} blank-right )) (deffun vi-backward-WORD ( enter-command-from-insert {{{ one step left if test-begin-line ( word-line-up ) else ( backward-character ) fi }}} blank-left start-word )) }}} {{{ vi-append-to-previous-line (deffun vi-append-to-previous-line ( enter-command-from-insert delete-mode-view if not(test-text) (failed) fi end-of-line delete-character delspaces add-mode-view )) }}} }}} {{{ unbind remaining keys (mode ex-mode ( keybind - ( * ) ) ) (mode comrepmv-mode ( keybind - ( * ) ) ) }}} @lib vi-fun/functions @lib vi-fun/modes @use ( ViOri-Reference-Card-REF ) @lib vi-fun/ref.ocl @use not( ViOri-Reference-Card-REF )