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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30dc038cb0e2f120cf8952d943f181a915d76627c4e9f788b5c1b5928b266229
4
- data.tar.gz: b4c8cb93244fa18791cb85ffcbfd91949fd146b6afe498527d45777e7a11b5f8
3
+ metadata.gz: 9b9f8e01a0389ef6c6bb5f04616856b2d6fa8e99c9ec178507eb3ece03084bd4
4
+ data.tar.gz: '0868c083559ba6d905586816333200fe70f5c45eaed306de522f3a89b0791caa'
5
5
  SHA512:
6
- metadata.gz: c6e79f3ffbe2b42638d1ad659dced6ff1924339b18090c278c2e96e220471857344d0a2777e484d8776a2c6acd56b1f9c73ebc829e56f1da3f88603bbe56df4e
7
- data.tar.gz: 3ea0451e5d26c8439e92a6faa0e2d57868dbaa747126217c4a03c7069b94cf7304a9ebca7999a77e66439356b18c90fb139d88ef7beb8a1a66c0fa650270afd9
6
+ metadata.gz: 2b7c3a573ca292a07b9e93b5db746b8884f99b2c04b9a9e193481751f8e51fa4280cdec82b625782d1100f8109ac46944a4c0b82c2a681ea70041f779ba5360f
7
+ data.tar.gz: 88be098c45d80459e6e725a0da2da180e18e14ee1d94f6e391ea0bc5fb4808d34cd77d952b3dc1ab839b2fed0d69ca9df76c328d9a8738125c592bb7b096f5d9
@@ -47,36 +47,43 @@ jobs:
47
47
  - name: Test on a clean Ubuntu 24.04
48
48
  run: scripts/appimage/smoke_test.sh build/appimage/Vimamsa-*-x86_64.AppImage
49
49
 
50
- # One file name for every release, so the README can link to
50
+ # The file with its version (Vimamsa-0.1.28-x86_64.AppImage), and the
51
+ # same file under one name for every release, so the README can link to
51
52
  # releases/latest/download/Vimamsa-x86_64.AppImage
52
- - name: Name the file
53
+ - name: Name the files
53
54
  run: |
54
55
  mkdir -p dist
55
- cp build/appimage/Vimamsa-*-x86_64.AppImage dist/Vimamsa-x86_64.AppImage
56
- (cd dist && sha256sum Vimamsa-x86_64.AppImage > Vimamsa-x86_64.AppImage.sha256)
56
+ f=$(ls build/appimage/Vimamsa-*-x86_64.AppImage)
57
+ cp "$f" dist/
58
+ cp "$f" dist/Vimamsa-x86_64.AppImage
59
+ (cd dist && for a in *.AppImage; do sha256sum "$a" > "$a.sha256"; done)
57
60
 
58
61
  - name: Attest build provenance
59
62
  if: github.ref_type == 'tag'
60
63
  uses: actions/attest-build-provenance@v2
61
64
  with:
62
- subject-path: dist/Vimamsa-x86_64.AppImage
65
+ subject-path: dist/*.AppImage
63
66
 
64
67
  - name: Attach to the release
65
68
  if: github.ref_type == 'tag'
66
69
  env:
67
70
  GH_TOKEN: ${{ github.token }}
68
71
  run: |
69
- notes="Download \`Vimamsa-x86_64.AppImage\`, make it executable and run it:
72
+ v="${GITHUB_REF_NAME#v}"
73
+ notes="Download \`Vimamsa-$v-x86_64.AppImage\`, make it executable and run it:
70
74
 
71
75
  \`\`\`
72
- chmod +x Vimamsa-x86_64.AppImage
73
- ./Vimamsa-x86_64.AppImage
76
+ chmod +x Vimamsa-$v-x86_64.AppImage
77
+ ./Vimamsa-$v-x86_64.AppImage
74
78
  \`\`\`
75
79
 
80
+ \`Vimamsa-x86_64.AppImage\` is the same file under the name every release has
81
+ (the README links to the latest one).
82
+
76
83
  Needs x86_64 Linux with glibc 2.39 or newer (Ubuntu 24.04, Fedora 40, Debian 13 or newer).
77
84
 
78
85
  Built by GitHub Actions from this tag. To check that the file came from this repository's workflow:
79
- \`gh attestation verify Vimamsa-x86_64.AppImage --repo $GITHUB_REPOSITORY\`"
86
+ \`gh attestation verify Vimamsa-$v-x86_64.AppImage --repo $GITHUB_REPOSITORY\`"
80
87
  if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then
81
88
  gh release upload "$GITHUB_REF_NAME" dist/* --clobber
82
89
  else
@@ -88,6 +95,6 @@ jobs:
88
95
  if: github.ref_type != 'tag'
89
96
  uses: actions/upload-artifact@v4
90
97
  with:
91
- name: Vimamsa-x86_64.AppImage
98
+ name: Vimamsa-AppImage
92
99
  path: dist/
93
100
  retention-days: 14
data/Dockerfile CHANGED
@@ -42,7 +42,7 @@ RUN git clone https://github.com/SamiSieranoja/vimamsa.git && cd vimamsa && gem
42
42
  RUN chmod a-w -R /usr/local/bundle/gems/vimamsa*
43
43
  RUN chmod a-w -R vimamsa
44
44
 
45
- CMD ["bash", "-c", "xvfb-run -a ruby /usr/local/bundle/gems/vimamsa-*/run_tests.rb /tmp/report00.txt"]
46
- # CMD ["bash", "-c", "cd vimamsa && xvfb-run -a ruby run_tests.rb"]
45
+ CMD ["bash", "-c", "xvfb-run -a ruby /usr/local/bundle/gems/vimamsa-*/exe/run_tests.rb"]
46
+ # CMD ["bash", "-c", "cd vimamsa && xvfb-run -a ruby exe/run_tests.rb"]
47
47
 
48
48
 
data/README.md CHANGED
@@ -16,11 +16,14 @@ Vi/Vim -inspired experimental GUI-oriented text editor written with Ruby and GTK
16
16
 
17
17
  ## Download (AppImage)
18
18
 
19
+ [![Latest release](https://img.shields.io/github/v/release/SamiSieranoja/vimamsa?label=latest%20release)](https://github.com/SamiSieranoja/vimamsa/releases/latest)
20
+
19
21
  The easiest way: one file, nothing to install (Ruby, GTK and everything else
20
22
  the editor needs are inside it).
21
23
 
22
- 1. Download [Vimamsa-x86_64.AppImage](https://github.com/SamiSieranoja/vimamsa/releases/latest/download/Vimamsa-x86_64.AppImage)
23
- (all versions: [Releases](https://github.com/SamiSieranoja/vimamsa/releases)).
24
+ 1. Download [Vimamsa-x86_64.AppImage](https://github.com/SamiSieranoja/vimamsa/releases/latest/download/Vimamsa-x86_64.AppImage),
25
+ the latest release (each release also has the file with its version in
26
+ the name, e.g. Vimamsa-0.1.28-x86_64.AppImage: [Releases](https://github.com/SamiSieranoja/vimamsa/releases)).
24
27
  2. Make it executable and run it:
25
28
  ```
26
29
  chmod +x Vimamsa-x86_64.AppImage
@@ -49,12 +52,14 @@ gh attestation verify Vimamsa-x86_64.AppImage --repo SamiSieranoja/vimamsa
49
52
  ## Install as a Ruby gem
50
53
 
51
54
  Requirements:
52
- - Ruby 3.1+
55
+ - Ruby 3.2+
53
56
  - GTK 4
54
57
 
55
- On Ubuntu (22.04):
58
+ On Ubuntu (24.04):
56
59
  ```
57
- sudo apt install ruby-dev build-essential
60
+ sudo apt install ruby-dev build-essential pkg-config \
61
+ libgtk-4-dev libgtksourceview-5-dev libvte-2.91-gtk4-dev \
62
+ libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
58
63
  sudo gem install vimamsa
59
64
  ```
60
65
 
@@ -85,11 +90,18 @@ Install packages for optional features:
85
90
  sudo apt install ack-grep clang-format
86
91
  ```
87
92
 
88
- For customization, edit ~/.vimamsa/custom.rb
93
+ For customization, edit ~/.config/vimamsa/custom.rb (Settings ▸ Customize).
94
+
95
+ Vimamsa keeps the files you edit (custom.rb, settings.rb, styles, bookmarks,
96
+ named macros) in ~/.config/vimamsa, and the files it generates (session,
97
+ histories, file index, backups, crash reports) in ~/.local/share/vimamsa
98
+ (`$XDG_CONFIG_HOME` / `$XDG_DATA_HOME` if set). `--user-dir DIR` puts both in
99
+ DIR. Files of older versions in ~/.vimamsa or ~/.config/vimamsa are moved to
100
+ their new places at the first start.
89
101
 
90
102
  ## Demo
91
103
 
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)
104
+ [<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
105
 
94
106
  Moving with `h j k l` and `w e b`, `y y p`, `d d`, undo `u` / redo `ctrl-r`,
95
107
  typing in Insert mode and back to Command mode with `ctrl` (press and release
@@ -97,100 +109,140 @@ it alone), selecting in Visual mode, and easy jump (`s`: type a word's label to
97
109
  jump there). The key log panel on the right (View ▸ Toggle
98
110
  key log panel) shows each key and the action it ran.
99
111
 
112
+ The editor plays this demo and others itself: the introduction page (shown on
113
+ the first start, and from Help ▸ Introduction) has a button for each. It also
114
+ links to a one-screen summary for Vim users (Help ▸ Vimamsa for Vim users).
115
+ `vimamsa --intro` shows the introduction page at start whatever the settings
116
+ say.
117
+
100
118
  ## Key bindings
101
119
 
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
120
+ The default keybinding scheme, "vimlike", is close to Vim. It keeps the Vim
121
+ bindings and changes a few keys for its own features. For the full list, see
122
+ the menu item "Help ▸ Show key bindings" and the file
123
+ lib/vimamsa/key_bindings_vimlike.rb. You can switch the scheme in Settings
124
+ ("Keybinding scheme", applied after a restart) or with
125
+ `cnf.keybindings.scheme = "vim"` in ~/.config/vimamsa/settings.rb:
103
126
 
104
- Keys that work somewhat similarly as in Vim:
127
+ - `vimlike` (default): Vim keys plus the extra bindings below
128
+ - `vim`: plain Vim bindings
129
+ - `notepad`: non-modal, stays in insert mode (gedit/notepad style)
105
130
 
106
- In Command mode:
131
+ Keys that work much like in Vim:
132
+
133
+ In Command mode:
107
134
  ```
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>
135
+ h j k l w b e W B E 0 ^ $ gg G <count>G f F t T ; * / n N : gf g;
136
+ i a A I o J p P D Y S u ctrl-r . x ~ r<char> R v m<char> '<char> `<char>
137
+ q<char> @<char> "<char> ctrl-f ctrl-b ctrl-d ctrl-u ctrl-a
110
138
  ```
139
+ Operators `d c y gU gu g~ > <` combine with the motions above and with text
140
+ objects (`iw aw i( a" it ...`), e.g. `d w`, `c i w`, `y y`, `> >`.
111
141
 
112
142
  In Visual mode:
113
143
  ```
114
- d y gU gu
144
+ d x y c J u U ~ gU gu > < iw aw ...
115
145
  ```
116
146
 
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":
147
+ The keys that work differently from Vim are listed in the tables below
148
+ (the full list of conflicts is in doc/vimlike_vim_conflicts.md).
149
+
150
+ Syntax:
151
+
152
+ - `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.
153
+ - `ctrl-x` means press and hold the ctrl key, press x.
154
+ - `, a` means press `,`, then `a`.
155
+
156
+ **Command mode**
157
+
158
+ | Key | Action |
159
+ |---|---|
160
+ | `ctrl!` | Switch between command and insert modes |
161
+ | `shift!` `s` | Save file (press and release shift, then `s`) |
162
+ | `s` | Easy jump (similar to Vim [EasyMotion](https://github.com/easymotion/vim-easymotion)): type a word's label to jump there |
163
+ | `z` | Enter BROWSE mode |
164
+ | `O` | Move to end of line |
165
+ | `X` | Insert an empty line below |
166
+ | `tab` | Switch between current and previous buffer |
167
+ | `M` | Run the last recorded macro |
168
+ | `enter` | On a link: open url in browser. On `/path/to/file.txt:linenum`: open the file, jump to linenum |
169
+ | `space <char>` | Insert character `<char>` |
170
+ | `ctrl-o` | Open file |
171
+ | `ctrl-s` | Save file |
172
+ | `ctrl-w` | Close buffer |
173
+ | `ctrl-c` / `ctrl-x` | Comment / uncomment line |
174
+ | `ctrl-q` | Quit |
175
+ | `g s` | Easy Jump to a file in the file panel|
176
+ | `alt-h` / `alt-l` | Previous / next file in the file panel |
177
+ | `, b` | Switch buffer (buffer manager) |
178
+ | `, f` | File explorer: browse directories (`h` parent directory, `l` or `enter` open) |
179
+ | `, z` | File finder (fuzzy search for file names) |
180
+ | `, h` | File history |
181
+ | `, g` | Grep: Search for a string in the current buffer, show matching lines |
182
+ | `, a` | Search in files using ack |
183
+ | `, r r` | Search and replace |
184
+ | `, e` or `:` | Command line |
185
+ | `, s a` | Save as |
186
+ | `, n b` | New buffer |
187
+ | `, c b` | Close buffer |
188
+ | `, r v b` | Revert buffer from disk |
189
+ | `, M` / `, '` | Add bookmark / list bookmarks |
190
+ | `, v` | Auto-indent buffer |
191
+ | `, , w` | Toggle two-column view |
192
+ | `, w` | Switch between columns |
193
+ | `, m h` | Show messages (toggle) |
194
+
195
+ **Insert mode** (similar to bash or emacs)
196
+
197
+ | Key | Action |
198
+ |---|---|
199
+ | `ctrl!` or `esc` | Switch to command mode |
200
+ | `ctrl-n` / `ctrl-p` | Move to next / previous line |
201
+ | `ctrl-a` / `ctrl-e` | Move to beginning / end of line |
202
+ | `ctrl-b` / `ctrl-f` | Move backward / forward one char |
203
+ | `alt-b` / `alt-f` | Move backward / forward one word |
204
+ | `ctrl-d` | Delete to end of word |
205
+ | `ctrl-z` / `ctrl-y` | Undo / redo |
206
+ | `ctrl-c` / `ctrl-x` / `ctrl-v` | Copy / cut / paste |
207
+ | `shift-<arrow>` | Select |
208
+ | `ctrl-l` / `ctrl-g` | Search in buffer / next match |
209
+ | `ctrl-space` or `ctrl-h` | Show completions (`tab` / `shift-tab` to choose, `shift!` to accept) |
210
+ | `alt-s` | Easy jump |
211
+ | `ctrl-s` | Save file |
212
+
213
+ **Visual mode**
214
+
215
+ | Key | Action |
216
+ |---|---|
217
+ | `ctrl!` or `esc` | Exit visual mode |
218
+ | `s` | Easy jump: extend the selection to a word's label |
219
+ | `tab` / `shift-tab` | Indent / unindent selection |
220
+ | `ctrl-c` / `ctrl-x` | Comment / uncomment selection |
221
+ | `a y` / `a d` | Copy / delete, appending to the clipboard |
222
+ | `g c` / `g s` | Capitalize / swap case |
223
+ | `g r` | Reverse selection |
224
+ | `g w` | Remove extra spaces |
225
+ | `, t b` / `, t i` / `, t l` | Bold / italic / link (hyperplaintext) |
226
+
227
+ **Browse mode** (enter with `z`)
228
+
229
+ | Key | Action |
230
+ |---|---|
231
+ | `h` / `l` | Previous / next buffer in history |
232
+ | `q` / `w` | Previous / next edited position |
233
+ | `p` / `n` | Previous / next file in the file panel |
234
+ | `s` / `d` | Page up / down |
235
+ | `e` / `r` | Quarter page up / down |
236
+ | `i` / `o` | Start / end of buffer |
237
+ | `z` | Center the current line, back to command mode |
238
+ | `m` | Run the last recorded macro |
239
+ | `c` | Close buffer |
240
+ | `j`, `esc`, `enter` or `ctrl!` | Back to command mode |
241
+
242
+ Bindings can be customized in ~/.config/vimamsa/custom.rb.
243
+ For example, to bind ctrl-n to action "create new file":
191
244
  ```
192
- bindkey 'C ctrl-n', 'create_new_file()'
193
-
245
+ bindkey 'C ctrl-n', 'buf.new'
194
246
  ```
195
247
 
196
248
  custom.rb is loaded in two phases. The body of the file runs early, before
@@ -206,7 +258,7 @@ end
206
258
 
207
259
 
208
260
  ## Known issues
209
- - Cursor sometimes vanishes when dragging or resizing the window. At least some cases are fixed in new GTK4 versions ( >= 4.18, in Ubuntu Ubuntu 25.04). Workaround is to press ctrl key twice.
261
+ - Cursor sometimes vanishes (e.g. when dragging or resizing the window). A manifestation of a GTK bug, fixed in new GTK4 versions ( >= 4.18, in Ubuntu Ubuntu 25.04+). Workaround is to press ctrl key twice.
210
262
 
211
263
  ## Current limitations
212
264
  - Linux only
@@ -215,4 +267,24 @@ Mainly tested with:
215
267
  - UTF8, English or Finnish
216
268
  - Line endings with "\n"
217
269
 
270
+ ## History
271
+
272
+ The name ```vimamsa``` was taken from a Pali language dictionary. It can mean `experiment`, `investigation` or `review`.
273
+
274
+ This software has been in development since at least 2015. Since 2025, development has been done mainly using AI tools (claude).
275
+
276
+ ## Design goals and future plans
277
+
278
+ - GUI-based instead of focusing on running in terminal
279
+ - Separate key bindings from actions. Should be able to adapt any type of editor keybindings.
280
+ - Compatibility with the most popular vim features
281
+ - More modes than in vim(?) and with flexible customization.
282
+ - Extending with Ruby only.
283
+ - Support for images and other graphical elements
284
+ - Vim-style editing, but hopefully easier to learn.
285
+ - Should have a proper module API. But APIs are often too limited. Should also allow user access to all internal functions and to be able to break stuff.
286
+
287
+ In future:
288
+ - WYSIWYG -editing (replacing need for LaTeX or Word)
289
+ - All-in-one approach like in Emacs. Email, File management, Terminal, Playing audio. Control everything with vim-bindings.
218
290
 
data/custom_example.rb CHANGED
@@ -5,16 +5,25 @@
5
5
 
6
6
 
7
7
  # Eval selected text as ruby code (e.g. use as calculator):
8
- # bindkey "V , e", "vma.buf.convert_selected_text(:eval)"
9
- # syntax: bindkey "mode key1 key2 ..."
8
+ # bindkey "V , e", "sel.convert.eval"
9
+ # syntax: bindkey "mode key1 key2 ...", "action.id"
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
13
 
14
- # setcnf :tab_width, 4
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 , i 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.
21
+
22
+ # Settings are cnf.* values (the Settings dialog writes them to settings.rb):
23
+ # cnf.tab.width = 4
15
24
 
16
25
  # Open this file every time the program starts
17
- cnf.startup_file = "~/Documents/startup.txt"
26
+ # cnf.startup_file = "~/Documents/startup.txt"
18
27
 
19
28
 
20
29
 
@@ -43,11 +52,11 @@ def collect_c_header()
43
52
  buf.insert_txt(s)
44
53
  end
45
54
 
46
- reg_act(:collect_c_header, proc { collect_c_header }, "Collect function definitions for c header file")
55
+ reg_act("custom.c_header", proc { collect_c_header }, "Collect function definitions for c header file")
47
56
 
48
57
  # Extract all numbers from txt selection
49
58
  c = Converter.new(lambda { |x| x.scan(/([\+\-]?\d+(\.\d+)?)/).collect { |x| x[0] }.join(" ") }, :lambda, :getnums)
50
- # (find converter using action search input:"conv getnum")
59
+ # (action sel.convert.getnums; in the action search, e.g. "conv getnum")
51
60
 
52
61
 
53
62
  def insert_lorem_ipsum()
@@ -60,7 +69,7 @@ Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius, tur
60
69
  end
61
70
 
62
71
  # Find with action search ([C] , , s)
63
- reg_act(:insert_lorem_ipsum, proc { insert_lorem_ipsum }, "Insert lorem ipsum")
72
+ reg_act("custom.lorem_ipsum", proc { insert_lorem_ipsum }, "Insert lorem ipsum")
64
73
 
65
74
  def open_mtg(urlpref = nil)
66
75
  require "uri"
@@ -68,20 +77,25 @@ def open_mtg(urlpref = nil)
68
77
  vma.buf.get_current_selection.strip
69
78
  else
70
79
  l = vma.buf.get_current_line.strip
71
- m = l.match(/(\w[\w\'\-\s]+)/)
80
+ m = l.match(/(\w[\w\'\-\,\s]+)/)
72
81
  m ? m[0].strip : nil
73
82
  end
74
83
  return if cardname.nil? || cardname.empty?
75
84
  u = URI.encode_www_form_component(cardname)
85
+ message(u)
76
86
  url = urlpref ? urlpref + u : "https://gatherer.wizards.com/Pages/Card/Details.aspx?name=#{u}"
77
87
  open_url(url)
78
88
  end
79
89
 
80
- # reg_act(:open_mtg, proc { open_mtg }, "open mtg card info")
81
- # bindkey "VC , , m", :open_mtg
82
- # Try on this line:
90
+ # reg_act("custom.mtg", proc { open_mtg }, "open mtg card info")
91
+ # bindkey "VC , , m", "custom.mtg"
92
+ # Try on this line (keys ", , m" in command or visual mode):
83
93
  # Restless Cottage
84
94
 
95
+ # The introduction page (Help ▸ Introduction) is shown at start once. To show
96
+ # it at every start:
97
+ # cnf.intro.show_on_startup = true
98
+
85
99
  # Primitive support for LSP (not well tested)
86
100
  # To enable LSP:
87
101
  # cnf.lsp.enabled = true
@@ -91,11 +105,15 @@ end
91
105
  # cnf.lsp.server.solargraph.languages = ["ruby"]
92
106
 
93
107
  # ruby-lsp (Ruby):
94
- # cnf.lsp.server.ruby_lsp = { name: "ruby-lsp", command: "bundle exec ruby-lsp", type: "stdio" }
108
+ # The AppImage puts its own ruby-lsp on PATH. "bundle exec" only works when
109
+ # the editor's current directory (or a parent) has a Gemfile; started from
110
+ # anywhere else it fails ("Could not locate Gemfile") for every Ruby buffer.
111
+ # cnf.lsp.server.ruby_lsp = { name: "ruby-lsp",
112
+ # command: ENV["APPIMAGE"] ? "ruby-lsp" : "bundle exec ruby-lsp", type: "stdio" }
95
113
  # cnf.lsp.server.ruby_lsp.languages = ["ruby"]
96
114
 
97
115
 
98
- # cnf.lsp.server.clangd = { name: "clangd", command: "clangd-12 --offset-encoding=utf-8", type: "stdio" }
116
+ # cnf.lsp.server.clangd = { name: "clangd", command: "clangd --offset-encoding=utf-8", type: "stdio" }
99
117
  # cnf.lsp.server.clangd.languages = ["c", "cpp"]
100
118
 
101
119
  # Autocomplete (word completion popup in insert mode). Disabled by default.
@@ -123,6 +141,6 @@ end
123
141
  # file selector, "grep") do not exist yet at that point: bindings for those go
124
142
  # here, in a function that is called after everything has been loaded.
125
143
  # def hook_custom_after_init
126
- # bindkey "fexp , x", :my_file_action
144
+ # bindkey "fexp , x", "custom.my_file_action"
127
145
  # end
128
146