home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / epmkmap1.zip / MYKEYS.E < prev    next >
Text File  |  1996-11-16  |  16KB  |  618 lines

  1. /*
  2.  * MyKeys.e  :  A keymap to redefine EPM's keyboard easily
  3.  *              04/1995 by herbert
  4.  * The functions executed by a keystrike are called via procs
  5.  * defined in a patched stdkeys.e file or defined anyway :-)
  6.  * This of course means that my version of stdkeys.e is needed.
  7.  */
  8.  
  9. /*
  10.  * Now here we go:
  11.  */
  12.  
  13. --- All 'special' keys:
  14.  
  15. def up = call do_up()
  16. def down = call do_down()
  17. def left = call do_left()
  18. def right = call do_right()
  19. def pgup = call do_pgup()
  20. def pgdn = call do_pgdn()
  21. def home = call do_home()
  22. def end = call do_end()
  23. def ins = call toggle_insert()
  24. def del = call do_del()
  25. def space = call do_space()
  26. def backspace = call smart_backspace()
  27. def esc = 'commandline'
  28. def tab = call do_tab()
  29. def s_up = call mark_up()
  30. def s_down = call mark_down()
  31. def s_left = call mark_left()
  32. def s_right = call mark_right()
  33. def s_pgup = call mark_pgup()
  34. def s_pgdn = call mark_pgdn()
  35. def s_home = call mark_to_bol()
  36. def s_end = call mark_to_eol()
  37. def s_ins = call do_ins()
  38. def s_del = 'cut'
  39. def s_space = call do_space()
  40. def s_backspace = call do_backspace()
  41. def s_tab = call back_tab()
  42. def c_up = call scroll_up()       --- Does not work in EPM's current
  43. def c_down = call scroll_down()   --- version :-( maybe it will sometime
  44. def c_left = call left_word()
  45. def c_right = call right_word()
  46. def c_pgup = call go_to_bof()
  47. def c_pgdn = call go_to_eof()
  48. def c_home = call beg_screen()
  49. def c_end = call end_screen()
  50. def c_ins = 'copy2clip'
  51. def c_del = call delete_right_word()
  52. def c_space = call do_space()
  53. def c_backspace = call delete_line()
  54. def c_tab = keyin \7
  55. def a_backspace = 'undodlg'
  56.  
  57. --- The function keys (I left out all those used by PM):
  58.  
  59. def f1 = 'help'
  60. def f2 = call pcenter_mark()
  61. def f3 = 'quit'
  62. def f4 = 'fontlist'
  63. def f5 = call center_line_vert()
  64. def f6 = 
  65. def f7 = call command_line()
  66. def f8 = 'dolines'
  67. def f9 = 'shell'
  68. def f11 = 
  69. def f12 = 'draw' 1
  70. def a_f1 = 'help' --- starts the help browser with info about keybindings
  71. def a_f2 = call upcase_word()
  72. def a_f3 = call locase_word()
  73. def a_f11 = 
  74. def a_f12 = 'draw' 2
  75. def s_f1 =  
  76. def s_f2 = call adjust_block_()
  77. def s_f3 = call reformat_paragraph()
  78. def s_f4 = call dup_line()
  79. def s_f5 = 
  80.    universal cur_keyset --- Commands for EPM debug information
  81.    universal cur_line
  82.    universal cur_col
  83.    Sayerror 'Swapped to debug mode, enter command...'
  84.    cur_keyset = .keyset --- Name of the current keyset
  85.    cur_line = .line
  86.    cur_col = .col
  87.    keys debug_keys
  88. def s_f6 = call record_key_string()
  89. def s_f7 = call put_recorded_keystring()
  90. def s_f8 = call new_keyset()
  91. def s_f9 = 
  92. def s_f11 =
  93. def s_f12 = 'draw' 5
  94. def c_f1 = 'kwhelp'
  95. def c_f2 = call puppercase()
  96. def c_f3 = call plowercase()
  97. def c_f11 =
  98. def c_f12 = 'draw' 6 --- another already defined command!
  99.  
  100. --- All the other keys:
  101.  
  102. def a_1 = 
  103. def a_2 =
  104. def a_3 =
  105. def a_4 =
  106. def a_5 =
  107. def a_6 = 
  108. def a_7 =
  109. def a_8 =
  110. def a_9 =
  111. def a_0 =
  112. def a_a =
  113. def a_b = call left_word(); call delete_right_word()
  114. def a_c = 
  115. def a_d = 
  116. def a_e = call add_file()
  117. def a_f = call get_file_at_cursor()
  118. def a_g = 
  119. def a_h = 
  120. def a_i =
  121. def a_j = 
  122. def a_k = call mark_block_()
  123. def a_l = call mark_line_()
  124. def a_m = 
  125. def a_n = call next_file_()
  126. def a_o = 'rename'
  127. def a_p = call previous_file_()
  128. def a_q = 'quit'
  129. def a_r = 
  130. def a_s = call splitlines()
  131. def a_t = 'poptagsdlg'
  132. def a_u = call unmark_block()
  133. def a_v =
  134. def a_w = call pmark_word()
  135. def a_x =
  136. def a_y = 
  137. def a_z =
  138. def a_minus = call circle_it()
  139. def c_1 =
  140. def c_2 =
  141. def c_3 =
  142. def c_4 =
  143. def c_5 =
  144. def c_6 =
  145. def c_7 =
  146. def c_8 =
  147. def c_9 =
  148. def c_0 =
  149. def c_a =
  150. def c_b = compile if WANT_BRACKET_MATCHING
  151.           'match_bracket'
  152.           compile endif
  153. def c_c = call change_next()
  154. def c_d = 
  155. def c_e = 'fold 0'
  156. def c_f = 'fold'
  157. def c_g = 'ring_more'
  158. def c_h = 
  159. def c_i = 'commandline'
  160. def c_j = 'commandline'
  161. def c_l = call find_next()
  162. def c_m = 
  163. def c_n = 
  164. def c_o = 'opendlg'
  165. def c_p = 'findtag'
  166. def c_r = call change_next()
  167. def c_s = 'findtag *'
  168. def c_t = call delete_right_word()
  169. def c_u = undo
  170. def c_v =
  171. def c_w = call scroll_up()
  172. def c_x =
  173. def c_y = call delete_line()
  174. def c_z = call scroll_down()
  175.  
  176. --- Plain Key definitions:
  177. ---  * Add closing brackets for most bracket types
  178. def ')' = keyin ')'
  179.           this_col = .col
  180.           .col = .col - 1
  181.           call passist()
  182.           call passist()
  183.           .col = this_col
  184. def ']' = keyin ']'
  185.           this_col = .col
  186.           .col = .col - 1
  187.           call passist()
  188.           call passist()
  189.           .col = this_col
  190. def '}' = keyin '}'
  191.           this_col = .col
  192.           .col = .col - 1
  193.           call passist()
  194.           call passist()
  195.           .col = this_col
  196.  
  197. --- Prefix Key bindings: 
  198. --- * like WordStar: Ctrl K, Ctrl Q
  199. --- * no need for Ctrl O postfixes: there's no windowing stuff!
  200. --- * if more than those prefix key bindings are desire, just stick
  201. ---   to the way shown below
  202.  
  203. def c_k =
  204.    universal cur_keyset
  205.    cur_keyset = .keyset --- Name of the current keyset
  206.    sayerror 'Ctrl-K...'
  207.    keys ctrl_k_postfix
  208.  
  209. def c_q =
  210.    universal cur_keyset
  211.    cur_keyset = .keyset --- Name of the current keyset
  212.    sayerror 'Ctrl-Q...'
  213.    keys ctrl_q_postfix
  214.  
  215.  
  216. --- Each twokey combination needs its own keyset for the handling of
  217. --- the second keystroke.
  218.  
  219. --- All the second keys for Ctrl K ...
  220.  
  221. defkeys ctrl_k_postfix base clear
  222.     def 'a', 'A' =
  223.        universal cur_keyset
  224.        sayerror 'Select all...'
  225.        'select_all'
  226.        keys edit_keys
  227.        .keyset = cur_keyset
  228.     def 'b', 'B' =
  229.        universal cur_keyset
  230.        sayerror 'Begin Block...'
  231.        call mark_single_char()
  232.        keys edit_keys
  233.        .keyset = cur_keyset
  234.     def 'c', 'C' =
  235.        universal cur_keyset
  236.        sayerror 'Copy Block...'
  237.        'dupmark C'
  238.        keys edit_keys
  239.        .keyset = cur_keyset
  240.     def 'q', 'd', 'Q', 'D' =
  241.        universal cur_keyset
  242.        sayerror 'Quit File...'
  243.        'quit'
  244.        keys edit_keys
  245.        .keyset = cur_keyset
  246.     def 'e', 'E' =
  247.        universal cur_keyset
  248.        sayerror 'Add File...'
  249.        call add_file()
  250.        keys edit_keys
  251.        .keyset = cur_keyset
  252.     def 'f', 'F' =
  253.        universal cur_keyset
  254.        sayerror 'Fill Block...'
  255.        call fill_marked_area()
  256.        keys edit_keys
  257.        .keyset = cur_keyset
  258.     def 'h', 'H' =
  259.        universal cur_keyset
  260.        sayerror 'Unmark Block...'
  261.        call unmark_block()
  262.        keys edit_keys
  263.        .keyset = cur_keyset
  264.     def 'i', 'I' =
  265.        universal cur_keyset
  266.        sayerror 'Indent Block...'
  267.        call move_right()
  268.        keys edit_keys
  269.        .keyset = cur_keyset
  270.     def 'k', 'K' =
  271.        universal cur_keyset
  272.        sayerror 'End Block...'
  273.        call mark_single_char()
  274.        keys edit_keys
  275.        .keyset = cur_keyset
  276.     def 'l', 'L' =
  277.        universal cur_keyset
  278.        sayerror 'List Files...'
  279.        'ring_more'
  280.        keys edit_keys
  281.        .keyset = cur_keyset
  282.     def 'm', 'v', 'M', 'V' =
  283.        universal cur_keyset
  284.        sayerror 'Move Block...'
  285.        'dupmark M'
  286.        keys edit_keys
  287.        .keyset = cur_keyset
  288.     def 'n', 'N' =
  289.        universal cur_keyset
  290.        sayerror 'Overlay Block...'
  291.        'dupmark O'
  292.        keys edit_keys
  293.        .keyset = cur_keyset
  294.     def 'o', 'O' =
  295.        universal cur_keyset
  296.        sayerror 'Save As...'
  297.        'saveas_dlg'
  298.        keys edit_keys
  299.        .keyset = cur_keyset
  300.     def 'p', 'P' =
  301.        universal cur_keyset
  302.        sayerror 'Push Position...'
  303.        'pushpos'
  304.        keys edit_keys
  305.        .keyset = cur_keyset
  306.     def 'r', 'R' =
  307.        universal cur_keyset
  308.        sayerror 'Read block...'
  309.        'opendlg get'
  310.        keys edit_keys
  311.        .keyset = cur_keyset
  312.     def 's', 'S' =
  313.        universal cur_keyset
  314.        sayerror 'Save File...'
  315.        call save_file()
  316.        keys edit_keys
  317.        .keyset = cur_keyset
  318.     def 't', 'T' =
  319.        universal cur_keyset
  320.        sayerror 'Mark Word...'
  321.        call pmark_word()
  322.        keys edit_keys
  323.        .keyset = cur_keyset
  324.     def 'u', 'U' =
  325.        universal cur_keyset
  326.        sayerror 'Unindent Block...'
  327.        call move_left()
  328.        keys edit_keys
  329.        .keyset = cur_keyset
  330.     def 'w', 'W' =
  331.        universal cur_keyset
  332.        sayerror 'sorry, no idea how to write blocks to files'
  333.        keys edit_keys
  334.        .keyset = cur_keyset
  335.     def 'x', 'X' =
  336.        universal cur_keyset
  337.        sayerror 'Save and Quit File...'
  338.        call save_and_quit_file()
  339.        keys edit_keys
  340.        .keyset = cur_keyset
  341.     def 'y', 'Y' =
  342.        universal cur_keyset
  343.        sayerror 'Delete Block...'
  344.        call delete_block()
  345.        keys edit_keys
  346.        .keyset = cur_keyset
  347.     def del =
  348.        universal cur_keyset
  349.        sayerror 'Delete to end of line...'
  350.        erase_end_line
  351.        keys edit_keys
  352.        .keyset = cur_keyset
  353.     def '0' =
  354.        universal cur_keyset
  355.        sayerror 'Enter Bookmark'
  356.        'setmark'
  357.        keys edit_keys
  358.        .keyset = cur_keyset
  359.     def '1' =
  360.        universal cur_keyset
  361.        sayerror 'Set Bookmark 1'
  362.        'setmark 1'
  363.        keys edit_keys
  364.        .keyset = cur_keyset
  365.     def '2' =
  366.        universal cur_keyset
  367.        sayerror 'Set Bookmark 2'
  368.        'setmark 2'
  369.        keys edit_keys
  370.        .keyset = cur_keyset
  371.     def '3' =
  372.        universal cur_keyset
  373.        sayerror 'Set Bookmark 3'
  374.        'setmark 3'
  375.        keys edit_keys
  376.        .keyset = cur_keyset
  377.     def '4' =
  378.        universal cur_keyset
  379.        sayerror 'Set Bookmark 4'
  380.        'setmark 4'
  381.        keys edit_keys
  382.        .keyset = cur_keyset
  383.     def '5' =
  384.        universal cur_keyset
  385.        sayerror 'Set Bookmark 5'
  386.        'setmark 5'
  387.        keys edit_keys
  388.        .keyset = cur_keyset
  389.     def '6' =
  390.        universal cur_keyset
  391.        sayerror 'Set Bookmark 6'
  392.        'setmark 6'
  393.        keys edit_keys
  394.        .keyset = cur_keyset
  395.     def '7' =
  396.        universal cur_keyset
  397.        sayerror 'Set Bookmark 7'
  398.        'setmark 7'
  399.        keys edit_keys
  400.        .keyset = cur_keyset
  401.     def '8' =
  402.        universal cur_keyset
  403.        sayerror 'Set Bookmark 8'
  404.        'setmark 8'
  405.        keys edit_keys
  406.        .keyset = cur_keyset
  407.     def '9' =
  408.        universal cur_keyset
  409.        sayerror 'Set Bookmark 9'
  410.        'setmark 9'
  411.        keys edit_keys
  412.        .keyset = cur_keyset
  413.     def esc = 
  414.        universal cur_keyset
  415.        sayerror 'cancel!'
  416.        keys edit_keys
  417.        .keyset = cur_keyset
  418.     def otherkeys =
  419.        universal cur_keyset
  420.        sayerror 'key not accessed!'
  421.        keys edit_keys
  422.        .keyset = cur_keyset
  423.  
  424. --- All the second keys for Ctrl Q ...
  425.  
  426. defkeys ctrl_q_postfix base clear
  427.     def 'f', 'a', 'F', 'A' =
  428.        universal cur_keyset
  429.        sayerror 'Search...'
  430.        'searchdlg'
  431.        keys edit_keys
  432.        .keyset = cur_keyset
  433.     def 'b', 'B' =
  434.        universal cur_keyset
  435.        sayerror 'Go to Begin of Block...'
  436.        call pbegin_mark()
  437.        keys edit_keys
  438.        .keyset = cur_keyset
  439.     def 'k', 'K' =
  440.        universal cur_keyset
  441.        sayerror 'Go to End of Block...'
  442.        call end_of_mark()
  443.        keys edit_keys
  444.        .keyset = cur_keyset
  445.     def 'l', 'L' =
  446.        universal cur_keyset
  447.        sayerror 'Undo...'
  448.        'undo'
  449.        keys edit_keys
  450.        .keyset = cur_keyset
  451.     def 'n', 'N' =
  452.        universal cur_keyset
  453.        sayerror 'Go to next Bookmark...'
  454.        'nextbookmark'
  455.        keys edit_keys
  456.        .keyset = cur_keyset
  457.     def 'p', 'P' =
  458.        universal cur_keyset
  459.        sayerror 'Pop Position...'
  460.        'poppos'
  461.        keys edit_keys
  462.        .keyset = cur_keyset
  463.     def 'v', 'V' =
  464.        universal cur_keyset
  465.        sayerror 'Go to previous Bookmark...'
  466.        'nextbookmark P'
  467.        keys edit_keys
  468.        .keyset = cur_keyset
  469.     def '0' =
  470.        universal cur_keyset
  471.        sayerror 'List Bookmarks...'
  472.        'listmark'
  473.        keys edit_keys
  474.        .keyset = cur_keyset
  475.     def '1' =
  476.        universal cur_keyset
  477.        sayerror 'Bookmark 1'
  478.        'gomark 1'
  479.        keys edit_keys
  480.        .keyset = cur_keyset
  481.     def '2' =
  482.        universal cur_keyset
  483.        sayerror 'Bookmark 2'
  484.        'gomark 2'
  485.        keys edit_keys
  486.        .keyset = cur_keyset
  487.     def '3' =
  488.        universal cur_keyset
  489.        sayerror 'Bookmark 3'
  490.        'gomark 3'
  491.        keys edit_keys
  492.        .keyset = cur_keyset
  493.     def '4' =
  494.        universal cur_keyset
  495.        sayerror 'Bookmark 4'
  496.        'gomark 4'
  497.        keys edit_keys
  498.        .keyset = cur_keyset
  499.     def '5' =
  500.        universal cur_keyset
  501.        sayerror 'Bookmark 5'
  502.        'gomark 5'
  503.        keys edit_keys
  504.        .keyset = cur_keyset
  505.     def '6' =
  506.        universal cur_keyset
  507.        sayerror 'Bookmark 6'
  508.        'gomark 6'
  509.        keys edit_keys
  510.        .keyset = cur_keyset
  511.     def '7' =
  512.        universal cur_keyset
  513.        sayerror 'Bookmark 7'
  514.        'gomark 7'
  515.        keys edit_keys
  516.        .keyset = cur_keyset
  517.     def '8' =
  518.        universal cur_keyset
  519.        sayerror 'Bookmark 8'
  520.        'gomark 8'
  521.        keys edit_keys
  522.        .keyset = cur_keyset
  523.     def '9' =
  524.        universal cur_keyset
  525.        sayerror 'Bookmark 9'
  526.        'gomark 9'
  527.        keys edit_keys
  528.        .keyset = cur_keyset
  529.     def esc = 
  530.        universal cur_keyset
  531.        sayerror 'cancel!'
  532.        keys edit_keys
  533.        .keyset = cur_keyset
  534.     def otherkeys =
  535.        universal cur_keyset
  536.        sayerror 'key not accessed!'
  537.        keys edit_keys
  538.        .keyset = cur_keyset
  539.  
  540.  
  541. --- All the second keys for Debug-Keyset...
  542.  
  543. defkeys debug_keys base clear
  544.     def 'k', 'K' =
  545.        universal cur_keyset
  546.        universal cur_line
  547.        universal cur_col
  548.        winmessagebox( 'The current keyset:', cur_keyset, MB_OK + MB_INFORMATION + MB_MOVEABLE)
  549.        keys edit_keys
  550.        .keyset = cur_keyset
  551.        .line = cur_line
  552.        .col = cur_col
  553.     def 's', 'S' =
  554.        universal cur_keyset
  555.        universal cur_line
  556.        universal cur_col
  557.        winmessagebox( 'My_Stack_cmds:', my_STACK_CMDS, MB_OK + MB_INFORMATION + MB_MOVEABLE)
  558.        keys edit_keys
  559.        .keyset = cur_keyset
  560.        .line = cur_line
  561.        .col = cur_col
  562.     def 'e', 'E' =
  563.        universal load_ext
  564.        universal cur_keyset
  565.        universal cur_line
  566.        universal cur_col
  567.        winmessagebox( 'The current load_ext:', load_ext, MB_OK + MB_INFORMATION + MB_MOVEABLE)
  568.        keys edit_keys
  569.        .keyset = cur_keyset
  570.        .line = cur_line
  571.        .col = cur_col
  572.     def esc =
  573.        universal cur_keyset
  574.        universal cur_line
  575.        universal cur_col
  576.        sayerror 'cancel!'
  577.        keys edit_keys
  578.        .keyset = cur_keyset
  579.        .line = cur_line
  580.        .col = cur_col
  581.     def otherkeys =
  582.        universal cur_keyset
  583.        universal cur_line
  584.        universal cur_col
  585.        sayerror 'key not accessed!'
  586.        keys edit_keys
  587.        .keyset = cur_keyset
  588.        .line = cur_line
  589.        .col = cur_col
  590.  
  591.  
  592.  
  593.  
  594. --- Still unused stuff:
  595.  
  596. /*
  597. overlay_marked_area()
  598. keyin .filename
  599. joinlines()
  600. reflow_marked_area()
  601. show_draw_chars()
  602. reflow_marked_area()
  603. mark_word_somehow_else()
  604. beg_word()
  605. end_word()
  606. escape_key()
  607. scroll_left()
  608. scroll_right()
  609. 'findtag'
  610. 'findtag *'
  611. 'tagsfile'
  612. 'maketags *'
  613. 'nextview'
  614. */                    
  615.  
  616.  
  617.  
  618.