vimamsa 0.1.27 → 0.1.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/appimage.yml +17 -10
  3. data/Dockerfile +2 -2
  4. data/README.md +162 -90
  5. data/custom_example.rb +33 -15
  6. data/doc/TODO.md +334 -110
  7. data/doc/action_names_plan.md +442 -0
  8. data/doc/bundling_plan.md +2 -1
  9. data/doc/delta_syntax_plan.md +293 -0
  10. data/doc/demo_recording_plan.md +288 -0
  11. data/doc/design_goals.md +27 -0
  12. data/doc/intro_page_plan.md +266 -0
  13. data/doc/key_bindings_report_plan.md +45 -0
  14. data/doc/line_tree_plan.md +89 -0
  15. data/doc/missing_vim_bindings.md +34 -44
  16. data/doc/modules_settings_plan.md +1 -1
  17. data/doc/registries_plan.md +202 -0
  18. data/doc/startup_speed_plan.md +97 -0
  19. data/doc/test_commands.md +232 -0
  20. data/doc/treap_visualizer.html +585 -0
  21. data/doc/vim_compatibility_plan.md +186 -31
  22. data/doc/vimlike_vim_conflicts.md +236 -228
  23. data/doc/vm_snapshots_plan.md +4 -4
  24. data/doc/wysiwyg_plan.md +231 -0
  25. data/docker_cmd.sh +1 -1
  26. data/exe/run_tests.rb +85 -3
  27. data/exe/vimamsa +49 -6
  28. data/help/intro.txt +30 -0
  29. data/help/vim_intro.txt +31 -0
  30. data/img/demo.gif +0 -0
  31. data/img/demo.mp4 +0 -0
  32. data/lang/hyperplaintext.lang +1 -1
  33. data/lib/vimamsa/ack.rb +2 -0
  34. data/lib/vimamsa/actions.rb +381 -36
  35. data/lib/vimamsa/bookmarks.rb +8 -8
  36. data/lib/vimamsa/buffer.rb +84 -38
  37. data/lib/vimamsa/buffer_changetext.rb +58 -36
  38. data/lib/vimamsa/buffer_list.rb +2 -2
  39. data/lib/vimamsa/buffer_manager.rb +6 -6
  40. data/lib/vimamsa/cli_help.rb +75 -0
  41. data/lib/vimamsa/clipboard.rb +6 -3
  42. data/lib/vimamsa/conf.rb +9 -0
  43. data/lib/vimamsa/crash_handler.rb +2 -2
  44. data/lib/vimamsa/debug.rb +2 -2
  45. data/lib/vimamsa/demo_player.rb +494 -0
  46. data/lib/vimamsa/demo_recorder.rb +277 -0
  47. data/lib/vimamsa/diff_buffer.rb +1 -1
  48. data/lib/vimamsa/dot_repeat.rb +104 -0
  49. data/lib/vimamsa/easy_jump.rb +54 -3
  50. data/lib/vimamsa/editor.rb +136 -65
  51. data/lib/vimamsa/file_history.rb +1 -1
  52. data/lib/vimamsa/file_manager.rb +23 -23
  53. data/lib/vimamsa/form_input.rb +388 -0
  54. data/lib/vimamsa/gui.rb +89 -13
  55. data/lib/vimamsa/gui_command_line.rb +44 -5
  56. data/lib/vimamsa/gui_form_generator.rb +17 -6
  57. data/lib/vimamsa/gui_func_panel.rb +1 -1
  58. data/lib/vimamsa/gui_key_hint.rb +165 -0
  59. data/lib/vimamsa/gui_keylog_panel.rb +164 -2
  60. data/lib/vimamsa/gui_menu.rb +69 -50
  61. data/lib/vimamsa/gui_select_window.rb +77 -43
  62. data/lib/vimamsa/gui_settings.rb +9 -5
  63. data/lib/vimamsa/gui_sourceview.rb +28 -81
  64. data/lib/vimamsa/gui_theme.rb +11 -2
  65. data/lib/vimamsa/hook.rb +2 -0
  66. data/lib/vimamsa/intro_page.rb +367 -0
  67. data/lib/vimamsa/key_actions.rb +315 -225
  68. data/lib/vimamsa/key_binding_tree.rb +228 -61
  69. data/lib/vimamsa/key_bindings_notepad.rb +18 -16
  70. data/lib/vimamsa/key_bindings_report.rb +290 -67
  71. data/lib/vimamsa/key_bindings_vim.rb +43 -297
  72. data/lib/vimamsa/key_bindings_vim_core.rb +356 -0
  73. data/lib/vimamsa/key_bindings_vimlike.rb +347 -339
  74. data/lib/vimamsa/key_names.rb +80 -0
  75. data/lib/vimamsa/langservp.rb +62 -7
  76. data/lib/vimamsa/line_tree.rb +367 -0
  77. data/lib/vimamsa/macro.rb +20 -3
  78. data/lib/vimamsa/rbvma.rb +15 -0
  79. data/lib/vimamsa/registers.rb +125 -0
  80. data/lib/vimamsa/run_ruby.rb +64 -0
  81. data/lib/vimamsa/search_replace.rb +4 -4
  82. data/lib/vimamsa/string_util.rb +17 -3
  83. data/lib/vimamsa/tests.rb +8 -8
  84. data/lib/vimamsa/text_objects.rb +11 -54
  85. data/lib/vimamsa/text_transforms.rb +4 -0
  86. data/lib/vimamsa/tmp_user_dir.rb +39 -0
  87. data/lib/vimamsa/user_dirs.rb +83 -0
  88. data/lib/vimamsa/version.rb +1 -1
  89. data/lib/vimamsa/vim_operators.rb +365 -0
  90. data/modules/calculator/calculator.rb +5 -5
  91. data/modules/color_highlight/color_highlight.rb +3 -3
  92. data/modules/dictation/dictation.rb +32 -32
  93. data/modules/ollama/ollama.rb +5 -5
  94. data/modules/terminal/terminal.rb +5 -5
  95. data/modules/tts/tts.rb +10 -10
  96. data/run_e2e_vm.sh +3 -3
  97. data/run_tests_vm.rb +163 -0
  98. data/scripts/appimage/AppRun +7 -0
  99. data/scripts/appimage/build_in_container.sh +11 -1
  100. data/scripts/appimage/smoke_test.sh +1 -1
  101. data/scripts/demo/demo_easyjump_steps.txt +60 -0
  102. data/scripts/demo/demo_files_steps.txt +52 -0
  103. data/scripts/demo/demo_steps.txt +9 -1
  104. data/scripts/demo/notes.txt +6 -0
  105. data/scripts/demo/record_demo.rb +60 -81
  106. data/scripts/demo/report.rb +7 -0
  107. data/scripts/demo/shapes.rb +1 -0
  108. data/scripts/demo/square/shapes.rb +29 -0
  109. data/scripts/demo/square/steps.txt +185 -0
  110. data/scripts/lib/perf_startup.rb +138 -0
  111. data/scripts/lib/script_helpers.rb +53 -0
  112. data/scripts/perf_compare.rb +34 -0
  113. data/scripts/profile_startup.rb +72 -0
  114. data/tests/test_action_ids.rb +232 -0
  115. data/tests/test_auto_format.rb +2 -2
  116. data/tests/test_autocomplete.rb +1 -1
  117. data/tests/test_basic_editing.rb +18 -18
  118. data/tests/test_bookmarks.rb +6 -6
  119. data/tests/test_bracket_match.rb +3 -0
  120. data/tests/test_cli_help.rb +64 -0
  121. data/tests/test_color_highlight.rb +2 -2
  122. data/tests/test_command_line.rb +1 -1
  123. data/tests/test_context_menu_file.rb +18 -0
  124. data/tests/test_copy_paste.rb +33 -33
  125. data/tests/test_custom_two_phase.rb +1 -1
  126. data/tests/test_demo_player.rb +355 -0
  127. data/tests/test_demo_recorder.rb +202 -0
  128. data/tests/test_dictation.rb +16 -16
  129. data/tests/test_dot_repeat.rb +88 -0
  130. data/tests/test_easy_jump.rb +93 -0
  131. data/tests/test_extract_file_links.rb +3 -3
  132. data/tests/test_file_panel.rb +2 -2
  133. data/tests/test_flash.rb +1 -1
  134. data/tests/test_fold.rb +1 -1
  135. data/tests/test_form_input.rb +203 -0
  136. data/tests/test_func_panel.rb +2 -2
  137. data/tests/test_gtk_sync.rb +7 -7
  138. data/tests/test_intro_page.rb +437 -0
  139. data/tests/test_key_categories.rb +163 -0
  140. data/tests/test_keylog_panel.rb +163 -3
  141. data/tests/test_line_ends.rb +51 -0
  142. data/tests/test_line_tree.rb +86 -0
  143. data/tests/test_lsp_clangd.rb +2 -2
  144. data/tests/test_lsp_root.rb +43 -0
  145. data/tests/test_macro.rb +2 -2
  146. data/tests/test_module_interface.rb +9 -9
  147. data/tests/test_notepad_bindings.rb +5 -5
  148. data/tests/test_perf_startup.rb +28 -0
  149. data/tests/test_random_edit.rb +27 -27
  150. data/tests/test_registers.rb +131 -0
  151. data/tests/test_run_ruby.rb +77 -0
  152. data/tests/test_startup_file.rb +45 -4
  153. data/tests/test_text_objects.rb +1 -1
  154. data/tests/test_text_transforms.rb +12 -0
  155. data/tests/test_tmp_user_dir.rb +79 -0
  156. data/tests/test_tts.rb +10 -10
  157. data/tests/test_undo.rb +34 -34
  158. data/tests/test_user_dirs.rb +122 -0
  159. data/tests/test_vim_bindings.rb +107 -6
  160. data/tests/test_vim_conflicts.rb +41 -4
  161. data/tests/test_vim_operators.rb +116 -0
  162. data/tests/test_window_layout.rb +83 -0
  163. data/vimamsa.gemspec +1 -1
  164. data/vm_guest_run.sh +75 -28
  165. metadata +60 -4
  166. data/run_tests.rb +0 -89
  167. data/run_tests_vm.sh +0 -130
@@ -1,17 +1,21 @@
1
1
  # Vim keybinding scheme: standard vim behavior, as close as the current
2
- # action inventory allows. Standalone scheme file (does not load vimlike);
3
- # selected via cnf.keybindings.scheme = "vim" (applied on restart).
2
+ # action inventory allows. Does not load vimlike. The Vim bindings themselves
3
+ # are the shared VIM_BINDINGS table (key_bindings_vim_core.rb), which vimlike also loads
4
+ # where it doesn't conflict; this file adds the modes and the vim keymap's own
5
+ # deviations. Selected via cnf.keybindings.scheme = "vim" (applied on restart).
4
6
  #
7
+ # Operators, motions and text objects combine freely (d w, c 3 e, g U t x,
8
+ # > j, d i (, ...): the "vim operators" templates of VIM_BINDINGS and the key
9
+ # sets in vim_operators.rb.
5
10
  # Not implemented (no core primitives) — intentionally left unbound:
6
- # generic {op}{motion} operator-pending, t/T, %, ?, #, W/B/E/ge,
7
- # V (linewise) / ctrl-v (blockwise) visual, : ex commands, >>/<<,
8
- # named registers, faithful change-only "." repeat, backward ranges
9
- # (db, cb, insert-mode ctrl-w).
11
+ # %, ?, #, ge, { }, ( ), = and gq, V (linewise) / ctrl-v (blockwise)
12
+ # visual, : ex commands, insert-mode ctrl-w; "." of a Visual mode change.
10
13
  # Known deviations kept on purpose:
11
- # "$" parks the cursor on the newline (one past vim's last char);
12
14
  # C tab = switch to last buffer; C enter = line action;
13
15
  # ctrl-d/ctrl-u scroll a full page, not half; ctrl-o approximates the
14
- # jumplist with jump_to_last_edit; "." repeats only the last f/F find.
16
+ # jumplist with jump_to_last_edit.
17
+ # Known deviation, not fixed yet: esc in Insert mode doesn't move the cursor
18
+ # one character left.
15
19
 
16
20
  module Vimamsa
17
21
  vma.kbd.add_mode("C", :command)
@@ -54,301 +58,43 @@ def insert_move(op)
54
58
  _insert_move(op)
55
59
  end
56
60
 
57
- # ── composite actions for vim commands not covered by a single action ────────
61
+ # Vim behavior: the shared table and its actions, see key_bindings_vim_core.rb
62
+ bind_vim_bindings
58
63
 
59
- # get_range(:to_line_end) inverts on an empty line / cursor-on-newline and
60
- # would delete the previous newline (buffer.rb get_range) => guard.
61
- reg_act(:vim_delete_to_eol, proc {
62
- b = buf
63
- b.delete2(:to_line_end) if b.pos < b.line_ends[b.lpos]
64
- }, "Delete to end of line (vim D)")
65
-
66
- reg_act(:vim_change_to_eol, proc {
67
- b = buf
68
- b.delete2(:to_line_end) if b.pos < b.line_ends[b.lpos]
69
- vma.kbd.set_mode(:insert)
70
- }, "Change to end of line (vim C / c$)")
71
-
72
- reg_act(:vim_change_line, proc {
73
- b = buf
74
- b.jump(BEGINNING_OF_LINE)
75
- b.delete2(:to_line_end) if b.pos < b.line_ends[b.lpos]
76
- vma.kbd.set_mode(:insert)
77
- }, "Change whole line, keep newline (vim cc/S)")
78
-
79
- reg_act(:vim_change_word, proc {
80
- buf.delete2(:to_word_end) # vim cw ~= ce semantics; close enough
81
- vma.kbd.set_mode(:insert)
82
- }, "Change word (vim cw/ce)")
83
-
84
- reg_act(:vim_substitute_char, proc {
85
- buf.delete(CURRENT_CHAR_FORWARD) if buf.current_char != "\n"
86
- vma.kbd.set_mode(:insert)
87
- }, "Substitute char (vim s)")
88
-
89
- reg_act(:vim_delete_char, proc {
90
- buf.delete(CURRENT_CHAR_FORWARD) if buf.current_char != "\n"
91
- }, "Delete char under cursor; no-op on empty line (vim x)")
92
-
93
- reg_act(:vim_delete_char_backward, proc {
94
- buf.delete(BACKWARD_CHAR) if buf.cpos > 0
95
- }, "Delete char before cursor; no-op at col 0 (vim X)")
96
-
97
- reg_act(:vim_open_line_above, proc {
98
- b = buf
99
- b.jump(BEGINNING_OF_LINE)
100
- # insert_txt_at neither auto-indents nor moves the cursor: @pos ends up on
101
- # the inserted "\n" = the new empty line, matching vim O.
102
- b.insert_txt_at("\n", b.pos)
103
- b.set_pos(b.pos) # refresh view + lpos/cpos
104
- vma.kbd.set_mode(:insert)
105
- }, "Open line above (vim O)")
106
-
107
- reg_act(:vim_change_selection, proc {
108
- buf.delete(SELECTION) # ends visual mode itself
109
- vma.kbd.set_mode(:insert)
110
- }, "Delete selection and enter insert mode (vim visual c/s)")
111
-
112
- # APPROXIMATION: set_last_command is currently only fed by f/F finds, so this
113
- # repeats the last find, not the last change like vim's ".".
114
- reg_act(:vim_repeat_last_action, proc { repeat_last_action() },
115
- "Repeat last recorded command (approximation of vim .)")
116
-
117
- # ── motions ──────────────────────────────────────────────────────────────────
118
-
119
- add_keys "vim motion", {
120
- "VCX up" => "buf.move(BACKWARD_LINE)",
121
- "VCX down" => "buf.move(FORWARD_LINE)",
122
- "VCX right" => "buf.move(FORWARD_CHAR)",
123
- "VCX left" => "buf.move(BACKWARD_CHAR)",
124
- "VC h" => :e_move_backward_char,
125
- "VC l" => :e_move_forward_char,
126
- "VC j" => :forward_line,
127
- "VC k" => :backward_line,
128
- "C space" => "buf.move(FORWARD_CHAR)",
129
- "C backspace" => "buf.move(BACKWARD_CHAR)",
130
-
131
- "VC e" => :jump_next_word_end,
132
- "VC b" => :jump_prev_word_start,
133
- "VC w" => :jump_next_word_start,
134
-
135
- # NOTE: "G(condition)" must be defined before "G"
136
- "VC G(vma.kbd.next_command_count!=nil)" => "buf.jump_to_line()",
137
- "VC G" => :jump_end_of_buffer,
138
- "VC g g" => :jump_start_of_buffer,
139
- "VC g ;" => :jump_last_edit,
140
-
141
- # Counts; "0" is BOL only when no count is pending
142
- "VC /[1-9]/" => "vma.kbd.set_next_command_count(<char>)",
143
- "VC 0(vma.kbd.next_command_count!=nil)" => "vma.kbd.set_next_command_count(<char>)",
144
- "VC 0(vma.kbd.next_command_count==nil)" => "buf.jump(BEGINNING_OF_LINE)",
145
- "VC ^" => "buf.jump(FIRST_NON_WHITESPACE)",
146
- "VC $" => "buf.jump(END_OF_LINE)",
147
-
148
- "VC f <char>" => "buf.jump_to_next_instance_of_char(<char>)",
149
- "VC F <char>" => "buf.jump_to_next_instance_of_char(<char>,BACKWARD)",
150
- "VC f space" => "buf.jump_to_next_instance_of_char(' ')",
151
- "VC F space" => "buf.jump_to_next_instance_of_char(' ',BACKWARD)",
152
- "VC ;" => "repeat_last_find",
153
-
154
- "VC *" => "buf.jump_to_next_instance_of_word",
155
- "VC /" => :find_in_buffer,
156
- "C :" => :start_cmd_line,
157
- "C n" => :find_next,
158
- "C N" => "$search.jump_to_previous()",
159
-
160
- "VCI pagedown" => :page_down,
161
- "VCI pageup" => :page_up,
162
- "C ctrl-f" => :page_down,
163
- "C ctrl-b" => :page_up,
164
- "C ctrl-d" => "buf.move(:forward_page)", # approx: full page, vim: half
165
- "C ctrl-u" => "buf.move(:backward_page)", # approx: full page, vim: half
166
- "C ctrl-o" => :jump_to_last_edit, # approx of vim jumplist back
167
- "C z z" => :center_on_current_line,
168
-
169
- # Marks
170
- "CV m <char>" => "buf.mark_current_position(<char>)",
171
- 'CV \' <char>' => "buf.jump_to_mark(<char>)",
172
- "C ` <char>" => "buf.jump_to_mark(<char>)",
173
- }
174
-
175
- # ── editing ──────────────────────────────────────────────────────────────────
176
-
177
- add_keys "vim edit", {
178
- # Enter insert mode
179
- "C i" => :insert_mode,
180
- "C a" => "buf.move(FORWARD_CHAR);vma.kbd.set_mode(:insert)",
181
- "C A" => "buf.jump(END_OF_LINE);vma.kbd.set_mode(:insert)",
182
- "C I" => "buf.jump(FIRST_NON_WHITESPACE);vma.kbd.set_mode(:insert)",
183
- "C o" => 'buf.jump(END_OF_LINE);buf.insert_txt("\n");vma.kbd.set_mode(:insert)',
184
- "C O" => :vim_open_line_above,
185
-
186
- # Delete
187
- "C x" => :vim_delete_char,
188
- "C X" => :vim_delete_char_backward,
189
- "C d d" => [:delete_line, proc { buf.delete_line }, "Delete current line"],
190
- "C d e" => "buf.delete2(:to_word_end)",
191
- "C d w" => :delete_to_next_word_start,
192
- "C d $" => :vim_delete_to_eol,
193
- "C d 0" => :delete_to_line_start,
194
- "C d ' <char>" => "buf.delete2(:to_mark,<char>)",
195
- "C d f <char>" => "buf.delete2(:to_char,<char>)",
196
- "C d F <char>" => "buf.delete2(:to_char_backward,<char>)",
197
- "C d f space" => "buf.delete2(:to_char,' ')",
198
- "C d F space" => "buf.delete2(:to_char_backward,' ')",
199
- "C D" => :vim_delete_to_eol,
200
-
201
- # Change / substitute
202
- "C c c" => :vim_change_line,
203
- "C c w" => :vim_change_word,
204
- "C c e" => :vim_change_word,
205
- "C c $" => :vim_change_to_eol,
206
- "C C" => :vim_change_to_eol,
207
- "C S" => :vim_change_line,
208
- "C s" => :vim_substitute_char,
209
-
210
- # Yank / paste
211
- "C y y" => :copy_cur_line,
212
- "C Y" => :copy_cur_line,
213
- "C y w" => "buf.copy(:to_next_word)",
214
- "C y e" => "buf.copy(:to_word_end)",
215
- "C y $" => "buf.copy(:to_line_end)",
216
- "C y 0" => "buf.copy(:to_line_start)",
217
- "C y ' <char>" => "buf.copy(:to_mark,<char>)",
218
- "C p" => :paste_after_cursor,
219
- "C P" => :paste_before_cursor,
220
-
221
- # Misc edits
222
- "C r <char>" => "buf.replace_with_char(<char>)",
223
- "C r space" => "buf.replace_with_char(' ')",
224
- "C J" => "buf.join_lines()",
225
- "C ~" => :vim_toggle_case,
226
- "C g U w" => :word_upcase,
227
- "C g u w" => :word_downcase,
228
- "C g ~ w" => :word_swapcase,
229
- "C g U U" => :line_upcase,
230
- "C g u u" => :line_downcase,
231
- "C g ~ ~" => :line_swapcase,
232
- "C ctrl-a" => "buf.increment_current_word", # vim ctrl-a: increment number
233
- "C ." => :vim_repeat_last_action,
234
-
235
- # Undo / redo
236
- "C u" => :undo,
237
- "C ctrl-r" => :redo,
238
- }
239
-
240
- # ── visual mode ──────────────────────────────────────────────────────────────
241
-
242
- add_keys "vim visual", {
243
- "C v" => :start_visual_mode,
244
- "V esc" => "buf.end_visual_mode",
245
- "V ctrl-c" => "buf.end_visual_mode",
246
- "V y" => "buf.copy_active_selection()",
247
- "V d" => [:delete_selection, proc { buf.delete(SELECTION) }, ""],
248
- "V x" => "buf.delete(SELECTION)",
249
- "V s" => :vim_change_selection,
250
- "V c" => :vim_change_selection,
251
- "V J" => :V_join_lines,
252
- "V u" => "buf.transform_selection(:downcase)",
253
- "V U" => "buf.transform_selection(:upcase)",
254
- "V ~" => "buf.transform_selection(:swapcase)",
255
- "V g U" => :selection_upcase,
256
- "V g u" => :selection_downcase,
257
- "V >" => "buf.indent_selection",
258
- "V <" => "buf.unindent_selection",
259
- }
260
-
261
- # ── insert mode ──────────────────────────────────────────────────────────────
262
-
263
- add_keys "vim insert", {
264
- "I esc" => :prev_mode,
265
- "I ctrl-c" => :prev_mode, # vim: ctrl-c leaves insert mode
266
- "I <char>" => "buf.insert_txt(<char>)",
267
- "I space" => 'buf.insert_txt(" ")',
268
- "I enter" => :insert_new_line,
269
- "I backspace" => :insert_backspace,
270
- "I ctrl-h" => :insert_backspace, # vim i_ctrl-h = backspace
271
- "I ctrl-j" => "buf.insert_new_line()", # vim i_ctrl-j = new line
272
-
273
- # Completion (vim i_ctrl-n / i_ctrl-p; popup guards first)
274
- "I tab(vma.buf.view.autocp_active)" => "vma.buf.view.autocp_select_next",
275
- "I shift-tab(vma.buf.view.autocp_active)" => "vma.buf.view.autocp_select_previous",
276
- "I shift!(vma.buf.view.autocp_active)" => "vma.buf.view.autocp_select",
277
- "I ctrl-n" => :autocp_manual_trigger,
278
- "I ctrl-p" => :autocp_manual_trigger,
279
- "I ctrl-space" => :autocp_manual_trigger,
280
-
281
- "I tab" => "buf.insert_tab",
282
- "I shift-tab" => "buf.unindent",
283
-
284
- "I shift-up" => :insert_select_up,
285
- "I shift-down" => "insert_select_move(FORWARD_LINE)",
286
- "I shift-left" => "insert_select_move(BACKWARD_CHAR)",
287
- "I shift-right" => "insert_select_move(FORWARD_CHAR)",
288
- "I shift-pagedown" => "insert_select_move(:pagedown)",
289
- "I shift-pageup" => "insert_select_move(:pageup)",
290
-
291
- "I left" => "insert_move(BACKWARD_CHAR)",
292
- "I right" => "insert_move(FORWARD_CHAR)",
293
- "I down" => "insert_move(FORWARD_LINE)",
294
- "I up" => "insert_move(BACKWARD_LINE)",
295
- "I pagedown" => "insert_move(:pagedown)",
296
- "I pageup" => "insert_move(:pageup)",
297
- }
298
-
299
- # ── replace mode (vim R) ─────────────────────────────────────────────────────
300
-
301
- add_keys "vim replace", {
302
- "C R" => "vma.kbd.set_mode(:replace)",
303
- "X esc" => "vma.kbd.to_previous_mode",
304
- "X <char>" => "buf.replace_with_char(<char>);buf.move(FORWARD_CHAR)",
305
- }
306
-
307
- # ── macros / infrastructure ──────────────────────────────────────────────────
308
-
309
- add_keys "vim misc", {
310
- # Macros: q<char> records, q stops, @<char> runs, @@ repeats
311
- "VC q <char>" => "vma.kbd.set_mode(:macro);vma.macro.start_recording(<char>)",
312
- "macro q" => "vma.kbd.to_previous_mode; vma.macro.end_recording",
313
- "C @ @" => :run_last_macro,
314
- "C @ <char>" => "vma.macro.run_macro(<char>)",
315
-
316
- # READCHAR mode (argument input for f/F, r, m, ', q, @)
317
- "R <char>" => "readchar_new_char(<char>)",
64
+ # ── vim keymap's own bindings (not Vim behavior) ─────────────────────────────
318
65
 
66
+ add_keys "vim misc cat:buffer", {
319
67
  # Kept deviations (documented in the header)
320
- "C tab" => "bufs.switch_to_last_buf",
68
+ "C tab" => "buf.switch.last",
321
69
  # prev/next file in file panel order (no-op while the panel is hidden)
322
- "C alt-h" => :file_panel_prev_file,
323
- "C alt-l" => :file_panel_next_file,
324
- "C enter || C return" => [:line_action, proc { buf.handle_line_action() }, "Line action"],
325
-
326
- # Browse mode keys (mode reachable only via the :start_browse_mode action)
327
- "B h" => :history_switch_backwards,
328
- "B l" => :history_switch_forwards,
329
- "B p" => :file_panel_prev_file,
330
- "B n" => :file_panel_next_file,
331
- "B z" => "center_on_current_line();call_action(:exit_browse_mode)",
332
- "B enter || B return || B esc || B j || B ctrl!" => :exit_browse_mode,
333
- "B s" => :page_up,
334
- "B d" => :page_down,
335
- "B r" => proc { vma.gui.page_down(multip: 0.25) },
336
- "B e" => proc { vma.gui.page_up(multip: 0.25) },
337
- "B i" => :jump_to_start_of_buffer,
338
- "B o" => :jump_to_end_of_buffer,
339
- "B c" => :close_current_buffer,
340
- "B ;" => :jump_last_edit,
341
- "B q" => :jump_to_last_edit,
342
- "B w" => :jump_to_next_edit,
343
- "B m" => :run_last_macro,
70
+ "C alt-h" => "panel.files.prev",
71
+ "C alt-l" => "panel.files.next",
72
+ "C enter || C return" => ["jump.line", proc { buf.handle_line_action() }, "Line action"],
73
+
74
+ # Browse mode keys (mode reachable only via the "mode.browse" action)
75
+ "B h" => "buf.history.prev",
76
+ "B l" => "buf.history.next",
77
+ "B p" => "panel.files.prev",
78
+ "B n" => "panel.files.next",
79
+ "B z" => "mode.browse.center",
80
+ "B enter || B return || B esc || B j || B ctrl!" => "mode.browse.exit",
81
+ "B s" => "move.page.prev",
82
+ "B d" => "move.page.next",
83
+ "B r" => "move.page.next.quarter",
84
+ "B e" => "move.page.prev.quarter",
85
+ "B i" => "move.buf.start",
86
+ "B o" => "move.buf.end",
87
+ "B c" => "buf.close",
88
+ "B ;" => "jump.edit.prev",
89
+ "B q" => "jump.edit.prev",
90
+ "B w" => "jump.edit.next",
91
+ "B m" => "macro.run.last",
344
92
  }
345
93
 
346
94
  # Audio minor mode (used by the audio module; unreachable without it)
347
- bindkey "audio f || audio right", [:audio_forward, proc { Audio.seek_forward }, "Seek forward in audio stream"]
348
- bindkey "audio left", [:audio_backward, proc { Audio.seek_forward(-5.0) }, "Seek backward in audio stream"]
349
- bindkey "audio space", :audio_stop
350
- bindkey "audio q || audio esc", "vma.kbd.to_previous_mode"
95
+ bindkey "audio f || audio right", ["audio.forward", proc { Audio.seek_forward }, "Seek forward in audio stream"]
96
+ bindkey "audio left", ["audio.backward", proc { Audio.seek_forward(-5.0) }, "Seek backward in audio stream"]
97
+ bindkey "audio space", "audio.stop"
98
+ bindkey "audio q || audio esc", "mode.prev"
351
99
 
352
- # Text objects (diw, ci", ya(, vip, ...), see text_objects.rb
353
- bind_vim_text_objects
354
100
  end # module Vimamsa