vimamsa 0.1.26 → 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 (229) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/appimage.yml +93 -0
  3. data/.gitignore +4 -1
  4. data/Dockerfile +7 -4
  5. data/README.md +195 -99
  6. data/custom_example.rb +59 -17
  7. data/doc/TODO.md +678 -0
  8. data/doc/action_names_plan.md +442 -0
  9. data/doc/bundling_plan.md +570 -0
  10. data/doc/delta_syntax_plan.md +293 -0
  11. data/doc/demo_recording_plan.md +288 -0
  12. data/doc/design_goals.md +27 -0
  13. data/doc/intro_page_plan.md +266 -0
  14. data/doc/key_bindings_report_plan.md +213 -0
  15. data/doc/line_tree_plan.md +89 -0
  16. data/doc/missing_vim_bindings.md +61 -0
  17. data/doc/modules_settings_plan.md +433 -0
  18. data/doc/refactor_dedup_plan.md +117 -0
  19. data/doc/registries_plan.md +202 -0
  20. data/doc/startup_speed_plan.md +97 -0
  21. data/doc/treap_visualizer.html +585 -0
  22. data/doc/unused_code_plan.md +120 -0
  23. data/doc/vim_compatibility_plan.md +451 -0
  24. data/doc/vimlike_vim_conflicts.md +262 -0
  25. data/doc/vm_snapshots_plan.md +146 -0
  26. data/doc/wysiwyg_plan.md +231 -0
  27. data/exe/run_tests.rb +124 -3
  28. data/exe/vimamsa +68 -5
  29. data/fonts/OFL-Oxanium.txt +93 -0
  30. data/fonts/Oxanium[wght].ttf +0 -0
  31. data/help/intro.txt +30 -0
  32. data/help/vim_intro.txt +31 -0
  33. data/icon.png +0 -0
  34. data/img/demo.gif +0 -0
  35. data/img/demo.mp4 +0 -0
  36. data/lang/hyperplaintext.lang +7 -1
  37. data/lib/vimamsa/ack.rb +13 -1
  38. data/lib/vimamsa/actions.rb +385 -37
  39. data/lib/vimamsa/appimage_env.rb +35 -0
  40. data/lib/vimamsa/audio.rb +2 -5
  41. data/lib/vimamsa/bookmarks.rb +302 -0
  42. data/lib/vimamsa/buffer.rb +675 -118
  43. data/lib/vimamsa/buffer_changetext.rb +150 -68
  44. data/lib/vimamsa/buffer_cursor.rb +7 -0
  45. data/lib/vimamsa/buffer_list.rb +6 -2
  46. data/lib/vimamsa/buffer_manager.rb +10 -7
  47. data/lib/vimamsa/bundled_fonts.rb +32 -0
  48. data/lib/vimamsa/cli_help.rb +75 -0
  49. data/lib/vimamsa/clipboard.rb +9 -3
  50. data/lib/vimamsa/conf.rb +68 -3
  51. data/lib/vimamsa/constants.rb +3 -0
  52. data/lib/vimamsa/crash_handler.rb +149 -0
  53. data/lib/vimamsa/debug.rb +6 -3
  54. data/lib/vimamsa/demo_player.rb +458 -0
  55. data/lib/vimamsa/demo_recorder.rb +277 -0
  56. data/lib/vimamsa/desktop_install.rb +96 -0
  57. data/lib/vimamsa/diff_buffer.rb +40 -11
  58. data/lib/vimamsa/dot_repeat.rb +104 -0
  59. data/lib/vimamsa/easy_jump.rb +57 -3
  60. data/lib/vimamsa/editor.rb +327 -78
  61. data/lib/vimamsa/encrypt.rb +78 -29
  62. data/lib/vimamsa/file_finder.rb +4 -19
  63. data/lib/vimamsa/file_history.rb +4 -1
  64. data/lib/vimamsa/file_manager.rb +46 -31
  65. data/lib/vimamsa/fold.rb +226 -0
  66. data/lib/vimamsa/form_input.rb +388 -0
  67. data/lib/vimamsa/gui.rb +603 -119
  68. data/lib/vimamsa/gui_command_line.rb +247 -0
  69. data/lib/vimamsa/gui_dialog.rb +94 -42
  70. data/lib/vimamsa/gui_file_panel.rb +356 -25
  71. data/lib/vimamsa/gui_form_generator.rb +75 -40
  72. data/lib/vimamsa/gui_func_panel.rb +67 -22
  73. data/lib/vimamsa/gui_image.rb +3 -0
  74. data/lib/vimamsa/gui_key_hint.rb +165 -0
  75. data/lib/vimamsa/gui_keylog_panel.rb +408 -0
  76. data/lib/vimamsa/gui_menu.rb +84 -53
  77. data/lib/vimamsa/gui_select_window.rb +80 -75
  78. data/lib/vimamsa/gui_settings.rb +86 -41
  79. data/lib/vimamsa/gui_sourceview.rb +280 -92
  80. data/lib/vimamsa/gui_sourceview_autocomplete.rb +319 -90
  81. data/lib/vimamsa/gui_text.rb +63 -2
  82. data/lib/vimamsa/gui_theme.rb +615 -0
  83. data/lib/vimamsa/hook.rb +5 -0
  84. data/lib/vimamsa/hyper_plain_text.rb +3 -0
  85. data/lib/vimamsa/intro_page.rb +368 -0
  86. data/lib/vimamsa/key_actions.rb +382 -193
  87. data/lib/vimamsa/key_binding_tree.rb +467 -273
  88. data/lib/vimamsa/key_bindings_notepad.rb +45 -0
  89. data/lib/vimamsa/key_bindings_report.rb +484 -0
  90. data/lib/vimamsa/key_bindings_vim.rb +104 -0
  91. data/lib/vimamsa/key_bindings_vimlike.rb +353 -289
  92. data/lib/vimamsa/key_names.rb +80 -0
  93. data/lib/vimamsa/langservp.rb +271 -54
  94. data/lib/vimamsa/line_tree.rb +367 -0
  95. data/lib/vimamsa/macro.rb +23 -3
  96. data/lib/vimamsa/main.rb +14 -8
  97. data/lib/vimamsa/rbvma.rb +41 -1
  98. data/lib/vimamsa/registers.rb +125 -0
  99. data/lib/vimamsa/run_ruby.rb +64 -0
  100. data/lib/vimamsa/search.rb +3 -0
  101. data/lib/vimamsa/search_replace.rb +15 -14
  102. data/lib/vimamsa/string_util.rb +134 -40
  103. data/lib/vimamsa/terminal.rb +3 -0
  104. data/lib/vimamsa/test_framework.rb +28 -2
  105. data/lib/vimamsa/tests.rb +11 -8
  106. data/lib/vimamsa/text_objects.rb +310 -0
  107. data/lib/vimamsa/text_transforms.rb +18 -0
  108. data/lib/vimamsa/tmp_user_dir.rb +39 -0
  109. data/lib/vimamsa/user_dirs.rb +83 -0
  110. data/lib/vimamsa/util.rb +46 -7
  111. data/lib/vimamsa/version.rb +1 -1
  112. data/lib/vimamsa/vim_core.rb +355 -0
  113. data/lib/vimamsa/vim_operators.rb +365 -0
  114. data/lib/vimamsa.rb +0 -1
  115. data/modules/calculator/calculator.rb +5 -5
  116. data/modules/color_highlight/color_highlight.rb +118 -0
  117. data/modules/color_highlight/color_highlight_info.rb +3 -0
  118. data/modules/dictation/dictation.rb +1054 -0
  119. data/modules/dictation/dictation_info.rb +3 -0
  120. data/modules/dictation/whisper_worker.py +273 -0
  121. data/modules/ollama/ollama.rb +107 -0
  122. data/modules/ollama/ollama_info.rb +3 -0
  123. data/modules/terminal/terminal.rb +5 -5
  124. data/modules/tts/tts.rb +119 -0
  125. data/modules/tts/tts_info.rb +3 -0
  126. data/run_e2e_vm.sh +28 -0
  127. data/run_tests_vm.rb +138 -0
  128. data/scripts/appimage/AppRun +54 -0
  129. data/scripts/appimage/Dockerfile +18 -0
  130. data/scripts/appimage/build.sh +19 -0
  131. data/scripts/appimage/build_in_container.sh +192 -0
  132. data/scripts/appimage/smoke_test.sh +27 -0
  133. data/scripts/demo/demo_easyjump_steps.txt +60 -0
  134. data/scripts/demo/demo_files_steps.txt +52 -0
  135. data/scripts/demo/demo_steps.txt +67 -0
  136. data/scripts/demo/notes.txt +6 -0
  137. data/scripts/demo/record_demo.rb +156 -0
  138. data/scripts/demo/report.rb +7 -0
  139. data/scripts/demo/shapes.rb +29 -0
  140. data/scripts/demo/square/shapes.rb +29 -0
  141. data/scripts/demo/square/steps.txt +185 -0
  142. data/scripts/lib/perf_startup.rb +138 -0
  143. data/scripts/lib/script_helpers.rb +53 -0
  144. data/scripts/perf_compare.rb +34 -0
  145. data/scripts/profile_startup.rb +72 -0
  146. data/styles/134272-molokai.xml +3 -0
  147. data/styles/molokai_cyber.xml +48 -0
  148. data/styles/molokai_edit.xml +1 -0
  149. data/tests/support/virtual_keyboard.rb +254 -0
  150. data/tests/support/virtual_mic.rb +67 -0
  151. data/tests/test_ack.rb +22 -0
  152. data/tests/test_action_ids.rb +232 -0
  153. data/tests/test_auto_format.rb +122 -0
  154. data/tests/test_autocomplete.rb +211 -0
  155. data/tests/test_autosave.rb +145 -0
  156. data/tests/test_basic_editing.rb +46 -16
  157. data/tests/test_bookmarks.rb +206 -0
  158. data/tests/test_bracket_match.rb +88 -0
  159. data/tests/test_bundling.rb +92 -0
  160. data/tests/test_cli_help.rb +64 -0
  161. data/tests/test_color_highlight.rb +92 -0
  162. data/tests/test_command_line.rb +79 -0
  163. data/tests/test_command_line_file.rb +27 -0
  164. data/tests/test_context_menu_file.rb +147 -0
  165. data/tests/test_copy_paste.rb +106 -26
  166. data/tests/test_crash_handler.rb +39 -0
  167. data/tests/test_custom_two_phase.rb +92 -0
  168. data/tests/test_demo_player.rb +301 -0
  169. data/tests/test_demo_recorder.rb +202 -0
  170. data/tests/test_dialog_callback_errors.rb +44 -0
  171. data/tests/test_dictation.rb +294 -0
  172. data/tests/test_diff_buffer_name.rb +51 -0
  173. data/tests/test_dot_repeat.rb +88 -0
  174. data/tests/test_double_click.rb +41 -0
  175. data/tests/test_drag_selection.rb +125 -0
  176. data/tests/test_e2e_cmdline.rb +116 -0
  177. data/tests/test_e2e_dictation.rb +98 -0
  178. data/tests/test_e2e_replace_char.rb +58 -0
  179. data/tests/test_easy_jump.rb +93 -0
  180. data/tests/test_extract_file_links.rb +55 -0
  181. data/tests/test_file_format.rb +217 -0
  182. data/tests/test_file_manager.rb +72 -0
  183. data/tests/test_file_panel.rb +269 -0
  184. data/tests/test_flash.rb +78 -0
  185. data/tests/test_fold.rb +111 -0
  186. data/tests/test_font_refresh.rb +56 -0
  187. data/tests/test_form_input.rb +203 -0
  188. data/tests/test_func_panel.rb +68 -0
  189. data/tests/test_grep_apply.rb +46 -0
  190. data/tests/test_gtk_sync.rb +126 -0
  191. data/tests/test_hpt_highlight_visible.rb +75 -0
  192. data/tests/test_hpt_link_highlight.rb +82 -0
  193. data/tests/test_intro_page.rb +437 -0
  194. data/tests/test_jump_to_file.rb +41 -0
  195. data/tests/test_key_bindings.rb +208 -0
  196. data/tests/test_key_categories.rb +163 -0
  197. data/tests/test_keylog_panel.rb +261 -0
  198. data/tests/test_line_ends.rb +51 -0
  199. data/tests/test_line_tree.rb +86 -0
  200. data/tests/test_lsp_clangd.rb +281 -0
  201. data/tests/test_lsp_jump.rb +87 -0
  202. data/tests/test_lsp_position_encoding.rb +49 -0
  203. data/tests/test_lsp_symbols.rb +68 -0
  204. data/tests/test_macro.rb +137 -0
  205. data/tests/test_markdown_highlight.rb +57 -0
  206. data/tests/test_mode_badge.rb +41 -0
  207. data/tests/test_module_interface.rb +9 -9
  208. data/tests/test_notepad_bindings.rb +67 -0
  209. data/tests/test_perf_startup.rb +28 -0
  210. data/tests/test_popup_queue.rb +51 -0
  211. data/tests/test_random_edit.rb +109 -0
  212. data/tests/test_registers.rb +122 -0
  213. data/tests/test_revert.rb +127 -0
  214. data/tests/test_run_ruby.rb +77 -0
  215. data/tests/test_startup_file.rb +58 -0
  216. data/tests/test_status_area.rb +50 -0
  217. data/tests/test_text_objects.rb +163 -0
  218. data/tests/test_text_transforms.rb +341 -0
  219. data/tests/test_tmp_user_dir.rb +79 -0
  220. data/tests/test_tts.rb +68 -0
  221. data/tests/test_undo.rb +34 -34
  222. data/tests/test_user_dirs.rb +122 -0
  223. data/tests/test_vim_bindings.rb +353 -0
  224. data/tests/test_vim_conflicts.rb +100 -0
  225. data/tests/test_vim_operators.rb +116 -0
  226. data/tests/test_window_layout.rb +302 -0
  227. data/vimamsa.gemspec +3 -1
  228. data/vm_guest_run.sh +129 -0
  229. metadata +167 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 65bf166a03bdc844a703bbb423e80eee58b65da2aea57039727929c04a6cca79
4
- data.tar.gz: 9ee3ebab2b820f77992defb5f435451b9bb40e57cf4062ce9636a36622abfcf6
3
+ metadata.gz: c40414938b976087d5c008f0881257ccf752091dd16d156bf7e21f8e9810839a
4
+ data.tar.gz: 5d8d17f66562cf4a4e4fadd4129d734841f10ad31f61ac56ae469f79c0647305
5
5
  SHA512:
6
- metadata.gz: 20fba0fe91e750581930bd4fd6c804774c67d625ee6811380e6006856e1dd8e2ffdb41227233d600e81756e2db9edc49251d7fba4f917a7a517ef68add7725fe
7
- data.tar.gz: 953f3d3d7590f4e87c5723f7351ffddcd8f9e6031b7683007312397418468c2232edca42fbcd424bea3929e4af9fc8cec326158c543d19407601d637ff7c37dd
6
+ metadata.gz: 74a41608b496082f6fc49e462567d25fdd5783d27362a79d12f07bd02da7a7b7c3b764adc809650b19adea07a1bfcb915f0dcb3645ee19c0b0a41c42ce1ba44f
7
+ data.tar.gz: 59b3151ff41d232f015388579ba5d41a933349eafc451f2e2d74217f1c558b5f9a694bc1a12ffe4676b9cb896bae24f8edca71d07ac89151657edf45d727c306
@@ -0,0 +1,93 @@
1
+ # Builds the AppImage on GitHub's runners (scripts/appimage, doc/bundling_plan.md).
2
+ # - Push a tag vX.Y.Z (matching lib/vimamsa/version.rb): build, test on a clean
3
+ # Ubuntu, sign a build provenance attestation and attach the AppImage to the
4
+ # GitHub release for that tag.
5
+ # - Run it by hand (Actions ▸ AppImage ▸ Run workflow): build and test only;
6
+ # the AppImage is kept as a workflow artifact.
7
+ name: AppImage
8
+
9
+ on:
10
+ push:
11
+ tags: ["v*"]
12
+ workflow_dispatch:
13
+
14
+ permissions:
15
+ contents: write # create the release and upload the file
16
+ id-token: write # sign the attestation
17
+ attestations: write
18
+
19
+ jobs:
20
+ appimage:
21
+ runs-on: ubuntu-24.04
22
+ timeout-minutes: 60
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+ with:
26
+ fetch-depth: 0 # the build clones this checkout; avoid a shallow source
27
+
28
+ - name: Check the tag matches the version
29
+ if: github.ref_type == 'tag'
30
+ run: |
31
+ v=$(ruby -Ilib -e 'require "vimamsa/version"; print Vimamsa::VERSION')
32
+ if [ "v$v" != "$GITHUB_REF_NAME" ]; then
33
+ echo "::error::tag $GITHUB_REF_NAME but lib/vimamsa/version.rb says $v"
34
+ exit 1
35
+ fi
36
+
37
+ # The compiled Ruby and the pinned appimagetool/runtime (all checked by
38
+ # the build script); gems and libraries are always built fresh
39
+ - uses: actions/cache@v4
40
+ with:
41
+ path: build/appimage/cache
42
+ key: appimage-cache-${{ hashFiles('scripts/appimage/Dockerfile', 'scripts/appimage/build_in_container.sh') }}
43
+
44
+ - name: Build
45
+ run: scripts/appimage/build.sh
46
+
47
+ - name: Test on a clean Ubuntu 24.04
48
+ run: scripts/appimage/smoke_test.sh build/appimage/Vimamsa-*-x86_64.AppImage
49
+
50
+ # One file name for every release, so the README can link to
51
+ # releases/latest/download/Vimamsa-x86_64.AppImage
52
+ - name: Name the file
53
+ run: |
54
+ 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)
57
+
58
+ - name: Attest build provenance
59
+ if: github.ref_type == 'tag'
60
+ uses: actions/attest-build-provenance@v2
61
+ with:
62
+ subject-path: dist/Vimamsa-x86_64.AppImage
63
+
64
+ - name: Attach to the release
65
+ if: github.ref_type == 'tag'
66
+ env:
67
+ GH_TOKEN: ${{ github.token }}
68
+ run: |
69
+ notes="Download \`Vimamsa-x86_64.AppImage\`, make it executable and run it:
70
+
71
+ \`\`\`
72
+ chmod +x Vimamsa-x86_64.AppImage
73
+ ./Vimamsa-x86_64.AppImage
74
+ \`\`\`
75
+
76
+ Needs x86_64 Linux with glibc 2.39 or newer (Ubuntu 24.04, Fedora 40, Debian 13 or newer).
77
+
78
+ 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\`"
80
+ if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then
81
+ gh release upload "$GITHUB_REF_NAME" dist/* --clobber
82
+ else
83
+ gh release create "$GITHUB_REF_NAME" dist/* --title "Vimamsa ${GITHUB_REF_NAME#v}" \
84
+ --notes "$notes" --generate-notes
85
+ fi
86
+
87
+ - name: Keep as a workflow artifact
88
+ if: github.ref_type != 'tag'
89
+ uses: actions/upload-artifact@v4
90
+ with:
91
+ name: Vimamsa-x86_64.AppImage
92
+ path: dist/
93
+ retention-days: 14
data/.gitignore CHANGED
@@ -2,7 +2,10 @@
2
2
  /.yardoc
3
3
  /_yardoc/
4
4
  /coverage/
5
- /doc/
6
5
  /pkg/
7
6
  /spec/reports/
8
7
  /tmp/
8
+ /build/
9
+
10
+ # Vimamsa editor autosave files (.<name>_vma_autosave)
11
+ *_vma_autosave
data/Dockerfile CHANGED
@@ -36,10 +36,13 @@ RUN gem install bundler -v '~> 2.4'
36
36
 
37
37
  RUN echo "alias ll='ls -ltrh'" >> ~/.bashrc
38
38
  ARG CACHE_BUST=1
39
- RUN git clone https://github.com/SamiSieranoja/vimamsa.git && cd vimamsa && gem build vimamsa.gemspec && gem install vimamsa-0.1.*.gem
40
- RUN cp /usr/local/bundle/gems/vimamsa-0.1.23/ext/vmaext/vmaext.so vimamsa/lib/
39
+ RUN git clone https://github.com/SamiSieranoja/vimamsa.git && cd vimamsa && gem build vimamsa.gemspec && gem install vimamsa-*.gem
41
40
 
42
- WORKDIR /app/vimamsa
43
- CMD ["bash", "-c", "xvfb-run -a ruby run_tests.rb 2>&1"]
41
+ # Tests should not depend on writing to these directories
42
+ RUN chmod a-w -R /usr/local/bundle/gems/vimamsa*
43
+ RUN chmod a-w -R vimamsa
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"]
44
47
 
45
48
 
data/README.md CHANGED
@@ -4,27 +4,59 @@ Vi/Vim -inspired experimental GUI-oriented text editor written with Ruby and GTK
4
4
 
5
5
  <!-- toc -->
6
6
 
7
- - [Requirements](#requirements)
8
- - [Installation](#installation)
7
+ - [Download (AppImage)](#download-appimage)
8
+ - [Install as a Ruby gem](#install-as-a-ruby-gem)
9
9
  * [Other install options](#other-install-options)
10
10
  - [Run](#run)
11
- - [Screenshots](#screenshots)
11
+ - [Demo](#demo)
12
12
  - [Key bindings](#key-bindings)
13
13
  - [Current limitations](#current-limitations)
14
14
 
15
15
  <!-- tocstop -->
16
16
 
17
- ## Requirements
18
- - Ruby 3.0+
19
- - GTK 4
20
-
17
+ ## Download (AppImage)
18
+
19
+ The easiest way: one file, nothing to install (Ruby, GTK and everything else
20
+ the editor needs are inside it).
21
+
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
+ 2. Make it executable and run it:
25
+ ```
26
+ chmod +x Vimamsa-x86_64.AppImage
27
+ ./Vimamsa-x86_64.AppImage [file]
28
+ ```
29
+ (or in the file manager: Properties ▸ "Allow executing file as program", then
30
+ double-click it).
31
+
32
+ On the first start it adds Vimamsa to the application menu. If you move the
33
+ file, start it once from the new place to update the menu entry. To update, download the new
34
+ version over the old file.
35
+
36
+ Requirements: x86_64 Linux with glibc 2.39 or newer: Ubuntu 24.04, Linux Mint 22,
37
+ Fedora 40, Debian 13, Arch, openSUSE Tumbleweed or newer. On an older system it
38
+ stops at start with `GLIBC_2.39 not found`; use the gem install below instead.
39
+ If your home directory is mounted `noexec`, move the file to a place where programs
40
+ can run.
41
+
42
+ The AppImage is built by [GitHub Actions](.github/workflows/appimage.yml) from the
43
+ tagged source. To check that a downloaded file came from this repository's build
44
+ (needs the [GitHub CLI](https://cli.github.com/)):
45
+ ```
46
+ gh attestation verify Vimamsa-x86_64.AppImage --repo SamiSieranoja/vimamsa
47
+ ```
21
48
 
22
- ## Installation
49
+ ## Install as a Ruby gem
23
50
 
51
+ Requirements:
52
+ - Ruby 3.2+
53
+ - GTK 4
24
54
 
25
- On Ubuntu (22.04):
55
+ On Ubuntu (24.04):
26
56
  ```
27
- 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
28
60
  sudo gem install vimamsa
29
61
  ```
30
62
 
@@ -45,10 +77,6 @@ sudo gem install --local vimamsa-0.1.*.gem
45
77
 
46
78
  ```
47
79
 
48
- Older version for GTK3:
49
-
50
- sudo gem install vimamsa -v 0.1.10
51
-
52
80
  ## Run
53
81
  ```
54
82
  vimamsa
@@ -59,106 +87,171 @@ Install packages for optional features:
59
87
  sudo apt install ack-grep clang-format
60
88
  ```
61
89
 
62
- For customization, edit ~/.vimamsa/custom.rb
90
+ For customization, edit ~/.config/vimamsa/custom.rb (Settings ▸ Customize).
63
91
 
64
- ## Screenshots
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.
65
98
 
66
- <a href="https://raw.githubusercontent.com/SamiSieranoja/vimamsa/refs/heads/master/img/screenshot1.png" target="_blank"><img src="https://raw.githubusercontent.com/SamiSieranoja/vimamsa/refs/heads/master/img/screenshot1.png" width="400"/></a>
67
- <a href="https://raw.githubusercontent.com/SamiSieranoja/vimamsa/refs/heads/master/img/screenshot2.png" target="_blank"><img src="https://raw.githubusercontent.com/SamiSieranoja/vimamsa/refs/heads/master/img/screenshot2.png" width="400"/></a>
99
+ ## Demo
100
+
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)
102
+
103
+ Moving with `h j k l` and `w e b`, `y y p`, `d d`, undo `u` / redo `ctrl-r`,
104
+ typing in Insert mode and back to Command mode with `ctrl` (press and release
105
+ it alone), selecting in Visual mode, and easy jump (`s`: type a word's label to
106
+ jump there). The key log panel on the right (View ▸ Toggle
107
+ key log panel) shows each key and the action it ran.
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.
68
114
 
69
115
  ## Key bindings
70
116
 
71
- 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:
72
123
 
73
- Keys that work somewhat similarly as in Vim:
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)
74
127
 
75
- In Command mode:
128
+ Keys that work much like in Vim:
129
+
130
+ In Command mode:
76
131
  ```
77
- j k l h w b p P G f F ; 0 $ v i o J * / a A I u ctrl-r x
78
- 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
79
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`, `> >`.
80
138
 
81
139
  In Visual mode:
82
140
  ```
83
- d y gU gu
141
+ d x y c J u U ~ gU gu > < iw aw ...
84
142
  ```
85
143
 
86
- Keys that work differently to Vim are documented in the tables below
87
-
88
- Syntax:
89
-
90
- - 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.
91
- - ctrl-x means press and hold ctrl key, press x
92
-
93
- <table>
94
- <colgroup>
95
- <col style="text-align:center;"/>
96
- <col style="text-align:left;"/>
97
- </colgroup>
98
-
99
- <thead> <tr> <th style="text-align:center;" colspan="4">Command mode keys</th> </tr> </thead>
100
-
101
- <tbody>
102
- <tr><th>Key</th><th>Action</th></tr>
103
- <tr><td style="text-align:center;">ctrl!</td> <td style="text-align:left;">switch between command and insert modes</td> </tr>
104
- <tr> <td style="text-align:center;">z</td> <td style="text-align:left;"> enter into BROWSE mode</td></tr>
105
- <tr> <td style="text-align:center;">shift!</td> <td style="text-align:left;">save file</td> </tr>
106
- <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>
107
- <tr> <td style="text-align:center;">tab</td> <td style="text-align:left;">switch betwen current and previous buffer/file</td></tr>
108
- <tr> <td style="text-align:center;">enter</td> <td style="text-align:left;"> (when cursor on link) open url in browser </td></tr>
109
- <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>
110
- <tr> <td style="text-align:center;">,a</td> <td style="text-align:left;">Search for string using ack
111
- </td></tr>
112
- <tr> <td style="text-align:center;">,b</td> <td style="text-align:left;"> Switch buffer (jump to other open file)</td></tr>
113
- <tr> <td style="text-align:center;">,g</td> <td style="text-align:left;">search for input string inside current buffer</td></tr>
114
- <tr> <td style="text-align:center;">,f</td> <td style="text-align:left;">File finder</td></tr>
115
- <tr> <td style="text-align:center;">space c</td> <td style="text-align:left;">insert character "c"</td></tr>
116
- </tbody>
117
- </table>
118
-
119
- <table>
120
- <colgroup>
121
- <col style="text-align:center;"/>
122
- <col style="text-align:left;"/>
123
- </colgroup>
124
-
125
- <thead> <tr> <th style="text-align:center;" colspan="4">Insert mode keys (similar to bash or emacs)</th> </tr> </thead>
126
-
127
- <tbody>
128
- <tr> <td style="text-align:center;">ctrl! OR esc</td> <td style="text-align:left;">Switch to command mode</td></tr>
129
- <tr> <td style="text-align:center;">ctrl-n</td> <td style="text-align:left;">Move to next line</td></tr>
130
- <tr> <td style="text-align:center;">ctrl-p</td> <td style="text-align:left;">Move to previous line</td></tr>
131
- <tr> <td style="text-align:center;">ctrl-a</td> <td style="text-align:left;">Move beginning of line</td></tr>
132
- <tr> <td style="text-align:center;">ctrl-e</td> <td style="text-align:left;">Move to end of line</td></tr>
133
- <tr> <td style="text-align:center;">ctrl-b</td> <td style="text-align:left;">Move backward one char</td></tr>
134
- <tr> <td style="text-align:center;">ctrl-f</td> <td style="text-align:left;">Move forward one char</td></tr>
135
- <tr> <td style="text-align:center;">alt-f</td> <td style="text-align:left;">Move forward one word</td></tr>
136
- <tr> <td style="text-align:center;">alt-b</td> <td style="text-align:left;">Move backward one word</td></tr>
137
- </tbody>
138
- </table>
139
-
140
-
141
- <table>
142
- <colgroup>
143
- <col style="text-align:center;"/>
144
- <col style="text-align:left;"/>
145
- </colgroup>
146
-
147
- <thead> <tr> <th style="text-align:center;" colspan="4">Browse mode keys</th> </tr> </thead>
148
-
149
- <tbody>
150
- <tr> <td style="text-align:center;">h</td> <td style="text-align:left;">jump to previous buffer in history</td></tr>
151
- <tr> <td style="text-align:center;">l</td> <td style="text-align:left;">jump to next buffer in history</td></tr>
152
- <tr> <td style="text-align:center;">q</td> <td style="text-align:left;">jump to previous edited position</td></tr>
153
- <tr> <td style="text-align:center;">w</td> <td style="text-align:left;">jump to next edited position</td></tr>
154
- <tr> <td style="text-align:center;">j OR esc</td> <td style="text-align:left;">switch from browse to command mode</td></tr>
155
- </tbody>
156
- </table>
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'
244
+ ```
157
245
 
158
- Bindings can be customized in ~/.vimamsa/custom.rb
159
- For example, to bind ctrl-n to action "create new file":
246
+ custom.rb is loaded in two phases. The body of the file runs early, before
247
+ modules are initialized, so that the settings it makes (cnf.\*) are visible to
248
+ them. Modes that are created by modules (e.g. "fexp" for the file selector,
249
+ "grep") do not exist yet at that point; bindings for those go in an optional
250
+ function `hook_custom_after_init`, which is called after everything is loaded:
160
251
  ```
161
- bindkey 'C ctrl-n', 'create_new_file()'
252
+ def hook_custom_after_init
253
+ bindkey 'fexp , x', :my_action
254
+ end
162
255
  ```
163
256
 
164
257
 
@@ -166,7 +259,10 @@ bindkey 'C ctrl-n', 'create_new_file()'
166
259
  - 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.
167
260
 
168
261
  ## Current limitations
169
- - UTF8 only
262
+ - Linux only
263
+
264
+ Mainly tested with:
265
+ - UTF8, English or Finnish
170
266
  - Line endings with "\n"
171
267
 
172
268
 
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,39 +68,73 @@ 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"
67
- l = vma.buf.get_current_line.strip
68
- m = l.match(/[^;!]+/)
69
- if m
70
- cardname = m[0].strip
71
- # cardname = "Omnath, locus of mana"
72
- u = URI.encode_www_form_component(cardname)
73
- url = "https://gatherer.wizards.com/Pages/Card/Details.aspx?name=#{u}"
74
- if !urlpref.nil?
75
- url = urlpref + u
76
- end
77
- open_url(url)
75
+ cardname = if vma.buf.visual_mode?
76
+ vma.buf.get_current_selection.strip
77
+ else
78
+ l = vma.buf.get_current_line.strip
79
+ m = l.match(/(\w[\w\'\-\s]+)/)
80
+ m ? m[0].strip : nil
78
81
  end
82
+ return if cardname.nil? || cardname.empty?
83
+ u = URI.encode_www_form_component(cardname)
84
+ url = urlpref ? urlpref + u : "https://gatherer.wizards.com/Pages/Card/Details.aspx?name=#{u}"
85
+ open_url(url)
79
86
  end
80
87
 
81
- # reg_act(:open_mtg, proc { open_mtg }, "open mtg card info")
82
- # bindkey "C , , m", :open_mtg
88
+ # reg_act("custom.mtg", proc { open_mtg }, "open mtg card info")
89
+ # bindkey "VC , , m", "custom.mtg"
90
+ # Try on this line:
83
91
  # Restless Cottage
84
- # https://duckduckgo.com/?ia=web&origin=funnel_home_website&t=h_&q=
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
85
96
 
86
97
  # Primitive support for LSP (not well tested)
87
98
  # To enable LSP:
88
99
  # cnf.lsp.enabled = true
100
+
101
+ # solargraph (Ruby):
89
102
  # cnf.lsp.server.solargraph = { name: "solargraph", command: "solargraph stdio", type: "stdio" }
90
103
  # cnf.lsp.server.solargraph.languages = ["ruby"]
91
104
 
105
+ # ruby-lsp (Ruby):
106
+ # cnf.lsp.server.ruby_lsp = { name: "ruby-lsp", command: "bundle exec ruby-lsp", type: "stdio" }
107
+ # cnf.lsp.server.ruby_lsp.languages = ["ruby"]
108
+
109
+
92
110
  # cnf.lsp.server.clangd = { name: "clangd", command: "clangd-12 --offset-encoding=utf-8", type: "stdio" }
93
111
  # cnf.lsp.server.clangd.languages = ["c", "cpp"]
94
112
 
113
+ # Autocomplete (word completion popup in insert mode). Disabled by default.
114
+ # Candidates come from words in open buffers, plus the LSP server when
115
+ # cnf.lsp.enabled and a server is configured for the file's language.
116
+ # Enable it and (optionally) tune the defaults shown:
117
+ # cnf.autocomplete.enabled = true
118
+ # cnf.autocomplete.auto_trigger = true # popup while typing (false: ctrl-space/ctrl-h only)
119
+ # cnf.autocomplete.min_chars = 2 # typed chars before the popup opens
120
+ # cnf.autocomplete.max_items = 50 # candidates kept in the list
121
+ # cnf.autocomplete.visible_items = 10 # popup rows before scrolling
122
+ # cnf.autocomplete.lsp.enabled = true
123
+ # cnf.autocomplete.lsp.debounce = 0.15 # seconds before asking the server
124
+
95
125
  # Uncomment this if you don't want to see the state trail of previous action
96
126
  # on top right corner:
97
127
  # cnf.kbd.show_prev_action = false
98
128
 
129
+ # Add comment character rule for a file type not detected automatically:
130
+ # cnf.comment_chars! << { pattern: /\.lua$/, char: "--" }
131
+
132
+ # Second phase of this file. Everything above runs early during startup, before
133
+ # the file selector, grep and the modules are initialized, so that the cnf.*
134
+ # settings above are visible to them. Their keyboard modes (e.g. "fexp" for the
135
+ # file selector, "grep") do not exist yet at that point: bindings for those go
136
+ # here, in a function that is called after everything has been loaded.
137
+ # def hook_custom_after_init
138
+ # bindkey "fexp , x", "custom.my_file_action"
139
+ # end
140
+