vimamsa 0.1.27 → 0.1.28

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 (156) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +139 -89
  3. data/custom_example.rb +18 -6
  4. data/doc/TODO.md +327 -110
  5. data/doc/action_names_plan.md +442 -0
  6. data/doc/bundling_plan.md +2 -1
  7. data/doc/delta_syntax_plan.md +293 -0
  8. data/doc/demo_recording_plan.md +288 -0
  9. data/doc/design_goals.md +27 -0
  10. data/doc/intro_page_plan.md +266 -0
  11. data/doc/key_bindings_report_plan.md +45 -0
  12. data/doc/line_tree_plan.md +89 -0
  13. data/doc/missing_vim_bindings.md +34 -44
  14. data/doc/modules_settings_plan.md +1 -1
  15. data/doc/registries_plan.md +202 -0
  16. data/doc/startup_speed_plan.md +97 -0
  17. data/doc/treap_visualizer.html +585 -0
  18. data/doc/vim_compatibility_plan.md +186 -31
  19. data/doc/vimlike_vim_conflicts.md +236 -228
  20. data/doc/vm_snapshots_plan.md +4 -4
  21. data/doc/wysiwyg_plan.md +231 -0
  22. data/exe/run_tests.rb +8 -1
  23. data/exe/vimamsa +49 -6
  24. data/help/intro.txt +30 -0
  25. data/help/vim_intro.txt +31 -0
  26. data/img/demo.gif +0 -0
  27. data/img/demo.mp4 +0 -0
  28. data/lang/hyperplaintext.lang +1 -1
  29. data/lib/vimamsa/ack.rb +2 -0
  30. data/lib/vimamsa/actions.rb +381 -36
  31. data/lib/vimamsa/bookmarks.rb +8 -8
  32. data/lib/vimamsa/buffer.rb +83 -37
  33. data/lib/vimamsa/buffer_changetext.rb +58 -36
  34. data/lib/vimamsa/buffer_list.rb +2 -2
  35. data/lib/vimamsa/buffer_manager.rb +6 -6
  36. data/lib/vimamsa/cli_help.rb +75 -0
  37. data/lib/vimamsa/clipboard.rb +6 -3
  38. data/lib/vimamsa/conf.rb +9 -0
  39. data/lib/vimamsa/crash_handler.rb +2 -2
  40. data/lib/vimamsa/debug.rb +2 -2
  41. data/lib/vimamsa/demo_player.rb +458 -0
  42. data/lib/vimamsa/demo_recorder.rb +277 -0
  43. data/lib/vimamsa/diff_buffer.rb +1 -1
  44. data/lib/vimamsa/dot_repeat.rb +104 -0
  45. data/lib/vimamsa/easy_jump.rb +54 -3
  46. data/lib/vimamsa/editor.rb +89 -46
  47. data/lib/vimamsa/file_history.rb +1 -1
  48. data/lib/vimamsa/file_manager.rb +23 -23
  49. data/lib/vimamsa/form_input.rb +388 -0
  50. data/lib/vimamsa/gui.rb +83 -13
  51. data/lib/vimamsa/gui_command_line.rb +44 -5
  52. data/lib/vimamsa/gui_form_generator.rb +17 -6
  53. data/lib/vimamsa/gui_key_hint.rb +165 -0
  54. data/lib/vimamsa/gui_keylog_panel.rb +164 -2
  55. data/lib/vimamsa/gui_menu.rb +69 -50
  56. data/lib/vimamsa/gui_select_window.rb +77 -43
  57. data/lib/vimamsa/gui_settings.rb +9 -5
  58. data/lib/vimamsa/gui_sourceview.rb +15 -81
  59. data/lib/vimamsa/gui_theme.rb +11 -2
  60. data/lib/vimamsa/hook.rb +2 -0
  61. data/lib/vimamsa/intro_page.rb +368 -0
  62. data/lib/vimamsa/key_actions.rb +315 -225
  63. data/lib/vimamsa/key_binding_tree.rb +228 -61
  64. data/lib/vimamsa/key_bindings_notepad.rb +18 -16
  65. data/lib/vimamsa/key_bindings_report.rb +290 -67
  66. data/lib/vimamsa/key_bindings_vim.rb +47 -297
  67. data/lib/vimamsa/key_bindings_vimlike.rb +347 -339
  68. data/lib/vimamsa/key_names.rb +80 -0
  69. data/lib/vimamsa/line_tree.rb +367 -0
  70. data/lib/vimamsa/macro.rb +20 -3
  71. data/lib/vimamsa/rbvma.rb +15 -0
  72. data/lib/vimamsa/registers.rb +125 -0
  73. data/lib/vimamsa/run_ruby.rb +64 -0
  74. data/lib/vimamsa/search_replace.rb +4 -4
  75. data/lib/vimamsa/string_util.rb +17 -3
  76. data/lib/vimamsa/tests.rb +8 -8
  77. data/lib/vimamsa/text_objects.rb +11 -54
  78. data/lib/vimamsa/text_transforms.rb +4 -0
  79. data/lib/vimamsa/tmp_user_dir.rb +39 -0
  80. data/lib/vimamsa/user_dirs.rb +83 -0
  81. data/lib/vimamsa/version.rb +1 -1
  82. data/lib/vimamsa/vim_core.rb +355 -0
  83. data/lib/vimamsa/vim_operators.rb +365 -0
  84. data/modules/calculator/calculator.rb +5 -5
  85. data/modules/color_highlight/color_highlight.rb +3 -3
  86. data/modules/dictation/dictation.rb +32 -32
  87. data/modules/ollama/ollama.rb +5 -5
  88. data/modules/terminal/terminal.rb +5 -5
  89. data/modules/tts/tts.rb +10 -10
  90. data/run_e2e_vm.sh +3 -3
  91. data/run_tests_vm.rb +138 -0
  92. data/scripts/demo/demo_easyjump_steps.txt +60 -0
  93. data/scripts/demo/demo_files_steps.txt +52 -0
  94. data/scripts/demo/demo_steps.txt +9 -1
  95. data/scripts/demo/notes.txt +6 -0
  96. data/scripts/demo/record_demo.rb +60 -81
  97. data/scripts/demo/report.rb +7 -0
  98. data/scripts/demo/shapes.rb +1 -0
  99. data/scripts/demo/square/shapes.rb +29 -0
  100. data/scripts/demo/square/steps.txt +185 -0
  101. data/scripts/lib/perf_startup.rb +138 -0
  102. data/scripts/lib/script_helpers.rb +53 -0
  103. data/scripts/perf_compare.rb +34 -0
  104. data/scripts/profile_startup.rb +72 -0
  105. data/tests/test_action_ids.rb +232 -0
  106. data/tests/test_auto_format.rb +2 -2
  107. data/tests/test_autocomplete.rb +1 -1
  108. data/tests/test_basic_editing.rb +18 -18
  109. data/tests/test_bookmarks.rb +6 -6
  110. data/tests/test_bracket_match.rb +3 -0
  111. data/tests/test_cli_help.rb +64 -0
  112. data/tests/test_color_highlight.rb +2 -2
  113. data/tests/test_command_line.rb +1 -1
  114. data/tests/test_context_menu_file.rb +18 -0
  115. data/tests/test_copy_paste.rb +33 -33
  116. data/tests/test_custom_two_phase.rb +1 -1
  117. data/tests/test_demo_player.rb +301 -0
  118. data/tests/test_demo_recorder.rb +202 -0
  119. data/tests/test_dictation.rb +16 -16
  120. data/tests/test_dot_repeat.rb +88 -0
  121. data/tests/test_easy_jump.rb +93 -0
  122. data/tests/test_extract_file_links.rb +3 -3
  123. data/tests/test_file_panel.rb +2 -2
  124. data/tests/test_flash.rb +1 -1
  125. data/tests/test_fold.rb +1 -1
  126. data/tests/test_form_input.rb +203 -0
  127. data/tests/test_func_panel.rb +2 -2
  128. data/tests/test_gtk_sync.rb +7 -7
  129. data/tests/test_intro_page.rb +437 -0
  130. data/tests/test_key_categories.rb +163 -0
  131. data/tests/test_keylog_panel.rb +163 -3
  132. data/tests/test_line_ends.rb +51 -0
  133. data/tests/test_line_tree.rb +86 -0
  134. data/tests/test_lsp_clangd.rb +2 -2
  135. data/tests/test_macro.rb +2 -2
  136. data/tests/test_module_interface.rb +9 -9
  137. data/tests/test_notepad_bindings.rb +5 -5
  138. data/tests/test_perf_startup.rb +28 -0
  139. data/tests/test_random_edit.rb +27 -27
  140. data/tests/test_registers.rb +122 -0
  141. data/tests/test_run_ruby.rb +77 -0
  142. data/tests/test_startup_file.rb +1 -1
  143. data/tests/test_text_objects.rb +1 -1
  144. data/tests/test_text_transforms.rb +12 -0
  145. data/tests/test_tmp_user_dir.rb +79 -0
  146. data/tests/test_tts.rb +10 -10
  147. data/tests/test_undo.rb +34 -34
  148. data/tests/test_user_dirs.rb +122 -0
  149. data/tests/test_vim_bindings.rb +107 -6
  150. data/tests/test_vim_conflicts.rb +41 -4
  151. data/tests/test_vim_operators.rb +116 -0
  152. data/tests/test_window_layout.rb +83 -0
  153. data/vimamsa.gemspec +1 -1
  154. data/vm_guest_run.sh +22 -2
  155. metadata +58 -3
  156. data/run_tests_vm.sh +0 -130
@@ -1,9 +1,9 @@
1
1
  # Plan: better Vim compatibility
2
2
 
3
- TODO: act next on item 1 of "Order of work": the shared `VIM_BINDINGS` table,
4
- loading its non-conflicting entries into vimlike. Then step 1, the operator +
5
- motion layer. When an item is finished, move it to the DONE section at the end
6
- of this document with a short summary and the git ref(s).
3
+ TODO: act next on item 4 of "Order of work": missing motions (items 1-3 are
4
+ done). When an item is finished, move it
5
+ to the DONE section at the end of this document with a short summary and the
6
+ git ref(s).
7
7
 
8
8
  Goal: someone who knows Vim can start using Vimamsa without relearning basic
9
9
  editing.
@@ -19,11 +19,13 @@ today. This file says what to build, and in which order.
19
19
 
20
20
  ## Why the grammar matters most
21
21
 
22
- Today each key combination is bound by hand (`C d e`, `C c w`, `C y $`, ...).
23
- Vim users don't memorize those combinations. They combine an operator, a count
24
- and a motion. Any combination nobody wrote out does nothing, and users notice
25
- that within minutes. So the first and biggest step is a general
26
- operator + motion layer. Most of the later steps build on it.
22
+ Today each key combination is bound by hand (`C d e`, `C c w`, `C y $`, ...),
23
+ and the text objects are generated by a loop in `text_objects.rb`. Vim users
24
+ don't memorize those combinations. They combine an operator, a count and a
25
+ motion. Any combination nobody wrote out does nothing, and users notice that
26
+ within minutes. So the first and biggest step is a general operator + motion
27
+ layer, written as a binding syntax (`C <op> <motion>`, step 1). Most of the
28
+ later steps build on it.
27
29
 
28
30
  ## Shared Vim bindings
29
31
 
@@ -87,6 +89,62 @@ These are from reading the code; the report is the authority:
87
89
 
88
90
  ### 1. Operator + motion layer
89
91
 
92
+ #### Binding syntax: key sets
93
+
94
+ Operators, motions and text objects are defined as **key sets** in the keymap
95
+ files, as data, not hardcoded in Ruby. Bindings then combine them with
96
+ placeholders, the same way `<char>` and `<num>` work today:
97
+
98
+ ```ruby
99
+ # lib/vimamsa/vim_core.rb (shared), next to VIM_BINDINGS
100
+ define_key_set :op, {
101
+ "d" => :delete, "c" => :change, "y" => :yank,
102
+ ">" => :indent, "<" => :unindent, "=" => :reindent,
103
+ "g u" => :downcase, "g U" => :upcase, "g ~" => :swapcase, "g q" => :format,
104
+ }
105
+ define_key_set :motion, {
106
+ "w" => :word_next, "b" => :word_prev, "e" => :word_end,
107
+ "0" => :line_start, "^" => :line_first_char, "$" => :line_end,
108
+ "j" => :line_down, "k" => :line_up, "g g" => :buf_start, "G" => :buf_end,
109
+ "f <char>" => :find_char, "t <char>" => :till_char, ...
110
+ }
111
+ define_key_set :textobj, { "i <obj>" => :inner, "a <obj>" => :around } # <obj> from text_objects.rb
112
+
113
+ add_keys "vim operators", {
114
+ "C <op> <motion>" => :operator_motion, # d w, c e, y $, g U w
115
+ "C <op> <textobj>" => :operator_textobj, # d i w, c a "
116
+ "C <op> <same>" => :operator_lines, # d d, c c, > >, g U U
117
+ "C <motion>" => :motion_move, # plain cursor movement
118
+ "V <motion>" => :motion_extend, # extend the selection
119
+ "V <op>" => :operator_selection, # V >, v g U
120
+ }
121
+ ```
122
+
123
+ - **The action gets the matched values**, e.g. `operator_motion(op: :delete,
124
+ motion: :word_next, count: 6, char: nil)`. It doesn't parse keys.
125
+ - **Counts:** `<num>` is allowed before the operator and before the motion
126
+ without writing it out, and the counts multiply (`2 d 3 w` = 6). This reuses
127
+ `match_num_key` (`key_binding_tree.rb:505`).
128
+ - **Motion properties live in the set entry:** linewise, and inclusive or
129
+ exclusive, e.g. `"j" => { id: :line_down, linewise: true }`. The motion
130
+ objects (below) then only compute the target position.
131
+ - **Each keymap owns its sets.** `vim` uses the full sets. `vimlike` uses the same
132
+ sets minus the keys it binds to something else, and the conflict check
133
+ decides that. `custom.rb` can extend a set:
134
+ `key_set_add :motion, "ö" => :para_next`. Every operator then works with the
135
+ new motion.
136
+ - **Implementation:** expand the templates into concrete tree nodes when they're
137
+ bound. For example, `C <op> <motion>` becomes `C d w`, `C g U $`, … Each node
138
+ remembers the values it was expanded from and the template it came from. That
139
+ keeps the existing tree, prefix matching, `esc` cancelling and the conflict
140
+ check working unchanged. The help page can show the template line instead of
141
+ hundreds of expanded ones (see `doc/key_bindings_report_plan.md`). A key set
142
+ change rebinds the templates that use it.
143
+ - The hand-made bindings and the text-object loop in `text_objects.rb:347` are
144
+ replaced by these templates.
145
+
146
+ #### Behavior
147
+
90
148
  - **Motions** are objects that, given a buffer, a position and a count, return
91
149
  a target position. Each one is also marked:
92
150
  - charwise or linewise (`j`, `k`, `G` and `gg` are linewise),
@@ -97,21 +155,20 @@ These are from reading the code; the report is the authority:
97
155
  - **Counts** work on both and multiply: `3dw`, `d3w`, `2d3w`. Counts inside a
98
156
  sequence already work where a binding has `<num>` (see DONE); the layer makes
99
157
  them general.
100
- - **Operator-pending state in `KeyBindingTree`.** After an operator key, the
101
- next keys are read as a motion or text object, with an optional count. `esc`
102
- cancels.
158
+ - **Operator-pending state** comes from the expanded tree. After `d`, the tree is
159
+ in the middle of the `C <op> <motion>` sequences, and `esc` cancels as for any
160
+ other sequence. The mode indicator shows `d` while it waits.
103
161
  - The same motion objects drive plain cursor movement and Visual-mode extension,
104
162
  so each motion is written only once.
105
163
  - Keep `cw` behaving like `ce`, and keep `dw` stopping at the end of the line,
106
164
  as in Vim.
107
- - Replace the hand-made bindings (`C d e`, `C c w`, `C y $`, ...) with the
108
- generic layer.
109
165
 
110
166
  The conflict check applies inside operator-pending state too. When vimlike
111
167
  binds `d <x>` to something of its own, that wins, and the report lists it.
112
168
 
113
169
  ### 2. Missing motions
114
170
 
171
+
115
172
  - `t` / `T`, with `;` and `,` repeating them.
116
173
  - `%`.
117
174
  - `?`, and `#` for the word under the cursor.
@@ -144,19 +201,28 @@ through other keys if wanted.
144
201
  - `.` repeats the last change exactly: the operator, the motion and count, and
145
202
  any text typed in Insert mode. Recording changes as data (step 1) makes this
146
203
  possible.
147
- - One Insert-mode session (`i...esc`) is one undo step.
204
+ - One Insert-mode session (`i...esc`) is one undo step. (TODO: this should be configurable option. if user spends a long time in insert mode, this doesn't make sense)
148
205
 
149
206
  ### 5. Ex commands
150
207
 
151
- Extend `lib/vimamsa/gui_command_line.rb`, which already handles `:w :q :wq :e :42 :!`:
208
+ Only limited support: the few Ex commands people type every day, not Vim's
209
+ whole command language. Extend `lib/vimamsa/gui_command_line.rb`, which already
210
+ handles `:w :q :wq :e :42 :!`:
152
211
 
153
- - `:s/pat/rep/flags` with ranges: `%`, `.`, `$`, `N,M`, `'<,'>`. This comes first.
212
+ - `:s/pat/rep/flags` comes first. It takes a range: `%`, `.`, `$`, `N,M`, `'<,'>`
213
+ (the default is the current line).
214
+ - The pattern is a **Ruby regex**, as in the editor's other searches. There is
215
+ no translation of Vim regex syntax.
216
+ - The replacement uses Ruby's `gsub` syntax (`\1`, `\k<name>`, `\0`).
217
+ - Flags: `g` (all matches on a line), `i` (ignore case).
154
218
  - `:noh`, `:x`, `:wa`, `:qa`.
155
- - `:bn`, `:bp`, `:bd`, `:b N`.
156
- - `:<range>d`, `:<range>y`, `:<range>>`, `:g/pat/cmd`, `:v/pat/cmd`.
157
- - `:set` for common options, mapped onto `cnf`: `ts`, `sw`, `et`, `nu`,
158
- `wrap`, `ic`, `scs`.
159
- - Translate Vim regex syntax (`\<`, `\>`, `\(`, `\)`, `\v`) to Ruby regex.
219
+ - `:bn`, `:bp`, `:bd`.
220
+ - `:set` for a few options mapped onto `cnf`: `ts`, `sw`, `et`, `nu`, `wrap`.
221
+
222
+ Not planned: `:b N`, `:<range>d`, `:<range>y`, `:<range>>`, `:g` / `:v`, more
223
+ `:set` options. A command that looks like an Ex command (one word, with an
224
+ optional range), isn't supported, and also fails as Ruby gets "Ex command
225
+ `:xyz` is not supported" instead of a Ruby error.
160
226
 
161
227
  The command line already runs Ruby code as a fallback. Vim commands must be
162
228
  tried first, and Ruby only when nothing matches. The command line is shared,
@@ -246,17 +312,18 @@ which), or keep the restart.
246
312
 
247
313
  ## Order of work
248
314
 
249
- 1. Move the existing Vim bindings into the shared table. Load the
250
- non-conflicting ones into vimlike. This is small, and it defines the rules
251
- for everything after. (The conflict report and its test are done.)
252
- 2. The operator-pending layer, ported motions, and the differential test suite.
253
- Port the existing hand-made bindings first, so nothing gets worse. This
254
- includes the text object bindings, which are bound per operator for now.
255
- 3. Registers that remember linewise text, and linewise put.
315
+ 1. ~~Move the existing Vim bindings into the shared table. Load the
316
+ non-conflicting ones into vimlike.~~ Done, see DONE.
317
+ 2. ~~The key-set binding syntax (`<op>`, `<motion>`, `<textobj>`, `<same>`), the
318
+ operator layer and ported motions, and the differential test suite. Port the
319
+ existing hand-made bindings first, so nothing gets worse. This includes the
320
+ text object bindings, which are bound per operator for now.~~ Done, see DONE.
321
+ 3. ~~Registers that remember linewise text, and linewise put.~~ Done, see DONE.
256
322
  4. Missing motions.
257
323
  5. `V` and `ctrl-v`.
258
- 6. `.` repeat, and undo grouping for Insert sessions.
259
- 7. `:s` with ranges, then the other Ex commands.
324
+ 6. ~~`.` repeat, and undo grouping for Insert sessions.~~ Done (ahead of 4 and
325
+ 5), see DONE.
326
+ 7. `:s` with ranges, then the few other Ex commands.
260
327
  8. Onboarding: the first-run question and the differences page.
261
328
  9. Step 6 items and `.vimrc` import.
262
329
  10. The investigation into switching keymaps without restart. It can run any
@@ -291,6 +358,94 @@ Each step regenerates `doc/vimlike_vim_conflicts.md` and updates
291
358
  `e464117`): `tests/test_text_objects.rb` holds 57 cases with vim's results
292
359
  and re-checks them against `vim -Nu NONE -es` when vim is installed. The
293
360
  test VM now installs vim, so the check runs there.
361
+ - **Shared `VIM_BINDINGS` table** (2026-11-20, `f1535c7`):
362
+ `lib/vimamsa/vim_core.rb` holds the vim composite actions
363
+ (`reg_vim_actions`) and the table, moved out of `key_bindings_vim.rb`, which
364
+ now binds all of it with `bind_vim_bindings` and keeps only its modes and
365
+ its own deviations (`C tab`, `C enter`, browse mode, audio).
366
+ `key_bindings_vimlike.rb` ends with `bind_vim_bindings(only_free: true)`:
367
+ each entry is bound only if `vim_binding_status` finds it `:missing`, so
368
+ vimlike's own bindings win, and the menus keep showing vimlike's keys for an
369
+ action. That added 19 bindings to vimlike (`c w c e c c c $ D S Y . y w y $`,
370
+ `` ` ``, `ctrl-a ctrl-b ctrl-d ctrl-f ctrl-u`, Visual `< > c`); the 20
371
+ conflicts are unchanged. What was added is kept in `vma.kbd.vim_added`, and
372
+ the report has a new "Added to vimlike" group. `run_tests_vm.rb` forwards
373
+ `VMA_UPDATE_DOC=1` and copies the regenerated report back, so
374
+ `VMA_UPDATE_DOC=1 ./run_tests_vm.rb vim_conflicts` updates it from the VM.
375
+ Note for later steps: module and `custom.rb` bindings load after the table,
376
+ so they override an added entry with the same keys.
294
377
  - **Count inside a key sequence** (2026-11-19, `2e9fb0b`): `d 3 e` works, and
295
378
  any binding with `<num>`. The count multiplies one typed before the
296
379
  sequence (`2 d 3 e` = 6). A first piece of the counts in step 1.
380
+ - **Operator + motion layer** (step 1, order item 2; 2026-11-21). Key sets
381
+ and templates in `KeyBindingTree` (`define_key_set`, `key_set_add`,
382
+ `bind_template`): a binding like `"C <op> <motion>"` is expanded into one
383
+ tree node per combination, each remembering its values (`bind_args`) and
384
+ its template; the action gets the values, `a.op.motion!({ op: :delete,
385
+ motion: :word_next })`, plus the typed `<char>`. A `<num>` variant before
386
+ every placeholder but the first gives counts after the operator; they
387
+ multiply with a count before it. `key_set_add` binds the new combinations
388
+ of every template already bound. `lib/vimamsa/vim_operators.rb` has the
389
+ sets (`VIM_KEY_SETS`: operators `d c y gU gu g~ > <`, 27 motions, `i`/`a`
390
+ text objects), what each motion means (`VIM_MOTIONS`: linewise,
391
+ inclusive) and the Buffer methods (`vim_motion_target`,
392
+ `vim_operator_motion`, `vim_operator_lines`, `vim_apply_operator`, also
393
+ used by `text_object_op`). Vim rules: exclusive motions ending in column 0,
394
+ `dw` on the last word of a line, `cw` = `ce`, multi-line `d$` from the
395
+ indent is linewise, `5dd` with fewer lines does nothing. The templates are
396
+ the "vim operators" section of `VIM_BINDINGS`; the hand-made `d`/`c`/`y`/
397
+ `gU` combinations and `bind_vim_text_objects` are gone. The plain-motion
398
+ template (`VC <motion>`) is bound only where a keymap has no binding of its
399
+ own, so it adds `W B E t T` (and the vim keymap's `$` is now the vim
400
+ motion, fixing the old `$dFa` failure). vimlike adds its `O` motion to the
401
+ set. The key bindings page shows a template as one line and lists the key
402
+ sets; the conflicts report groups template expansions per template.
403
+ Deviation from the design above: motion properties (linewise, inclusive)
404
+ are in `VIM_MOTIONS`, not in the key set entries, because they belong to
405
+ the motion, not to its key. `=` and `gq` are not done.
406
+ Tests: `tests/test_vim_operators.rb` (vimlike, checked against real vim),
407
+ oracle cases in `tests/test_vim_bindings.rb` (vim keymap).
408
+ - **Registers** (step 4, order item 3; 2026-11-21). `lib/vimamsa/registers.rb`:
409
+ `vma.registers` holds each register's text and whether it was copied as
410
+ whole lines. `""` (unnamed), `"0` (last copy), `"1`–`"9` (deletes of
411
+ whole lines or of text spanning lines, shifted on each one), `"-` (smaller
412
+ deletes), `"a`–`"z` (`"A` appends; linewise if either part is), `"+` /
413
+ `"*` and the black hole `"_`. `"x` (Command and Visual mode, `edit.register`,
414
+ in the shared table; vimlike also keeps its `, r x`) selects a register
415
+ for the next command only; a count may come between (`"a3yy`).
416
+ `Clipboard#set(text, linewise:, kind:)` stores through the registers, so
417
+ every copy and delete (the operators, text objects, `yy`, `dd`, Visual
418
+ mode, ...) goes through one place; the system clipboard still gets every
419
+ copy except into `"_`. Put (`Buffer#paste_register`): a named register
420
+ directly; the unnamed one and `"+` / `"*` read the system clipboard, and
421
+ its text is put as lines only if it is what the editor copied as lines.
422
+ This replaces the per-buffer `@paste_lines`, so `yy` in one buffer and `p`
423
+ in another puts a line. Case changes and other text replacements no longer
424
+ overwrite the clipboard (`delete_range(..., register: false)`). Insert mode
425
+ `ctrl-r x` (`edit.insert.register`) is in the vim keymap only, listed in
426
+ `VIM_KEYMAP_ONLY` (no new ctrl chords in vimlike). `:reg` / `:registers` on
427
+ the command line and `edit.register.list` show the registers.
428
+ Not done: `".`, `"%`, `":`, `"/` and the expression register, keeping
429
+ registers across restarts, Visual mode put replacing the selection from a
430
+ register.
431
+ Tests: `tests/test_registers.rb`.
432
+ - **`.` repeat and Insert-session undo** (step 4, order item 6; 2026-11-21).
433
+ `lib/vimamsa/dot_repeat.rb` (`vma.dot`) follows the key tree's
434
+ `:key_action` / `:action_handled` events. A change is a command run from
435
+ Command mode that changed the buffer, or that started Insert or Replace
436
+ mode; then everything done until that mode is left is part of it (typed
437
+ text, backspace, the leaving key). It is stored as the tree ran it (for the
438
+ operator layer `a.op.motion!({...})`), with its count and register. `.`
439
+ (`undo.repeat`) runs it again through `handle_key_bindigs_action`, as one
440
+ undo step; a count given to `.` replaces the change's count, or for an
441
+ insert command (`i`, `a`, `o`) repeats the typed text. Undo, macros and
442
+ commands on files, buffers or the view are not changes. A mode change no
443
+ longer starts a new undo step while a group runs as one step (a macro, a
444
+ repeat). `cnf.undo.insert_one_step` (Settings ▸ Behavior, default false):
445
+ true makes an Insert session one undo step also across pauses; false
446
+ keeps the current behavior, where a pause of `cnf.undo.group_threshold`
447
+ seconds starts a new step.
448
+ Not done: `.` for Visual mode changes, `"1p...` stepping through the
449
+ numbered registers, a `cw` and its typed text as one undo step (they are
450
+ two). Found on the way: `esc` doesn't move the cursor left as in vim.
451
+ Tests: `tests/test_dot_repeat.rb`, oracle cases in `test_vim_bindings.rb`.