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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30dc038cb0e2f120cf8952d943f181a915d76627c4e9f788b5c1b5928b266229
4
- data.tar.gz: b4c8cb93244fa18791cb85ffcbfd91949fd146b6afe498527d45777e7a11b5f8
3
+ metadata.gz: c40414938b976087d5c008f0881257ccf752091dd16d156bf7e21f8e9810839a
4
+ data.tar.gz: 5d8d17f66562cf4a4e4fadd4129d734841f10ad31f61ac56ae469f79c0647305
5
5
  SHA512:
6
- metadata.gz: c6e79f3ffbe2b42638d1ad659dced6ff1924339b18090c278c2e96e220471857344d0a2777e484d8776a2c6acd56b1f9c73ebc829e56f1da3f88603bbe56df4e
7
- data.tar.gz: 3ea0451e5d26c8439e92a6faa0e2d57868dbaa747126217c4a03c7069b94cf7304a9ebca7999a77e66439356b18c90fb139d88ef7beb8a1a66c0fa650270afd9
6
+ metadata.gz: 74a41608b496082f6fc49e462567d25fdd5783d27362a79d12f07bd02da7a7b7c3b764adc809650b19adea07a1bfcb915f0dcb3645ee19c0b0a41c42ce1ba44f
7
+ data.tar.gz: 59b3151ff41d232f015388579ba5d41a933349eafc451f2e2d74217f1c558b5f9a694bc1a12ffe4676b9cb896bae24f8edca71d07ac89151657edf45d727c306
data/README.md CHANGED
@@ -49,12 +49,14 @@ gh attestation verify Vimamsa-x86_64.AppImage --repo SamiSieranoja/vimamsa
49
49
  ## Install as a Ruby gem
50
50
 
51
51
  Requirements:
52
- - Ruby 3.1+
52
+ - Ruby 3.2+
53
53
  - GTK 4
54
54
 
55
- On Ubuntu (22.04):
55
+ On Ubuntu (24.04):
56
56
  ```
57
- sudo apt install ruby-dev build-essential
57
+ sudo apt install ruby-dev build-essential pkg-config \
58
+ libgtk-4-dev libgtksourceview-5-dev libvte-2.91-gtk4-dev \
59
+ libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
58
60
  sudo gem install vimamsa
59
61
  ```
60
62
 
@@ -85,11 +87,18 @@ Install packages for optional features:
85
87
  sudo apt install ack-grep clang-format
86
88
  ```
87
89
 
88
- For customization, edit ~/.vimamsa/custom.rb
90
+ For customization, edit ~/.config/vimamsa/custom.rb (Settings ▸ Customize).
91
+
92
+ Vimamsa keeps the files you edit (custom.rb, settings.rb, styles, bookmarks,
93
+ named macros) in ~/.config/vimamsa, and the files it generates (session,
94
+ histories, file index, backups, crash reports) in ~/.local/share/vimamsa
95
+ (`$XDG_CONFIG_HOME` / `$XDG_DATA_HOME` if set). `--user-dir DIR` puts both in
96
+ DIR. Files of older versions in ~/.vimamsa or ~/.config/vimamsa are moved to
97
+ their new places at the first start.
89
98
 
90
99
  ## Demo
91
100
 
92
- ![Vimamsa demo: moving with hjkl and words, yy p, dd, undo/redo, Insert and Visual mode, easy jump, with the key log panel showing each key](img/demo.gif)
101
+ [<video src="https://github.com/user-attachments/assets/626bc896-7e15-4e21-a013-4572cf5532a6" autoplay muted loop playsinline width="800"></video>](https://github.com/user-attachments/assets/626bc896-7e15-4e21-a013-4572cf5532a6)
93
102
 
94
103
  Moving with `h j k l` and `w e b`, `y y p`, `d d`, undo `u` / redo `ctrl-r`,
95
104
  typing in Insert mode and back to Command mode with `ctrl` (press and release
@@ -97,100 +106,141 @@ it alone), selecting in Visual mode, and easy jump (`s`: type a word's label to
97
106
  jump there). The key log panel on the right (View ▸ Toggle
98
107
  key log panel) shows each key and the action it ran.
99
108
 
109
+ The editor plays this demo and others itself: the introduction page (shown on
110
+ the first start, and from Help ▸ Introduction) has a button for each. It also
111
+ links to a one-screen summary for Vim users (Help ▸ Vimamsa for Vim users).
112
+ `vimamsa --intro` shows the introduction page at start whatever the settings
113
+ say.
114
+
100
115
  ## Key bindings
101
116
 
102
- Key bindings are very much like in VIm. For details, see menu item "Help -> Show key bindings" and file lib/vimamsa/key_bindings_vimlike.rb
117
+ The default keybinding scheme, "vimlike", is close to Vim. It keeps the Vim
118
+ bindings and changes a few keys for its own features. For the full list, see
119
+ the menu item "Help ▸ Show key bindings" and the file
120
+ lib/vimamsa/key_bindings_vimlike.rb. You can switch the scheme in Settings
121
+ ("Keybinding scheme", applied after a restart) or with
122
+ `cnf.keybindings.scheme = "vim"` in ~/.config/vimamsa/settings.rb:
123
+
124
+ - `vimlike` (default): Vim keys plus the extra bindings below
125
+ - `vim`: plain Vim bindings
126
+ - `notepad`: non-modal, stays in insert mode (gedit/notepad style)
103
127
 
104
- Keys that work somewhat similarly as in Vim:
128
+ Keys that work much like in Vim:
105
129
 
106
- In Command mode:
130
+ In Command mode:
107
131
  ```
108
- j k l h w b p P G f F ; 0 $ v i o J * / a A I u ctrl-r x
109
- zz dd dw gg <linenum>G r<char>
132
+ h j k l w b e W B E 0 ^ $ gg G <count>G f F t T ; * / n N : gf g;
133
+ i a A I o J p P D Y S u ctrl-r . x ~ r<char> R v m<char> '<char> `<char>
134
+ q<char> @<char> "<char> ctrl-f ctrl-b ctrl-d ctrl-u ctrl-a
110
135
  ```
136
+ Operators `d c y gU gu g~ > <` combine with the motions above and with text
137
+ objects (`iw aw i( a" it ...`), e.g. `d w`, `c i w`, `y y`, `> >`.
111
138
 
112
139
  In Visual mode:
113
140
  ```
114
- d y gU gu
115
- ```
116
-
117
- Keys that work differently to Vim are documented in the tables below
118
-
119
- Syntax:
120
-
121
- - ctrl! means press and immediate release of ctrl key. Triggered by key up event when no other keys were pressed between key down and key up events.
122
- - ctrl-x means press and hold ctrl key, press x
123
-
124
- <table>
125
- <colgroup>
126
- <col style="text-align:center;"/>
127
- <col style="text-align:left;"/>
128
- </colgroup>
129
-
130
- <thead> <tr> <th style="text-align:center;" colspan="4">Command mode keys</th> </tr> </thead>
131
-
132
- <tbody>
133
- <tr><th>Key</th><th>Action</th></tr>
134
- <tr><td style="text-align:center;">ctrl!</td> <td style="text-align:left;">switch between command and insert modes</td> </tr>
135
- <tr> <td style="text-align:center;">z</td> <td style="text-align:left;"> enter into BROWSE mode</td></tr>
136
- <tr> <td style="text-align:center;">shift!</td> <td style="text-align:left;">save file</td> </tr>
137
- <tr> <td style="text-align:center;">s</td> <td style="text-align:left;">Easy jump (Similar to Vim EasyMotion https://github.com/easymotion/vim-easymotion ) </td> </tr>
138
- <tr> <td style="text-align:center;">tab</td> <td style="text-align:left;">switch betwen current and previous buffer/file</td></tr>
139
- <tr> <td style="text-align:center;">enter</td> <td style="text-align:left;"> (when cursor on link) open url in browser </td></tr>
140
- <tr> <td style="text-align:center;">enter</td> <td style="text-align:left;">(when cursor on /path/to/file.txt:linenum ) open file in editor, jump to linenum </td></tr>
141
- <tr> <td style="text-align:center;">,a</td> <td style="text-align:left;">Search for string using ack
142
- </td></tr>
143
- <tr> <td style="text-align:center;">,b</td> <td style="text-align:left;"> Switch buffer (jump to other open file)</td></tr>
144
- <tr> <td style="text-align:center;">,g</td> <td style="text-align:left;">search for input string inside current buffer</td></tr>
145
- <tr> <td style="text-align:center;">,f</td> <td style="text-align:left;">File finder</td></tr>
146
- <tr> <td style="text-align:center;">space c</td> <td style="text-align:left;">insert character "c"</td></tr>
147
- </tbody>
148
- </table>
149
-
150
- <table>
151
- <colgroup>
152
- <col style="text-align:center;"/>
153
- <col style="text-align:left;"/>
154
- </colgroup>
155
-
156
- <thead> <tr> <th style="text-align:center;" colspan="4">Insert mode keys (similar to bash or emacs)</th> </tr> </thead>
157
-
158
- <tbody>
159
- <tr> <td style="text-align:center;">ctrl! OR esc</td> <td style="text-align:left;">Switch to command mode</td></tr>
160
- <tr> <td style="text-align:center;">ctrl-n</td> <td style="text-align:left;">Move to next line</td></tr>
161
- <tr> <td style="text-align:center;">ctrl-p</td> <td style="text-align:left;">Move to previous line</td></tr>
162
- <tr> <td style="text-align:center;">ctrl-a</td> <td style="text-align:left;">Move beginning of line</td></tr>
163
- <tr> <td style="text-align:center;">ctrl-e</td> <td style="text-align:left;">Move to end of line</td></tr>
164
- <tr> <td style="text-align:center;">ctrl-b</td> <td style="text-align:left;">Move backward one char</td></tr>
165
- <tr> <td style="text-align:center;">ctrl-f</td> <td style="text-align:left;">Move forward one char</td></tr>
166
- <tr> <td style="text-align:center;">alt-f</td> <td style="text-align:left;">Move forward one word</td></tr>
167
- <tr> <td style="text-align:center;">alt-b</td> <td style="text-align:left;">Move backward one word</td></tr>
168
- </tbody>
169
- </table>
170
-
171
-
172
- <table>
173
- <colgroup>
174
- <col style="text-align:center;"/>
175
- <col style="text-align:left;"/>
176
- </colgroup>
177
-
178
- <thead> <tr> <th style="text-align:center;" colspan="4">Browse mode keys</th> </tr> </thead>
179
-
180
- <tbody>
181
- <tr> <td style="text-align:center;">h</td> <td style="text-align:left;">jump to previous buffer in history</td></tr>
182
- <tr> <td style="text-align:center;">l</td> <td style="text-align:left;">jump to next buffer in history</td></tr>
183
- <tr> <td style="text-align:center;">q</td> <td style="text-align:left;">jump to previous edited position</td></tr>
184
- <tr> <td style="text-align:center;">w</td> <td style="text-align:left;">jump to next edited position</td></tr>
185
- <tr> <td style="text-align:center;">j OR esc</td> <td style="text-align:left;">switch from browse to command mode</td></tr>
186
- </tbody>
187
- </table>
188
-
189
- Bindings can be customized in ~/.config/vimamsa/custom.rb
190
- For example, to bind ctrl-n to action "create new file":
191
- ```
192
- bindkey 'C ctrl-n', 'create_new_file()'
141
+ d x y c J u U ~ gU gu > < iw aw ...
142
+ ```
193
143
 
144
+ The keys that work differently from Vim are listed in the tables below
145
+ (the full list of conflicts is in doc/vimlike_vim_conflicts.md).
146
+
147
+ Syntax:
148
+
149
+ - `ctrl!` means press and immediately release the ctrl key. Triggered by the key up event when no other keys were pressed between the key down and key up events.
150
+ - `ctrl-x` means press and hold the ctrl key, press x.
151
+ - `, a` means press `,`, then `a`.
152
+
153
+ **Command mode**
154
+
155
+ | Key | Action |
156
+ |---|---|
157
+ | `ctrl!` | Switch between command and insert modes |
158
+ | `shift!` `s` | Save file (press and release shift, then `s`) |
159
+ | `s` | Easy jump (similar to Vim [EasyMotion](https://github.com/easymotion/vim-easymotion)): type a word's label to jump there |
160
+ | `z` | Enter BROWSE mode |
161
+ | `O` | Move to end of line |
162
+ | `X` | Insert an empty line below |
163
+ | `C` | Search in files (grep) |
164
+ | `tab` | Switch between current and previous buffer |
165
+ | `M` | Run the last recorded macro |
166
+ | `enter` | On a link: open url in browser. On `/path/to/file.txt:linenum`: open the file, jump to linenum |
167
+ | `space <char>` | Insert character `<char>` |
168
+ | `ctrl-o` | Open file |
169
+ | `ctrl-s` | Save file |
170
+ | `ctrl-w` | Close buffer |
171
+ | `ctrl-c` / `ctrl-x` | Comment / uncomment line |
172
+ | `ctrl-q` | Quit |
173
+ | `g s` | Jump to a file in the file panel by its label |
174
+ | `alt-h` / `alt-l` | Previous / next file in the file panel |
175
+ | `, b` | Switch buffer (buffer manager) |
176
+ | `, f` | File explorer: browse directories (`h` parent directory, `l` or `enter` open) |
177
+ | `, , f` or `, z` | File finder (fuzzy search for file names) |
178
+ | `, h` | File history |
179
+ | `, g` | Search for a string in the current buffer, show matching lines |
180
+ | `, a` | Search in files using ack |
181
+ | `, r r` | Search and replace |
182
+ | `, e` or `:` | Command line |
183
+ | `, s a` | Save as |
184
+ | `, n b` | New buffer |
185
+ | `, c b` | Close buffer |
186
+ | `, r v b` | Revert buffer from disk |
187
+ | `, M` / `, '` | Add bookmark / list bookmarks |
188
+ | `, v` | Auto-indent buffer |
189
+ | `, w` | Switch between columns |
190
+ | `, , w` | Toggle two-column view |
191
+ | `, m h` | Show messages |
192
+
193
+ **Insert mode** (similar to bash or emacs)
194
+
195
+ | Key | Action |
196
+ |---|---|
197
+ | `ctrl!` or `esc` | Switch to command mode |
198
+ | `ctrl-n` / `ctrl-p` | Move to next / previous line |
199
+ | `ctrl-a` / `ctrl-e` | Move to beginning / end of line |
200
+ | `ctrl-b` / `ctrl-f` | Move backward / forward one char |
201
+ | `alt-b` / `alt-f` | Move backward / forward one word |
202
+ | `ctrl-d` | Delete to end of word |
203
+ | `ctrl-z` / `ctrl-y` | Undo / redo |
204
+ | `ctrl-c` / `ctrl-x` / `ctrl-v` | Copy / cut / paste |
205
+ | `shift-<arrow>` | Select |
206
+ | `ctrl-l` / `ctrl-g` | Search in buffer / next match |
207
+ | `ctrl-space` or `ctrl-h` | Show completions (`tab` / `shift-tab` to choose, `shift!` to accept) |
208
+ | `alt-s` | Easy jump |
209
+ | `ctrl-s` | Save file |
210
+
211
+ **Visual mode**
212
+
213
+ | Key | Action |
214
+ |---|---|
215
+ | `ctrl!` or `esc` | Exit visual mode |
216
+ | `s` | Easy jump: extend the selection to a word's label |
217
+ | `tab` / `shift-tab` | Indent / unindent selection |
218
+ | `ctrl-c` / `ctrl-x` | Comment / uncomment selection |
219
+ | `a y` / `a d` | Copy / delete, appending to the clipboard |
220
+ | `g c` / `g s` | Capitalize / swap case |
221
+ | `g r` | Reverse selection |
222
+ | `g w` | Remove extra spaces |
223
+ | `, t b` / `, t i` / `, t l` | Bold / italic / link (hyperplaintext) |
224
+
225
+ **Browse mode** (enter with `z`)
226
+
227
+ | Key | Action |
228
+ |---|---|
229
+ | `h` / `l` | Previous / next buffer in history |
230
+ | `q` / `w` | Previous / next edited position |
231
+ | `p` / `n` | Previous / next file in the file panel |
232
+ | `s` / `d` | Page up / down |
233
+ | `e` / `r` | Quarter page up / down |
234
+ | `i` / `o` | Start / end of buffer |
235
+ | `z` | Center the current line, back to command mode |
236
+ | `m` | Run the last recorded macro |
237
+ | `c` | Close buffer |
238
+ | `j`, `esc`, `enter` or `ctrl!` | Back to command mode |
239
+
240
+ Bindings can be customized in ~/.config/vimamsa/custom.rb.
241
+ For example, to bind ctrl-n to action "create new file":
242
+ ```
243
+ bindkey 'C ctrl-n', 'buf.new'
194
244
  ```
195
245
 
196
246
  custom.rb is loaded in two phases. The body of the file runs early, before
data/custom_example.rb CHANGED
@@ -9,7 +9,15 @@
9
9
  # syntax: bindkey "mode key1 key2 ..."
10
10
 
11
11
  # Execute in new gnome-terminal tab
12
- # bindkey "C , , t", :execute_current_line_in_terminal
12
+ # bindkey "C , , t", "term.line"
13
+
14
+ # Actions have dotted ids, from general to specific: "move.word.next",
15
+ # "buf.save", "sel.copy" (Search for Actions, [C] , , s, lists them). Bind one
16
+ # by its id, or with the a.… form, which reports a typo when the binding is made:
17
+ # bindkey "C , w", a.move.word.next
18
+ # Run one from here or from the command line (:) with a trailing "!":
19
+ # a.buf.save!
20
+ # Your own actions: use the "custom." namespace, as below.
13
21
 
14
22
  # setcnf :tab_width, 4
15
23
 
@@ -43,7 +51,7 @@ def collect_c_header()
43
51
  buf.insert_txt(s)
44
52
  end
45
53
 
46
- reg_act(:collect_c_header, proc { collect_c_header }, "Collect function definitions for c header file")
54
+ reg_act("custom.c_header", proc { collect_c_header }, "Collect function definitions for c header file")
47
55
 
48
56
  # Extract all numbers from txt selection
49
57
  c = Converter.new(lambda { |x| x.scan(/([\+\-]?\d+(\.\d+)?)/).collect { |x| x[0] }.join(" ") }, :lambda, :getnums)
@@ -60,7 +68,7 @@ Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius, tur
60
68
  end
61
69
 
62
70
  # Find with action search ([C] , , s)
63
- reg_act(:insert_lorem_ipsum, proc { insert_lorem_ipsum }, "Insert lorem ipsum")
71
+ reg_act("custom.lorem_ipsum", proc { insert_lorem_ipsum }, "Insert lorem ipsum")
64
72
 
65
73
  def open_mtg(urlpref = nil)
66
74
  require "uri"
@@ -77,11 +85,15 @@ def open_mtg(urlpref = nil)
77
85
  open_url(url)
78
86
  end
79
87
 
80
- # reg_act(:open_mtg, proc { open_mtg }, "open mtg card info")
81
- # bindkey "VC , , m", :open_mtg
88
+ # reg_act("custom.mtg", proc { open_mtg }, "open mtg card info")
89
+ # bindkey "VC , , m", "custom.mtg"
82
90
  # Try on this line:
83
91
  # Restless Cottage
84
92
 
93
+ # The introduction page (Help ▸ Introduction) is shown at start once. To show
94
+ # it at every start:
95
+ # cnf.intro.show_on_startup = true
96
+
85
97
  # Primitive support for LSP (not well tested)
86
98
  # To enable LSP:
87
99
  # cnf.lsp.enabled = true
@@ -123,6 +135,6 @@ end
123
135
  # file selector, "grep") do not exist yet at that point: bindings for those go
124
136
  # here, in a function that is called after everything has been loaded.
125
137
  # def hook_custom_after_init
126
- # bindkey "fexp , x", :my_file_action
138
+ # bindkey "fexp , x", "custom.my_file_action"
127
139
  # end
128
140