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
data/run_tests_vm.rb ADDED
@@ -0,0 +1,138 @@
1
+ #!/usr/bin/env ruby
2
+ # Run the vimamsa test suite inside the VirtualBox VM named by $VM_NAME, on its
3
+ # real logged-in desktop (so the GTK window actually appears in the VM).
4
+ #
5
+ # Reaches the guest via VBoxManage guestcontrol (Guest Additions): no SSH or
6
+ # shared folder needed. Syncs the current working tree (incl. uncommitted
7
+ # changes), provisions the guest on first run, builds the native extension,
8
+ # then runs exe/run_tests.rb on DISPLAY :0 (vm_guest_run.sh, in the guest).
9
+ # Exits with the suite's exit code (0 pass / 1 fail).
10
+ #
11
+ # Usage (VM_NAME, VM_USER and VM_PASS exported, e.g. in ~/.bashrc):
12
+ # ./run_tests_vm.rb [test filter args...]
13
+ # Examples:
14
+ # ./run_tests_vm.rb # full suite
15
+ # ./run_tests_vm.rb undo # tests/test_undo.rb only
16
+ # FORCE_PROVISION=1 ./run_tests_vm.rb # re-run apt provisioning
17
+ # VMA_UPDATE_DOC=1 ./run_tests_vm.rb vim_conflicts # also copy back generated docs
18
+ #
19
+ # Env:
20
+ # VM_NAME (required) VirtualBox VM name
21
+ # VM_USER (required) guest login username
22
+ # VM_PASS (required) guest login/sudo password for user $VM_USER
23
+ # VM_DISPLAY guest desktop X display (default: :0)
24
+ # FORCE_PROVISION set to 1 to force guest re-provisioning
25
+ # VMA_UPDATE_DOC set to 1 to copy regenerated docs back (GENERATED_DOCS)
26
+ # VMA_E2E_INTERACTIVE passed on to the guest (run_e2e_vm.sh sets it)
27
+ #
28
+ # Exit codes: the suite's 0 / 1; 2 required variable not set; 4 Guest
29
+ # Additions not answering; 5 the guest never reached the test phase; 6 packing
30
+ # the working tree failed.
31
+ require "tempfile"
32
+ require "tmpdir"
33
+ require "fileutils"
34
+ require_relative "scripts/lib/script_helpers"
35
+ include ScriptHelpers
36
+
37
+ # Tracked docs that tests regenerate in the guest with VMA_UPDATE_DOC=1
38
+ GENERATED_DOCS = ["doc/vimlike_vim_conflicts.md"]
39
+
40
+ # Left out of the copy sent to the guest (tar --exclude patterns)
41
+ TAR_EXCLUDES = %w[
42
+ ./.git/hooks *_vma_autosave .*_vma_autosave *.gem *.o *.so *.tar.xz
43
+ __pycache__ *.log claude-log.* dot_git_old ./build 2del_* bug*.txt *.mp3 *.wav
44
+ ]
45
+
46
+ missing = missing_env("VM_NAME", "VM_USER", "VM_PASS")
47
+ if missing.any?
48
+ fail!("Not set: #{missing.join(" ")}. Export VM_NAME (VirtualBox VM), VM_USER (guest user)\n" \
49
+ "and VM_PASS (guest password), e.g. in ~/.bashrc.", 2)
50
+ end
51
+
52
+ vm = ENV["VM_NAME"]
53
+ user = ENV["VM_USER"]
54
+ display = ENV["VM_DISPLAY"].to_s.empty? ? ":0" : ENV["VM_DISPLAY"]
55
+ guest_home = "/home/#{user}"
56
+ repo, ok = Open3.capture2("git", "-C", __dir__, "rev-parse", "--show-toplevel")
57
+ repo = ok.success? ? repo.strip : __dir__
58
+
59
+ # The password goes to VBoxManage in a chmod-600 file, so it isn't visible in
60
+ # `ps` (the guest script gets it as SUDO_PASS through --putenv, as before).
61
+ pwfile = Tempfile.new("vma_vm_pw")
62
+ tarball = Tempfile.new(["vimamsa_src", ".tgz"])
63
+ begin
64
+ File.chmod(0o600, pwfile.path)
65
+ pwfile.write(ENV["VM_PASS"])
66
+ pwfile.flush
67
+
68
+ # In VBoxManage 7.x the credentials/options belong to the run/copyto
69
+ # subcommand (after it), and use --opt=value syntax.
70
+ gc = ["VBoxManage", "guestcontrol", vm]
71
+ cred = ["--username=#{user}", "--passwordfile=#{pwfile.path}"]
72
+
73
+ # 1. Ensure the VM is running and Guest Additions answer.
74
+ running, = Open3.capture2("VBoxManage", "list", "runningvms")
75
+ if !running.include?("\"#{vm}\"")
76
+ step "Starting VM #{vm}"
77
+ run!("VBoxManage", "startvm", vm, "--type", "gui", label: "VBoxManage startvm")
78
+ end
79
+ step "Waiting for Guest Additions in #{vm}"
80
+ answered = 60.times.any? { |i|
81
+ sleep 2 if i > 0
82
+ system(*gc, "run", *cred, "--exe=/bin/true", "--", "true", out: File::NULL, err: File::NULL)
83
+ }
84
+ fail!("Guest Additions not responding after 2 min. Is the guest booted and logged in?", 4) if !answered
85
+
86
+ # 2. Tarball the working tree (with .git, for `gem build`; without heavy
87
+ # junk). tar exits with 1 for "file changed as we read it" (e.g. .git
88
+ # churning during the read): only a fatal error (2 and up) aborts.
89
+ step "Packing working tree"
90
+ system("tar", "czf", tarball.path, "-C", repo, "--warning=no-file-changed",
91
+ *TAR_EXCLUDES.map { |e| "--exclude=#{e}" }, ".")
92
+ fail!("tar failed (exit #{$?.exitstatus})", 6) if $?.exitstatus.to_i > 1
93
+
94
+ # 3. Copy the tarball and the guest runner into the VM (copyto overwrites).
95
+ step "Copying source + runner into guest"
96
+ run!(*gc, "copyto", *cred, tarball.path, "#{guest_home}/vimamsa_src.tgz", label: "VBoxManage copyto")
97
+ run!(*gc, "copyto", *cred, File.join(repo, "vm_guest_run.sh"), "#{guest_home}/vm_guest_run.sh",
98
+ label: "VBoxManage copyto")
99
+
100
+ # 4. Run the guest script, streaming its output. VBoxManage doesn't pass on
101
+ # the guest's exit code, so pass/fail comes from the VMA_SUITE_EXIT sentinel
102
+ # the guest prints, not from VBoxManage's own exit status.
103
+ step "Running test suite in guest (DISPLAY #{display})"
104
+ putenv = {
105
+ "SUDO_PASS" => ENV["VM_PASS"], "VMA_DISPLAY" => display, "VMA_TEST_ARGS" => ARGV.join(" "),
106
+ "FORCE_PROVISION" => ENV["FORCE_PROVISION"].to_s, "VMA_E2E_INTERACTIVE" => ENV["VMA_E2E_INTERACTIVE"].to_s,
107
+ "VMA_UPDATE_DOC" => ENV["VMA_UPDATE_DOC"].to_s,
108
+ }.map { |k, v| "--putenv=#{k}=#{v}" }
109
+ out, = run_streaming(*gc, "run", *cred, "--exe=/bin/bash", "--wait-stdout", "--wait-stderr",
110
+ *putenv, "--", "#{guest_home}/vm_guest_run.sh")
111
+
112
+ sentinel = out.scan(/VMA_SUITE_EXIT=(\d+)/).last&.first
113
+ if sentinel.nil?
114
+ fail!("Did not receive a VMA_SUITE_EXIT sentinel from the guest: the run did not\n" \
115
+ "reach the test phase (provisioning/build failure above).", 5)
116
+ end
117
+ step "Suite exit code (from guest): #{sentinel}"
118
+
119
+ # VMA_UPDATE_DOC=1: tests that generate a tracked doc wrote it in the guest;
120
+ # copy it back into this working tree. copyfrom doesn't truncate an existing
121
+ # file, so copy into an empty directory first.
122
+ if ENV["VMA_UPDATE_DOC"] == "1"
123
+ Dir.mktmpdir { |tmp|
124
+ GENERATED_DOCS.each { |f|
125
+ step "Copying regenerated #{f} from guest"
126
+ if system(*gc, "copyfrom", *cred, "--target-directory=#{tmp}/", "#{guest_home}/vimamsa/#{f}")
127
+ FileUtils.mv(File.join(tmp, File.basename(f)), File.join(repo, f), force: true)
128
+ else
129
+ warn "!! could not copy #{f} back"
130
+ end
131
+ }
132
+ }
133
+ end
134
+ exit sentinel.to_i
135
+ ensure
136
+ pwfile.close!
137
+ tarball.close!
138
+ end
@@ -0,0 +1,54 @@
1
+ #!/bin/sh
2
+ # Entry point of the Vimamsa AppImage. The AppImage runtime sets $APPDIR (the
3
+ # mounted image) and $APPIMAGE (the .AppImage file). Everything the editor
4
+ # loads comes from the image except the host's glibc, graphics drivers, fonts,
5
+ # X11/Wayland client libraries and sound server (see build_in_container.sh).
6
+ HERE="$(dirname "$(readlink -f "$0")")"
7
+ export APPDIR="${APPDIR:-$HERE}"
8
+ U="$APPDIR/usr"
9
+ ARCH_LIB="$U/lib"
10
+
11
+ # Everything changed below is listed in VMA_APPIMAGE_ENV, with the previous
12
+ # value (if any) in VMA_HOST_<name>. After startup the editor puts those back
13
+ # (restore_host_env, lib/vimamsa/appimage_env.rb), so programs it starts don't
14
+ # inherit the bundle's settings.
15
+ VMA_APPIMAGE_ENV=""
16
+ for n in GEM_HOME GEM_PATH RUBYOPT RUBYLIB BUNDLE_GEMFILE GI_TYPELIB_PATH XDG_DATA_DIRS \
17
+ GSETTINGS_SCHEMA_DIR GIO_MODULE_DIR GST_PLUGIN_SYSTEM_PATH_1_0 \
18
+ GST_PLUGIN_SCANNER_1_0 GST_REGISTRY_1_0 GDK_PIXBUF_MODULE_FILE; do
19
+ if eval "[ -n \"\${$n+x}\" ]"; then eval "export VMA_HOST_$n=\"\$$n\""; fi
20
+ VMA_APPIMAGE_ENV="$VMA_APPIMAGE_ENV $n"
21
+ done
22
+ export VMA_APPIMAGE_ENV
23
+
24
+ # The bundled Ruby and gems only: a user's GEM_HOME / RUBYOPT / RUBYLIB would
25
+ # mix in gems compiled for another Ruby.
26
+ unset GEM_HOME GEM_PATH RUBYOPT RUBYLIB BUNDLE_GEMFILE
27
+
28
+ # Libraries are found through RUNPATH ($ORIGIN), not LD_LIBRARY_PATH, so
29
+ # programs the editor starts (git, ack, a terminal) don't load bundled libs.
30
+ export GI_TYPELIB_PATH="$ARCH_LIB/girepository-1.0"
31
+ export XDG_DATA_DIRS="$U/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
32
+ export GSETTINGS_SCHEMA_DIR="$U/share/glib-2.0/schemas"
33
+ export GIO_MODULE_DIR="$ARCH_LIB/gio/modules"
34
+ export GST_PLUGIN_SYSTEM_PATH_1_0="$ARCH_LIB/gstreamer-1.0"
35
+ export GST_PLUGIN_SCANNER_1_0="$ARCH_LIB/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner"
36
+ cache="${XDG_CACHE_HOME:-$HOME/.cache}/vimamsa"
37
+ mkdir -p "$cache" 2>/dev/null
38
+ # Own registry: the host's lists the host's plugins
39
+ export GST_REGISTRY_1_0="$cache/gst-registry-appimage.bin"
40
+
41
+ # gdk-pixbuf's loaders.cache must hold absolute paths: fill in where the
42
+ # image is mounted (it changes on every start).
43
+ pixdir="$ARCH_LIB/gdk-pixbuf-2.0/2.10.0"
44
+ if [ -f "$pixdir/loaders.cache.in" ]; then
45
+ pixcache="$cache/gdk-pixbuf-loaders.cache"
46
+ sed "s|@PIXBUF_LOADERS@|$pixdir/loaders|g" "$pixdir/loaders.cache.in" > "$pixcache" 2>/dev/null &&
47
+ export GDK_PIXBUF_MODULE_FILE="$pixcache"
48
+ fi
49
+
50
+ # ruby-lsp and rufo from the bundle (cnf.lsp.server command "ruby-lsp"),
51
+ # without putting the bundled ruby itself first on PATH.
52
+ export PATH="$U/lib/vimamsa/bin:$PATH"
53
+
54
+ exec "$U/bin/ruby" "$U/bin/vimamsa" "$@"
@@ -0,0 +1,18 @@
1
+ # Build environment for the Vimamsa AppImage (see doc/bundling_plan.md).
2
+ # Ubuntu 24.04: the bundle carries this GTK (4.14) and needs glibc >= 2.39.
3
+ FROM ubuntu:24.04
4
+
5
+ ENV DEBIAN_FRONTEND=noninteractive
6
+ RUN apt-get update && apt-get install -y --no-install-recommends \
7
+ build-essential git pkg-config wget ca-certificates file patchelf binutils \
8
+ autoconf bison libssl-dev libyaml-dev zlib1g-dev libffi-dev libreadline-dev \
9
+ libgdbm-dev libgmp-dev libatk1.0-dev \
10
+ libgtk-4-dev libgtksourceview-5-dev libvte-2.91-gtk4-dev \
11
+ libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgirepository1.0-dev \
12
+ gir1.2-gtk-4.0 gir1.2-gtksource-5 gir1.2-vte-3.91 gir1.2-gstreamer-1.0 \
13
+ gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
14
+ adwaita-icon-theme hicolor-icon-theme librsvg2-common shared-mime-info \
15
+ dconf-gsettings-backend libglib2.0-bin \
16
+ xvfb xauth
17
+ # (apt lists kept: Ruby-GNOME gems apt-get a -dev package they find missing)
18
+ RUN git config --system --add safe.directory '*'
@@ -0,0 +1,19 @@
1
+ #!/bin/bash
2
+ # Build the Vimamsa AppImage in an Ubuntu 24.04 container (needs Docker).
3
+ # scripts/appimage/build.sh # builds HEAD
4
+ # VMA_REF=v0.1.26 scripts/appimage/build.sh
5
+ # VMA_REF=WORKTREE scripts/appimage/build.sh # include uncommitted changes
6
+ # Output: build/appimage/Vimamsa-<version>-x86_64.AppImage. The Ruby build and
7
+ # appimagetool are cached in build/appimage/cache. See doc/bundling_plan.md.
8
+ set -euo pipefail
9
+ REPO="$(git -C "$(dirname "$0")" rev-parse --show-toplevel)"
10
+ OUT="$REPO/build/appimage"
11
+ IMAGE=vimamsa-appimage-build
12
+ mkdir -p "$OUT"
13
+ docker build -q -t "$IMAGE" "$REPO/scripts/appimage" >/dev/null
14
+ docker run --rm \
15
+ -v "$REPO:/src:ro" -v "$OUT:/build" \
16
+ -e VMA_REF="${VMA_REF:-HEAD}" -e RUBY_VERSION="${RUBY_VERSION:-3.4.9}" \
17
+ "$IMAGE" bash /src/scripts/appimage/build_in_container.sh
18
+ # Files written in the container belong to root
19
+ docker run --rm -v "$OUT:/build" "$IMAGE" chown -R "$(id -u):$(id -g)" /build
@@ -0,0 +1,192 @@
1
+ #!/bin/bash
2
+ # Builds build/appimage/Vimamsa-<version>-x86_64.AppImage inside the container
3
+ # from scripts/appimage/Dockerfile. Started by scripts/appimage/build.sh, which
4
+ # mounts the repository read-only at /src and build/appimage at /build.
5
+ #
6
+ # VMA_REF git ref to build (default HEAD), or WORKTREE for HEAD plus uncommitted
7
+ # changes and new files under lib/ modules/ exe/ tests/
8
+ # RUBY_VERSION Ruby to bundle (default 3.4.9; the build is cached in /build/cache)
9
+ set -euo pipefail
10
+
11
+ RUBY_VERSION="${RUBY_VERSION:-3.4.9}"
12
+ VMA_REF="${VMA_REF:-HEAD}"
13
+ SYSLIB=/usr/lib/x86_64-linux-gnu
14
+ B=/build
15
+ CACHE=$B/cache
16
+ APPDIR=$B/AppDir
17
+ U=$APPDIR/usr
18
+ mkdir -p "$CACHE"
19
+
20
+ step() { echo; echo ">> $*"; }
21
+
22
+ # ── 1. Ruby, relocatable (finds its stdlib and gems relative to bin/ruby) ──
23
+ ruby_tar="$CACHE/ruby-$RUBY_VERSION-installed.tar"
24
+ if [ ! -f "$ruby_tar" ]; then
25
+ step "Building Ruby $RUBY_VERSION"
26
+ rm -rf /tmp/rb && mkdir -p /tmp/rb && cd /tmp/rb
27
+ wget -q "https://cache.ruby-lang.org/pub/ruby/${RUBY_VERSION%.*}/ruby-$RUBY_VERSION.tar.gz"
28
+ tar xzf "ruby-$RUBY_VERSION.tar.gz" && cd "ruby-$RUBY_VERSION"
29
+ ./configure -q --prefix=/usr --enable-load-relative --enable-shared --disable-install-doc
30
+ make -s -j"$(nproc)" >/dev/null
31
+ make -s install DESTDIR=/tmp/rb/root >/dev/null
32
+ tar cf "$ruby_tar" -C /tmp/rb/root .
33
+ fi
34
+ step "Fresh AppDir"
35
+ rm -rf "$APPDIR" && mkdir -p "$APPDIR"
36
+ tar xf "$ruby_tar" -C "$APPDIR"
37
+ export PATH="$U/bin:$PATH"
38
+
39
+ # ── 2. vimamsa gem + dependencies, compiled against this container's libs ──
40
+ step "Building the vimamsa gem from $VMA_REF"
41
+ rm -rf /tmp/src && git clone -q /src /tmp/src
42
+ cd /tmp/src
43
+ if [ "$VMA_REF" = WORKTREE ]; then
44
+ # Development build: HEAD plus uncommitted changes to tracked files and new
45
+ # source files (not the other untracked files lying around in the checkout)
46
+ (cd /src && { git ls-files -m; git ls-files -o --exclude-standard -- lib modules exe tests; } |
47
+ grep -v '_vma_autosave$' | sort -u | while read -r f; do [ -f "$f" ] && echo "$f"; done) |
48
+ while read -r f; do mkdir -p "$(dirname "$f")"; cp "/src/$f" "$f"; done
49
+ git -c user.name=build -c user.email=build@localhost add -A >/dev/null
50
+ else
51
+ git checkout -q "$VMA_REF"
52
+ fi
53
+ VERSION=$(ruby -Ilib -e 'require "vimamsa/version"; print Vimamsa::VERSION')
54
+ gem build -q vimamsa.gemspec
55
+ step "Installing gems (compiles the native extensions)"
56
+ gem install --no-document "vimamsa-$VERSION.gem"
57
+ GEMDIR=$(ruby -e 'print Gem.default_dir')
58
+
59
+ # ── 3. Typelibs (Ruby-GNOME loads most of the API through them) ──
60
+ step "Typelibs"
61
+ mkdir -p "$U/lib/girepository-1.0"
62
+ cp "$SYSLIB"/girepository-1.0/*.typelib "$U/lib/girepository-1.0/"
63
+
64
+ # ── 4. Runtime modules loaded with dlopen ──
65
+ step "GStreamer plugins, gdk-pixbuf loaders, GIO modules"
66
+ cp -r "$SYSLIB/gstreamer-1.0" "$U/lib/"
67
+ mkdir -p "$U/lib/gstreamer1.0/gstreamer-1.0"
68
+ cp "$SYSLIB/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner" "$U/lib/gstreamer1.0/gstreamer-1.0/"
69
+ pix=$U/lib/gdk-pixbuf-2.0/2.10.0
70
+ mkdir -p "$pix"
71
+ cp -r "$SYSLIB/gdk-pixbuf-2.0/2.10.0/loaders" "$pix/"
72
+ # AppRun fills in the mount point
73
+ sed "s|$SYSLIB/gdk-pixbuf-2.0/2.10.0/loaders|@PIXBUF_LOADERS@|g" \
74
+ "$SYSLIB/gdk-pixbuf-2.0/2.10.0/loaders.cache" > "$pix/loaders.cache.in"
75
+ mkdir -p "$U/lib/gio/modules"
76
+ # dconf: GSettings are saved like in other apps. No gvfs (trash, remote
77
+ # locations in the file chooser) or proxy modules.
78
+ cp "$SYSLIB/gio/modules/libdconfsettings.so" "$U/lib/gio/modules/"
79
+ gio-querymodules "$U/lib/gio/modules"
80
+
81
+ # ── 5. Shared libraries: everything the above needs, except the host's ──
82
+ # Left to the host (as in the AppImage project's excludelist): glibc, the C++
83
+ # runtime, GL/Vulkan/DRM drivers, X11/xcb/Wayland client libs, fontconfig/
84
+ # freetype/harfbuzz (tied to the host's font setup), and the sound servers.
85
+ EXCLUDE='^(ld-linux.*|libc|libm|libmvec|libdl|libpthread|librt|libresolv|libutil|libanl|libnss_.*|libthread_db|libBrokenLocale|libstdc\+\+|libgcc_s|libGL|libGLX|libGLdispatch|libOpenGL|libEGL|libGLESv2|libgbm|libdrm|libvulkan|libX11|libX11-xcb|libxcb|libxcb-dri2|libxcb-dri3|libxcb-glx|libxcb-present|libxcb-sync|libxcb-xfixes|libICE|libSM|libwayland-client|libwayland-cursor|libwayland-egl|libwayland-server|libfontconfig|libfreetype|libharfbuzz|libasound|libjack|libpipewire-0\.3|libpulse|libpulse-simple|libpulsecommon-.*|libz|libexpat|libuuid|libcom_err|libgpg-error|libusb-1\.0)\.so'
86
+ step "Collecting shared libraries"
87
+ declare -A seen
88
+ queue=()
89
+ add() { [ -n "${seen[$1]:-}" ] && return; seen[$1]=1; queue+=("$1"); }
90
+ for f in "$U/bin/ruby" "$U"/lib/libruby.so.*.*; do add "$f"; done
91
+ while IFS= read -r f; do add "$f"; done < <(find "$GEMDIR" "$U/lib/ruby" "$U/lib/gstreamer-1.0" \
92
+ "$U/lib/gstreamer1.0" "$pix" "$U/lib/gio" -type f \( -name '*.so' -o -name gst-plugin-scanner \))
93
+ # Libraries only reached through typelibs (dlopen by soname)
94
+ for t in "$U"/lib/girepository-1.0/*.typelib; do
95
+ for so in $(strings "$t" | grep -E '^lib.*\.so' | tr ',' ' '); do
96
+ if [ -e "$SYSLIB/$so" ]; then add "$SYSLIB/$so"; fi
97
+ done
98
+ done
99
+ i=0
100
+ while [ $i -lt ${#queue[@]} ]; do
101
+ f=${queue[$i]}; i=$((i + 1))
102
+ name=$(basename "$f")
103
+ # (ldd reports /lib/x86_64-linux-gnu/..., the same dir as $SYSLIB on 24.04)
104
+ if [[ "$f" != "$APPDIR"/* ]] && ! [[ "$name" =~ $EXCLUDE ]]; then
105
+ [ -e "$U/lib/$name" ] || cp -L "$f" "$U/lib/$name"
106
+ fi
107
+ while read -r dep; do
108
+ [[ "$(basename "$dep")" =~ $EXCLUDE ]] && continue
109
+ add "$dep"
110
+ done < <(ldd "$f" 2>/dev/null | awk '/=> \//{print $3}')
111
+ done
112
+
113
+ step "Setting RUNPATH so bundled libraries are found without LD_LIBRARY_PATH"
114
+ relpath() { realpath --relative-to="$1" "$U/lib"; }
115
+ while IFS= read -r f; do
116
+ file -b "$f" | grep -q '^ELF' || continue
117
+ d=$(dirname "$f")
118
+ patchelf --set-rpath "\$ORIGIN/$(relpath "$d")" "$f"
119
+ done < <(find "$U/lib" "$U/bin" -type f \( -name '*.so*' -o -name gst-plugin-scanner -o -name ruby \))
120
+
121
+ # Every bundled ELF file must now resolve all its libraries (bundled ones
122
+ # through RUNPATH, the excluded ones from this system)
123
+ missing=$(find "$U/lib" "$U/bin" -type f \( -name '*.so*' -o -name gst-plugin-scanner -o -name ruby \) \
124
+ -exec sh -c 'ldd "$1" 2>/dev/null | grep "not found" | sed "s|^|$1: |"' _ {} \; | sort -u)
125
+ if [ -n "$missing" ]; then echo "!! unresolved libraries:"; echo "$missing"; exit 1; fi
126
+
127
+ # ── 6. Data files ──
128
+ step "Data: GtkSourceView, schemas, icons, MIME database"
129
+ mkdir -p "$U/share/glib-2.0/schemas" "$U/share/icons"
130
+ cp -r /usr/share/gtksourceview-5 "$U/share/"
131
+ cp /usr/share/glib-2.0/schemas/*.xml "$U/share/glib-2.0/schemas/"
132
+ glib-compile-schemas "$U/share/glib-2.0/schemas"
133
+ cp -r /usr/share/icons/Adwaita /usr/share/icons/hicolor "$U/share/icons/"
134
+ # MIME database: GIO's content type guessing, which gdk-pixbuf (image format
135
+ # detection) and GtkSourceView (language detection) rely on
136
+ cp -r /usr/share/mime "$U/share/"
137
+
138
+ # ── 7. Launchers ──
139
+ step "AppRun, desktop entry, icon"
140
+ cp /src/scripts/appimage/AppRun "$APPDIR/AppRun" && chmod +x "$APPDIR/AppRun"
141
+ # ruby-lsp / rufo on PATH without the bundled ruby (see AppRun)
142
+ mkdir -p "$U/lib/vimamsa/bin"
143
+ for t in ruby-lsp rufo; do
144
+ # (the editor has put the user's GEM_HOME etc. back by the time these run)
145
+ printf '#!/bin/sh\nunset GEM_HOME GEM_PATH RUBYOPT RUBYLIB\nexec "$(dirname "$(readlink -f "$0")")/../../../bin/%s" "$@"\n' "$t" > "$U/lib/vimamsa/bin/$t"
146
+ chmod +x "$U/lib/vimamsa/bin/$t"
147
+ done
148
+ cat > "$APPDIR/vimamsa.desktop" <<EOF
149
+ [Desktop Entry]
150
+ Type=Application
151
+ Name=Vimamsa
152
+ Comment=Vi/Vim-inspired GUI text editor
153
+ Exec=vimamsa %F
154
+ Icon=vimamsa
155
+ Terminal=false
156
+ Categories=Utility;TextEditor;
157
+ StartupWMClass=net.samiddhi.vimamsa
158
+ EOF
159
+ cp /tmp/src/icon.png "$APPDIR/vimamsa.png"
160
+ ln -sf vimamsa.png "$APPDIR/.DirIcon"
161
+
162
+ # ── 8. Smoke test, then pack ──
163
+ step "Smoke test: load the editor's libraries from the AppDir"
164
+ # Clean environment (no host GI_TYPELIB_PATH etc.); the libraries must come
165
+ # from the AppDir through RUNPATH
166
+ xvfb-run -a sh -c 'exec env -i HOME=/tmp PATH=/usr/bin:/bin DISPLAY="$DISPLAY" XAUTHORITY="$XAUTHORITY" \
167
+ GI_TYPELIB_PATH="$0/usr/lib/girepository-1.0" "$0/usr/bin/ruby" \
168
+ -e "%w[gtk4 gtksourceview5 vte4 gstreamer].each { |g| require g }; Gst.init; puts %q(gems load OK)"' "$APPDIR"
169
+
170
+ step "Packing"
171
+ # Pinned versions, checked against their SHA-256 (not the moving "continuous"
172
+ # builds): appimagetool and the static type-2 runtime it puts in front of the
173
+ # image (no libfuse2 needed on the user's machine)
174
+ fetch() { # url sha256 dest
175
+ if ! echo "$2 $3" | sha256sum -c --status 2>/dev/null; then
176
+ wget -q -O "$3" "$1"
177
+ echo "$2 $3" | sha256sum -c --quiet || { echo "!! checksum mismatch: $1"; exit 1; }
178
+ fi
179
+ }
180
+ tool=$CACHE/appimagetool-1.9.1-x86_64.AppImage
181
+ runtime=$CACHE/type2-runtime-20251108-x86_64
182
+ fetch https://github.com/AppImage/appimagetool/releases/download/1.9.1/appimagetool-x86_64.AppImage \
183
+ ed4ce84f0d9caff66f50bcca6ff6f35aae54ce8135408b3fa33abfc3cb384eb0 "$tool"
184
+ fetch https://github.com/AppImage/type2-runtime/releases/download/20251108/runtime-x86_64 \
185
+ 2fca8b443c92510f1483a883f60061ad09b46b978b2631c807cd873a47ec260d "$runtime"
186
+ chmod +x "$tool"
187
+ out="$B/Vimamsa-$VERSION-x86_64.AppImage"
188
+ # Pack to a temporary name and rename: the previous AppImage may be running
189
+ ARCH=x86_64 APPIMAGE_EXTRACT_AND_RUN=1 "$tool" --no-appstream --runtime-file "$runtime" "$APPDIR" "$out.tmp"
190
+ mv -f "$out.tmp" "$out"
191
+ ls -lh "$out"
192
+ du -sh "$APPDIR"
@@ -0,0 +1,27 @@
1
+ #!/bin/bash
2
+ # Run an AppImage on a clean Ubuntu 24.04 (no GTK, no Ruby, no typelibs) in
3
+ # Docker, with only the libraries any desktop provides (the ones the bundle
4
+ # leaves to the host), and run a few test files with it.
5
+ # scripts/appimage/smoke_test.sh build/appimage/Vimamsa-0.1.27-x86_64.AppImage
6
+ set -euo pipefail
7
+ APPIMAGE="$(realpath "$1")"
8
+ REPO="$(git -C "$(dirname "$0")" rev-parse --show-toplevel)"
9
+ TESTS="${SMOKE_TESTS:-tests/test_basic_editing.rb tests/test_bundling.rb}"
10
+
11
+ docker run --rm -v "$APPIMAGE:/app/Vimamsa.AppImage:ro" -v "$REPO/tests:/src/tests:ro" \
12
+ -v "$REPO/exe:/src/exe:ro" -e TESTS="$TESTS" ubuntu:24.04 bash -c '
13
+ set -e
14
+ apt-get update -qq >/dev/null
15
+ DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends \
16
+ xvfb xauth fonts-dejavu-core libfontconfig1 libfreetype6 libharfbuzz0b libgl1 libegl1 \
17
+ libgles2 libx11-6 libx11-xcb1 libxcb1 libwayland-client0 libwayland-cursor0 \
18
+ libwayland-egl1 libasound2t64 libpulse0 >/dev/null
19
+ if ls /usr/lib/x86_64-linux-gnu/libgtk-4* >/dev/null 2>&1 || command -v ruby >/dev/null; then
20
+ echo "!! test box is not clean (GTK or Ruby installed)"; exit 1
21
+ fi
22
+ cd /tmp && cp /app/Vimamsa.AppImage . && ./Vimamsa.AppImage --appimage-extract >/dev/null
23
+ files=$(for t in $TESTS; do echo /src/$t; done)
24
+ timeout 600 xvfb-run -a ./squashfs-root/AppRun --user-dir /tmp/ud --test $files > run.log 2>&1 || true
25
+ grep -E "^ (FAIL|ERROR|SKIP)|Results" run.log || { tail -30 run.log; exit 1; }
26
+ grep -qE "Results: [0-9]+ passed, 0 failed" run.log
27
+ '
@@ -0,0 +1,60 @@
1
+ # Easy jump demo, played inside the editor by Help ▸ Demos ▸ Easy jump
2
+ # (lib/vimamsa/demo_player.rb), on scripts/demo/shapes.rb. The commands are
3
+ # those of demo_steps.txt; "target line N" names line N (1-based).
4
+ # The key log panel on the right shows each key and the action it ran.
5
+ #
6
+ # It moves the to_s method of Shape above area: the range is selected with
7
+ # v and easy jump, cut, and pasted where easy jump goes.
8
+
9
+ delay 0.45
10
+ wait 1.5
11
+
12
+ # Easy jump (s): every line start and many word starts get a label; type
13
+ # one to jump there
14
+ target def to_s
15
+ keys s
16
+ wait 1.6
17
+ keys @JUMP_LABEL@
18
+ wait 0.8
19
+ target shapes.each
20
+ keys s
21
+ wait 1.2
22
+ keys @JUMP_LABEL@
23
+ wait 0.8
24
+ target class Shape
25
+ keys s
26
+ wait 1.2
27
+ keys @JUMP_LABEL@
28
+ wait 1.0
29
+
30
+ # Select a range: go to the empty line above to_s, start the selection with
31
+ # v, and let easy jump extend it to the line where to_s ends
32
+ target line 10
33
+ keys s
34
+ wait 1.2
35
+ keys @JUMP_LABEL@
36
+ wait 0.6
37
+ keys v
38
+ wait 0.6
39
+ target line 13
40
+ keys s
41
+ wait 1.4
42
+ keys @JUMP_LABEL@
43
+ wait 0.6
44
+ keys $
45
+ wait 1.0
46
+
47
+ # Cut it, jump to the empty line below initialize and paste it there
48
+ keys x
49
+ wait 1.0
50
+ target line 6
51
+ keys s
52
+ wait 1.2
53
+ keys @JUMP_LABEL@
54
+ wait 0.6
55
+ keys P
56
+ wait 1.5
57
+
58
+ # Back to the top
59
+ keys g g
60
+ wait 2.0
@@ -0,0 +1,52 @@
1
+ # File switching demo, played inside the editor by Help ▸ Demos ▸ Switching
2
+ # files (lib/vimamsa/demo_player.rb), on scripts/demo/shapes.rb, report.rb
3
+ # and notes.txt (opened in that order of age: shapes.rb is current and the
4
+ # newest in the buffer history). The commands are those of demo_steps.txt.
5
+ # The key log panel on the right shows each key and the action it ran.
6
+
7
+ delay 0.45
8
+ wait 1.5
9
+
10
+ # tab: back to the file used before; tab again: back here
11
+ keys tab
12
+ wait 1.5
13
+ keys tab
14
+ wait 1.5
15
+
16
+ # Browse mode (z): h goes back in the buffer history, l forward; j leaves
17
+ # browse mode in the file shown
18
+ keys z
19
+ wait 1.0
20
+ keys h
21
+ wait 1.2
22
+ keys h
23
+ wait 1.2
24
+ keys l
25
+ wait 1.2
26
+ keys j
27
+ wait 1.2
28
+
29
+ # , f: the file explorer, on the current file's folder with the cursor on
30
+ # its line. k / j move to another file; l (or enter) opens it
31
+ keys , f
32
+ wait 1.4
33
+ keys k
34
+ wait 1.0
35
+ keys l
36
+ wait 1.5
37
+
38
+ # tab: back to the file before
39
+ keys tab
40
+ wait 1.5
41
+
42
+ # The explorer again, to shapes.rb (below report.rb)
43
+ keys , f
44
+ wait 1.2
45
+ keys j
46
+ wait 1.0
47
+ keys l
48
+ wait 1.0
49
+
50
+ # Back to the top
51
+ keys g g
52
+ wait 2.0
@@ -0,0 +1,67 @@
1
+ # Key presses for the README demo, run by scripts/demo/record_demo.rb, and
2
+ # played inside the editor by Help ▸ Play demo (lib/vimamsa/demo_player.rb).
3
+ # Times are at --speed 1; the script divides them by its --speed.
4
+ # keys K K ... press keys one at a time (editor key names: esc, enter,
5
+ # space, ctrl (alone), ctrl-r, or xdotool keysyms), with the
6
+ # current delay
7
+ # type TEXT type TEXT character by character (Insert mode)
8
+ # wait SECONDS pause
9
+ # delay SECONDS time between keys from now on
10
+ # target TEXT where easy jump goes: the start of the first line holding
11
+ # TEXT; or "line N" (its start), or "line N col C" (1-based,
12
+ # the exact character; written by the demo recorder).
13
+ # The player in the editor types that line's label (labels
14
+ # depend on the window size); the recording types
15
+ # JUMP_LABEL from record_demo.rb.
16
+ # The key log panel on the right shows each key and the action it ran.
17
+
18
+ delay 0.45
19
+ wait 1.5
20
+
21
+ # hjkl: move down, right, up, left
22
+ keys j j j l l l l
23
+ keys k h
24
+ wait 0.6
25
+
26
+ # Words: forward, end, back
27
+ keys w w e b
28
+ wait 0.6
29
+
30
+ # Jump to the end, yank a line and paste it, delete it, undo, redo
31
+ keys G k
32
+ wait 0.4
33
+ keys y y p
34
+ wait 0.8
35
+ keys d d
36
+ wait 0.6
37
+ keys u
38
+ wait 0.6
39
+ keys ctrl-r
40
+ wait 0.8
41
+
42
+ # Insert mode: open a new line and type (the mode badge is top right), then
43
+ # back to Command mode by pressing and releasing ctrl alone
44
+ keys o
45
+ delay 0.07
46
+ type puts "Total: #{shapes.sum(&:area).round(1)}"
47
+ delay 0.45
48
+ wait 0.5
49
+ keys ctrl
50
+ wait 1.0
51
+
52
+ # Visual mode: select two words and yank them
53
+ keys 0 v e e
54
+ wait 0.6
55
+ keys y
56
+ wait 0.8
57
+
58
+ # Easy jump (s): every word start gets a label; type one to jump there
59
+ target class Circle
60
+ keys s
61
+ wait 1.6
62
+ keys @JUMP_LABEL@
63
+ wait 1.0
64
+
65
+ # Back to the top
66
+ keys g g
67
+ wait 2.0
@@ -0,0 +1,6 @@
1
+ Example file for the file switching demo.
2
+
3
+ Notes
4
+ - shapes.rb: the Shape classes
5
+ - report.rb: prints a table of shapes
6
+ - add a Square shape