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.
- checksums.yaml +4 -4
- data/README.md +139 -89
- data/custom_example.rb +18 -6
- data/doc/TODO.md +327 -110
- data/doc/action_names_plan.md +442 -0
- data/doc/bundling_plan.md +2 -1
- data/doc/delta_syntax_plan.md +293 -0
- data/doc/demo_recording_plan.md +288 -0
- data/doc/design_goals.md +27 -0
- data/doc/intro_page_plan.md +266 -0
- data/doc/key_bindings_report_plan.md +45 -0
- data/doc/line_tree_plan.md +89 -0
- data/doc/missing_vim_bindings.md +34 -44
- data/doc/modules_settings_plan.md +1 -1
- data/doc/registries_plan.md +202 -0
- data/doc/startup_speed_plan.md +97 -0
- data/doc/treap_visualizer.html +585 -0
- data/doc/vim_compatibility_plan.md +186 -31
- data/doc/vimlike_vim_conflicts.md +236 -228
- data/doc/vm_snapshots_plan.md +4 -4
- data/doc/wysiwyg_plan.md +231 -0
- data/exe/run_tests.rb +8 -1
- data/exe/vimamsa +49 -6
- data/help/intro.txt +30 -0
- data/help/vim_intro.txt +31 -0
- data/img/demo.gif +0 -0
- data/img/demo.mp4 +0 -0
- data/lang/hyperplaintext.lang +1 -1
- data/lib/vimamsa/ack.rb +2 -0
- data/lib/vimamsa/actions.rb +381 -36
- data/lib/vimamsa/bookmarks.rb +8 -8
- data/lib/vimamsa/buffer.rb +83 -37
- data/lib/vimamsa/buffer_changetext.rb +58 -36
- data/lib/vimamsa/buffer_list.rb +2 -2
- data/lib/vimamsa/buffer_manager.rb +6 -6
- data/lib/vimamsa/cli_help.rb +75 -0
- data/lib/vimamsa/clipboard.rb +6 -3
- data/lib/vimamsa/conf.rb +9 -0
- data/lib/vimamsa/crash_handler.rb +2 -2
- data/lib/vimamsa/debug.rb +2 -2
- data/lib/vimamsa/demo_player.rb +458 -0
- data/lib/vimamsa/demo_recorder.rb +277 -0
- data/lib/vimamsa/diff_buffer.rb +1 -1
- data/lib/vimamsa/dot_repeat.rb +104 -0
- data/lib/vimamsa/easy_jump.rb +54 -3
- data/lib/vimamsa/editor.rb +89 -46
- data/lib/vimamsa/file_history.rb +1 -1
- data/lib/vimamsa/file_manager.rb +23 -23
- data/lib/vimamsa/form_input.rb +388 -0
- data/lib/vimamsa/gui.rb +83 -13
- data/lib/vimamsa/gui_command_line.rb +44 -5
- data/lib/vimamsa/gui_form_generator.rb +17 -6
- data/lib/vimamsa/gui_key_hint.rb +165 -0
- data/lib/vimamsa/gui_keylog_panel.rb +164 -2
- data/lib/vimamsa/gui_menu.rb +69 -50
- data/lib/vimamsa/gui_select_window.rb +77 -43
- data/lib/vimamsa/gui_settings.rb +9 -5
- data/lib/vimamsa/gui_sourceview.rb +15 -81
- data/lib/vimamsa/gui_theme.rb +11 -2
- data/lib/vimamsa/hook.rb +2 -0
- data/lib/vimamsa/intro_page.rb +368 -0
- data/lib/vimamsa/key_actions.rb +315 -225
- data/lib/vimamsa/key_binding_tree.rb +228 -61
- data/lib/vimamsa/key_bindings_notepad.rb +18 -16
- data/lib/vimamsa/key_bindings_report.rb +290 -67
- data/lib/vimamsa/key_bindings_vim.rb +47 -297
- data/lib/vimamsa/key_bindings_vimlike.rb +347 -339
- data/lib/vimamsa/key_names.rb +80 -0
- data/lib/vimamsa/line_tree.rb +367 -0
- data/lib/vimamsa/macro.rb +20 -3
- data/lib/vimamsa/rbvma.rb +15 -0
- data/lib/vimamsa/registers.rb +125 -0
- data/lib/vimamsa/run_ruby.rb +64 -0
- data/lib/vimamsa/search_replace.rb +4 -4
- data/lib/vimamsa/string_util.rb +17 -3
- data/lib/vimamsa/tests.rb +8 -8
- data/lib/vimamsa/text_objects.rb +11 -54
- data/lib/vimamsa/text_transforms.rb +4 -0
- data/lib/vimamsa/tmp_user_dir.rb +39 -0
- data/lib/vimamsa/user_dirs.rb +83 -0
- data/lib/vimamsa/version.rb +1 -1
- data/lib/vimamsa/vim_core.rb +355 -0
- data/lib/vimamsa/vim_operators.rb +365 -0
- data/modules/calculator/calculator.rb +5 -5
- data/modules/color_highlight/color_highlight.rb +3 -3
- data/modules/dictation/dictation.rb +32 -32
- data/modules/ollama/ollama.rb +5 -5
- data/modules/terminal/terminal.rb +5 -5
- data/modules/tts/tts.rb +10 -10
- data/run_e2e_vm.sh +3 -3
- data/run_tests_vm.rb +138 -0
- data/scripts/demo/demo_easyjump_steps.txt +60 -0
- data/scripts/demo/demo_files_steps.txt +52 -0
- data/scripts/demo/demo_steps.txt +9 -1
- data/scripts/demo/notes.txt +6 -0
- data/scripts/demo/record_demo.rb +60 -81
- data/scripts/demo/report.rb +7 -0
- data/scripts/demo/shapes.rb +1 -0
- data/scripts/demo/square/shapes.rb +29 -0
- data/scripts/demo/square/steps.txt +185 -0
- data/scripts/lib/perf_startup.rb +138 -0
- data/scripts/lib/script_helpers.rb +53 -0
- data/scripts/perf_compare.rb +34 -0
- data/scripts/profile_startup.rb +72 -0
- data/tests/test_action_ids.rb +232 -0
- data/tests/test_auto_format.rb +2 -2
- data/tests/test_autocomplete.rb +1 -1
- data/tests/test_basic_editing.rb +18 -18
- data/tests/test_bookmarks.rb +6 -6
- data/tests/test_bracket_match.rb +3 -0
- data/tests/test_cli_help.rb +64 -0
- data/tests/test_color_highlight.rb +2 -2
- data/tests/test_command_line.rb +1 -1
- data/tests/test_context_menu_file.rb +18 -0
- data/tests/test_copy_paste.rb +33 -33
- data/tests/test_custom_two_phase.rb +1 -1
- data/tests/test_demo_player.rb +301 -0
- data/tests/test_demo_recorder.rb +202 -0
- data/tests/test_dictation.rb +16 -16
- data/tests/test_dot_repeat.rb +88 -0
- data/tests/test_easy_jump.rb +93 -0
- data/tests/test_extract_file_links.rb +3 -3
- data/tests/test_file_panel.rb +2 -2
- data/tests/test_flash.rb +1 -1
- data/tests/test_fold.rb +1 -1
- data/tests/test_form_input.rb +203 -0
- data/tests/test_func_panel.rb +2 -2
- data/tests/test_gtk_sync.rb +7 -7
- data/tests/test_intro_page.rb +437 -0
- data/tests/test_key_categories.rb +163 -0
- data/tests/test_keylog_panel.rb +163 -3
- data/tests/test_line_ends.rb +51 -0
- data/tests/test_line_tree.rb +86 -0
- data/tests/test_lsp_clangd.rb +2 -2
- data/tests/test_macro.rb +2 -2
- data/tests/test_module_interface.rb +9 -9
- data/tests/test_notepad_bindings.rb +5 -5
- data/tests/test_perf_startup.rb +28 -0
- data/tests/test_random_edit.rb +27 -27
- data/tests/test_registers.rb +122 -0
- data/tests/test_run_ruby.rb +77 -0
- data/tests/test_startup_file.rb +1 -1
- data/tests/test_text_objects.rb +1 -1
- data/tests/test_text_transforms.rb +12 -0
- data/tests/test_tmp_user_dir.rb +79 -0
- data/tests/test_tts.rb +10 -10
- data/tests/test_undo.rb +34 -34
- data/tests/test_user_dirs.rb +122 -0
- data/tests/test_vim_bindings.rb +107 -6
- data/tests/test_vim_conflicts.rb +41 -4
- data/tests/test_vim_operators.rb +116 -0
- data/tests/test_window_layout.rb +83 -0
- data/vimamsa.gemspec +1 -1
- data/vm_guest_run.sh +22 -2
- metadata +58 -3
- 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
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
|
101
|
-
|
|
102
|
-
|
|
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
|
-
|
|
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`
|
|
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
|
|
156
|
-
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
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
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
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.
|
|
259
|
-
|
|
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`.
|