{{{  Comments for this keybinding
; These keybindings are my variant of the mtool-sun-installation for  the
; Origami folding editor.
;
; It works in general like the mtool-system, but the  special  codes  for
; find/replace/attach  are  different.   Also   there   are   some  other
; differences, which are nessessary to use the new commands.
;
; The alias-fold includes the binding of the Rx-Keys, so that you can use
; $Rx to bind them to functions. Every function key should be defined  in
; this way, because escape sequences are hard to read if you want to  get
; user-help from the binding-file.
;
; Wolfgang Stumvoll
}}}
(defusermacros 10)
{{{  I call these bindings MTool
(defbinding MTool-Sun)
}}}
{{{  Alias for SUN-Keyboard (sunview and console)
; The following aliases describe the sunview-standard-keymapping for
; the Rxx-Keys and the Ins-Key.
{{{  Rxx
(alias R1  ($esc  "[ "2 "0 "8 "z))
(alias R2  ($esc "[ "2 "0 "9 "z))
(alias R3  ($esc "[ "2 "1 "0 "z))
(alias R4  ($esc "[ "2 "1 "1 "z))
(alias R5  ($esc "[ "2 "1 "2 "z))
(alias R6  ($esc "[ "2 "1 "3 "z))
(alias R7  ($esc "[ "2 "1 "4 "z))
(alias R8  ($esc "[ "A))
(alias R9  ($esc "[ "2 "1 "6 "z))
(alias R10 ($esc "[ "D))
(alias R11 ($esc "[ "2 "1 "8 "z))
(alias R12 ($esc "[ "C))
(alias R13 ($esc "[ "2 "2 "0 "z))
(alias R14 ($esc "[ "B))
(alias R15 ($esc "[ "2 "2 "2 "z))
}}}
(alias Ins ($esc "[ "2 "4 "7 "z))
}}}
{{{  definition of backspace,rubout
(alias rubout (C-?))
(alias backspace (C-H))
}}}
{{{  marktypes
{{{  pascal
(defmark pascal ( ("< "< "<)
                  (". ". ".)
                  (": ": ":)
                  ("> "> ">)
                )
)
}}}
{{{  script
(defmark script  ( ("# "# "@)
                   (". ". ".)
                   ("# "# ":)
                   ("# "# "$)
                 )
)
}}}
}}}
{{{  OCL-macros
@if-using (MOUSY)
   {{{F fun/go-mouse
   :::F fun/go-mouse
   }}}
   {{{  go-mouse
   ( deffun go-mouse
      ( if in-prompt
         ( newline-and-indent )
        else
         ( go-mouse-position )
        fi
      )
   )
   }}}
   {{{  go-and-open-mouse
   ( deffun go-and-open-mouse
      ( if in-prompt
         ( newline-and-indent )
        else
         ( go-mouse-position
           case
            ( test-fold-line ( open-fold ) )
            ( test-filed ( enter-fold ) )
           esac
         )
        fi
      )
   )
   }}}
   {{{  go-and-close-mouse
   ( deffun go-and-close-mouse
      ( if in-prompt
         ( newline-and-indent )
        else
         ( go-mouse-position
           close-fold
           if last-message M_TOP ( exit-fold ) fi
         )
        fi
      )
   )
   }}}
@fi
{{{F fun/wordmacs
:::F fun/wordmacs
}}}
{{{F fun/mt-fold
:::F fun/mt-fold
}}}
{{{  real-enter
(deffun enter-fold- (
  if test-text ( message-exit ( M_NO_SIMPLE_FOLD ) ) fi
  enter-fold
))
}}}
{{{F fun/lookup
:::F fun/lookup
}}}
{{{F fun/delspaces
:::F fun/delspaces
}}}
{{{F fun/tab
:::F fun/tab
}}}
{{{F fun/append -to-previous
:::F fun/append
}}}
{{{F fun/go-match
:::F fun/go-match
}}}
}}}
{{{  folding
(keybind attach-file-to-fold       ($esc "a "t))
(keybind create-fold               ($R15))
(keybind create-fold               ($esc "c "r))
(keybind auto-header               ($esc "f "h))
(keybind describe-fold             ($esc "f "?))
(keybind enter-fold-               ($R13 $R4))
(keybind enter-fold-               ($esc "e "n))
(keybind enter-fold-               (M-C-O))
(keybind exit-fold                 ($R13 $R6))
(keybind exit-fold                 ($esc "e "x))
(keybind exit-fold                 (M-C-C))
(keybind close-fold                ($R6))
(keybind close-fold                ($esc "c "l))
(keybind close-fold                (C-C))
(keybind toggle-file-fold          ($R13 $R11))
(keybind toggle-file-fold          ($esc "f "f))
(keybind open-fold                 ($esc "o "p))
(keybind open-fold                 ($R4))
(keybind open-fold                 (C-O))
(keybind unfold-fold               ($esc "r "e))
(keybind unfold-fold               ($R13 $R15))
}}}
{{{  moving around
(keybind end-of-fold               ($R3))
(keybind end-of-fold               ($esc "b "O))
(keybind next-line                 ($R14))
(keybind next-line                 ($esc "d "n))
(keybind next-line                 (C-N))
(keybind end-of-line               ($R9))
(keybind end-of-line               ($esc "e "l))
(keybind goto-line                 ($esc "g "o))
(keybind goto-line                 ($R13 "g))
(keybind backward-character        ($esc "l "e))
(keybind backward-character        ($R10))
(keybind backward-character        (C-B))
(keybind next-page                 ($esc "p "d))
(keybind next-page                 ($R13 $R3))
(keybind previous-page             ($esc "p "u))
(keybind previous-page             ($R13 $R1))
(keybind forward-character         ($esc "r "i))
(keybind forward-character         ($R12))
(keybind forward-character         (C-F))
(keybind beginning-of-line         ($R7))
(keybind beginning-of-line         ($esc "s "l))
(keybind beginning-of-fold         ($esc "s "F))
(keybind beginning-of-fold         ($R1))
(keybind previous-line             ($esc "u "p))
(keybind previous-line             ($R8))
(keybind previous-line             (C-P))
(keybind backward-word             ($esc "l "w))
(keybind backward-word             ($R13 $R10))
(keybind forward-word              ($esc "r "w))
(keybind forward-word              ($R13 $R12))
(keybind mtool-top                 ($esc "s "f))
(keybind mtool-top                 ($R13 $R8))
(keybind mtool-bot                 ($esc "b "o))
(keybind mtool-bot                 ($R13 $R14))
(keybind goto-matching-fence       ($esc "]))
}}}
{{{  editing
(keybind double-line               ($R13 $R5))
(keybind double-line               ($esc "c "o))
(keybind copy-to-kill-buffer       ($R5))
(keybind copy-to-kill-buffer       ($esc "c "p))
(keybind move-line                 ($esc "m "o))
(keybind move-line                 ($R13 $R2))
(keybind kill-line                 ($esc "p "i))
(keybind kill-line                 ($R2))
(keybind insert-folded-kill-buffer ($esc "p "p))
(keybind insert-folded-kill-buffer ($R11))
(keybind newline-and-indent        (C-M))
(keybind case-word-capitalize      (C-W))
(keybind case-word-lower           (C-L))
(keybind case-word-upper           (C-U))
(keybind go_to_next_tab            (C-I))
(keybind transpose-characters      (C-T))
}}}
{{{  macros
(keybind save-keyboard-macro       ($esc "d "f))
(keybind define-macro              ($esc "d "m))
(keybind define-macro              ($R13 "d "m))
(keybind execute-macro             ($esc "c "m))
(keybind execute-macro             ($R13 "m))
(keybind execute-number-macro 1    ($esc "m "1))
(keybind execute-number-macro 2    ($esc "m "2))
(keybind execute-number-macro 3    ($esc "m "3))
(keybind execute-number-macro 4    ($esc "m "4))
(keybind execute-number-macro 5    ($esc "m "5))
(keybind execute-number-macro 6    ($esc "m "6))
(keybind execute-number-macro 7    ($esc "m "7))
(keybind execute-number-macro 8    ($esc "m "8))
(keybind execute-number-macro 9    ($esc "m "9))
}}}
{{{  deletes
(keybind delete-previous-character (C-H))
(keybind delete-character          (C-?))
(keybind delete-line               ($R13 $R9))
(keybind delete-line               ($esc "d "l))
(keybind delete-to-end-of-line     ($esc "d "e))
(keybind undo-delete-character     ($esc "u "c))
(keybind undo-delete-line          ($esc "u "l))
(keybind delspaces                 ($esc C-?))
(keybind append-to-previous-line   ($esc C-H))
}}}
{{{  finds
(keybind search-forward            ($esc "f "i))
(keybind search-reverse            ($esc "f "r))
(keybind incremental-search-forward($esc "i "s))
(keybind incremental-search-forward($R13 "f))
(keybind query-replace-string      ($esc "r "p))
(keybind query-replace-string      ($R13 "r))
}}}
{{{  specials
(keybind help                      ($esc "h "e))
(keybind help                      ($R13 "h))
(keybind redraw-display            ($esc $esc))
(keybind redraw-display            ($R13 $R13))
(keybind abort                     (C-\))
(keybind describe-bindings         ($R13 "?))
(keybind describe-bindings         ($esc "h "b))
(keybind quote-character           (C-Q))
}}}
{{{  shells/filter
(keybind save-and-exit-origami     ($esc "f "n))
(keybind shell                     ($esc "s "h))
(keybind exit-origami              ($esc "q "u))
(keybind exit-origami              ($R13 "q))
(keybind filter-buffer             ($esc "f "b))
(keybind pipe-from-command         ($esc "< "p))
(keybind pipe-to-command           ($esc "> "p))
(keybind shell-command             ($esc "s "c))
(keybind suspend-origami           (C-S))
(keybind lookup                    ($esc "l "o))
}}}
{{{  files
(keybind insert-file               ($esc "i "n))
(keybind insert-file               ($R13 "i))
(keybind read-file                 ($esc "o "f))
(keybind read-file                 ($R13 "o))
(keybind save-file                 ($esc "s "a))
(keybind save-file                 ($R13 "s))
(keybind next-file                 ($esc "n "f))
(keybind previous-file             ($esc "p "f))
(keybind write-file                ($esc "w "f))
(keybind write-file                ($R13 "w))
}}}
{{{  modes
(keybind set-language              ($esc "l "a))
(keybind set-language              ($R13 "l))
(keybind add-mode-autosave         ($esc "+ "a))
(keybind add-mode-echo             ($esc "+ "e))
(keybind add-mode-overwrite        ($esc "+ "o))
(keybind add-mode-overwrite        ($R13 $Ins))
(keybind add-mode-view             ($esc "+ "v))
(keybind delete-mode-autosave      ($esc "- "a))
(keybind delete-mode-echo          ($esc "- "e))
(keybind delete-mode-overwrite     ($esc "- "o))
(keybind delete-mode-overwrite     ($Ins))
(keybind delete-mode-view          ($esc "- "v))
(keybind define-tab                ($esc C-I))
}}}
{{{  arguments
(keybind set-argument-0            ($esc "0))
(keybind set-argument-0            ($R13 "0))
(keybind set-argument-1            ($esc "1))
(keybind set-argument-1            ($R13 "1))
(keybind set-argument-2            ($esc "2))
(keybind set-argument-2            ($R13 "2))
(keybind set-argument-3            ($esc "3))
(keybind set-argument-3            ($R13 "3))
(keybind set-argument-4            ($esc "4))
(keybind set-argument-4            ($R13 "4))
(keybind set-argument-5            ($esc "5))
(keybind set-argument-5            ($R13 "5))
(keybind set-argument-6            ($esc "6))
(keybind set-argument-6            ($R13 "6))
(keybind set-argument-7            ($esc "7))
(keybind set-argument-7            ($R13 "7))
(keybind set-argument-8            ($esc "8))
(keybind set-argument-8            ($R13 "8))
(keybind set-argument-9            ($esc "9))
(keybind set-argument-9            ($R13 "9))
}}}
{{{  mouse
@if-using (MOUSY)
   ( mouse-buttons
        go-mouse
        go-and-open-mouse
        go-and-close-mouse
   )
@fi
}}}
