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.
- checksums.yaml +4 -4
- data/.github/workflows/appimage.yml +93 -0
- data/.gitignore +4 -1
- data/Dockerfile +7 -4
- data/README.md +195 -99
- data/custom_example.rb +59 -17
- data/doc/TODO.md +678 -0
- data/doc/action_names_plan.md +442 -0
- data/doc/bundling_plan.md +570 -0
- data/doc/delta_syntax_plan.md +293 -0
- data/doc/demo_recording_plan.md +288 -0
- data/doc/design_goals.md +27 -0
- data/doc/intro_page_plan.md +266 -0
- data/doc/key_bindings_report_plan.md +213 -0
- data/doc/line_tree_plan.md +89 -0
- data/doc/missing_vim_bindings.md +61 -0
- data/doc/modules_settings_plan.md +433 -0
- data/doc/refactor_dedup_plan.md +117 -0
- data/doc/registries_plan.md +202 -0
- data/doc/startup_speed_plan.md +97 -0
- data/doc/treap_visualizer.html +585 -0
- data/doc/unused_code_plan.md +120 -0
- data/doc/vim_compatibility_plan.md +451 -0
- data/doc/vimlike_vim_conflicts.md +262 -0
- data/doc/vm_snapshots_plan.md +146 -0
- data/doc/wysiwyg_plan.md +231 -0
- data/exe/run_tests.rb +124 -3
- data/exe/vimamsa +68 -5
- data/fonts/OFL-Oxanium.txt +93 -0
- data/fonts/Oxanium[wght].ttf +0 -0
- data/help/intro.txt +30 -0
- data/help/vim_intro.txt +31 -0
- data/icon.png +0 -0
- data/img/demo.gif +0 -0
- data/img/demo.mp4 +0 -0
- data/lang/hyperplaintext.lang +7 -1
- data/lib/vimamsa/ack.rb +13 -1
- data/lib/vimamsa/actions.rb +385 -37
- data/lib/vimamsa/appimage_env.rb +35 -0
- data/lib/vimamsa/audio.rb +2 -5
- data/lib/vimamsa/bookmarks.rb +302 -0
- data/lib/vimamsa/buffer.rb +675 -118
- data/lib/vimamsa/buffer_changetext.rb +150 -68
- data/lib/vimamsa/buffer_cursor.rb +7 -0
- data/lib/vimamsa/buffer_list.rb +6 -2
- data/lib/vimamsa/buffer_manager.rb +10 -7
- data/lib/vimamsa/bundled_fonts.rb +32 -0
- data/lib/vimamsa/cli_help.rb +75 -0
- data/lib/vimamsa/clipboard.rb +9 -3
- data/lib/vimamsa/conf.rb +68 -3
- data/lib/vimamsa/constants.rb +3 -0
- data/lib/vimamsa/crash_handler.rb +149 -0
- data/lib/vimamsa/debug.rb +6 -3
- data/lib/vimamsa/demo_player.rb +458 -0
- data/lib/vimamsa/demo_recorder.rb +277 -0
- data/lib/vimamsa/desktop_install.rb +96 -0
- data/lib/vimamsa/diff_buffer.rb +40 -11
- data/lib/vimamsa/dot_repeat.rb +104 -0
- data/lib/vimamsa/easy_jump.rb +57 -3
- data/lib/vimamsa/editor.rb +327 -78
- data/lib/vimamsa/encrypt.rb +78 -29
- data/lib/vimamsa/file_finder.rb +4 -19
- data/lib/vimamsa/file_history.rb +4 -1
- data/lib/vimamsa/file_manager.rb +46 -31
- data/lib/vimamsa/fold.rb +226 -0
- data/lib/vimamsa/form_input.rb +388 -0
- data/lib/vimamsa/gui.rb +603 -119
- data/lib/vimamsa/gui_command_line.rb +247 -0
- data/lib/vimamsa/gui_dialog.rb +94 -42
- data/lib/vimamsa/gui_file_panel.rb +356 -25
- data/lib/vimamsa/gui_form_generator.rb +75 -40
- data/lib/vimamsa/gui_func_panel.rb +67 -22
- data/lib/vimamsa/gui_image.rb +3 -0
- data/lib/vimamsa/gui_key_hint.rb +165 -0
- data/lib/vimamsa/gui_keylog_panel.rb +408 -0
- data/lib/vimamsa/gui_menu.rb +84 -53
- data/lib/vimamsa/gui_select_window.rb +80 -75
- data/lib/vimamsa/gui_settings.rb +86 -41
- data/lib/vimamsa/gui_sourceview.rb +280 -92
- data/lib/vimamsa/gui_sourceview_autocomplete.rb +319 -90
- data/lib/vimamsa/gui_text.rb +63 -2
- data/lib/vimamsa/gui_theme.rb +615 -0
- data/lib/vimamsa/hook.rb +5 -0
- data/lib/vimamsa/hyper_plain_text.rb +3 -0
- data/lib/vimamsa/intro_page.rb +368 -0
- data/lib/vimamsa/key_actions.rb +382 -193
- data/lib/vimamsa/key_binding_tree.rb +467 -273
- data/lib/vimamsa/key_bindings_notepad.rb +45 -0
- data/lib/vimamsa/key_bindings_report.rb +484 -0
- data/lib/vimamsa/key_bindings_vim.rb +104 -0
- data/lib/vimamsa/key_bindings_vimlike.rb +353 -289
- data/lib/vimamsa/key_names.rb +80 -0
- data/lib/vimamsa/langservp.rb +271 -54
- data/lib/vimamsa/line_tree.rb +367 -0
- data/lib/vimamsa/macro.rb +23 -3
- data/lib/vimamsa/main.rb +14 -8
- data/lib/vimamsa/rbvma.rb +41 -1
- data/lib/vimamsa/registers.rb +125 -0
- data/lib/vimamsa/run_ruby.rb +64 -0
- data/lib/vimamsa/search.rb +3 -0
- data/lib/vimamsa/search_replace.rb +15 -14
- data/lib/vimamsa/string_util.rb +134 -40
- data/lib/vimamsa/terminal.rb +3 -0
- data/lib/vimamsa/test_framework.rb +28 -2
- data/lib/vimamsa/tests.rb +11 -8
- data/lib/vimamsa/text_objects.rb +310 -0
- data/lib/vimamsa/text_transforms.rb +18 -0
- data/lib/vimamsa/tmp_user_dir.rb +39 -0
- data/lib/vimamsa/user_dirs.rb +83 -0
- data/lib/vimamsa/util.rb +46 -7
- data/lib/vimamsa/version.rb +1 -1
- data/lib/vimamsa/vim_core.rb +355 -0
- data/lib/vimamsa/vim_operators.rb +365 -0
- data/lib/vimamsa.rb +0 -1
- data/modules/calculator/calculator.rb +5 -5
- data/modules/color_highlight/color_highlight.rb +118 -0
- data/modules/color_highlight/color_highlight_info.rb +3 -0
- data/modules/dictation/dictation.rb +1054 -0
- data/modules/dictation/dictation_info.rb +3 -0
- data/modules/dictation/whisper_worker.py +273 -0
- data/modules/ollama/ollama.rb +107 -0
- data/modules/ollama/ollama_info.rb +3 -0
- data/modules/terminal/terminal.rb +5 -5
- data/modules/tts/tts.rb +119 -0
- data/modules/tts/tts_info.rb +3 -0
- data/run_e2e_vm.sh +28 -0
- data/run_tests_vm.rb +138 -0
- data/scripts/appimage/AppRun +54 -0
- data/scripts/appimage/Dockerfile +18 -0
- data/scripts/appimage/build.sh +19 -0
- data/scripts/appimage/build_in_container.sh +192 -0
- data/scripts/appimage/smoke_test.sh +27 -0
- data/scripts/demo/demo_easyjump_steps.txt +60 -0
- data/scripts/demo/demo_files_steps.txt +52 -0
- data/scripts/demo/demo_steps.txt +67 -0
- data/scripts/demo/notes.txt +6 -0
- data/scripts/demo/record_demo.rb +156 -0
- data/scripts/demo/report.rb +7 -0
- data/scripts/demo/shapes.rb +29 -0
- data/scripts/demo/square/shapes.rb +29 -0
- data/scripts/demo/square/steps.txt +185 -0
- data/scripts/lib/perf_startup.rb +138 -0
- data/scripts/lib/script_helpers.rb +53 -0
- data/scripts/perf_compare.rb +34 -0
- data/scripts/profile_startup.rb +72 -0
- data/styles/134272-molokai.xml +3 -0
- data/styles/molokai_cyber.xml +48 -0
- data/styles/molokai_edit.xml +1 -0
- data/tests/support/virtual_keyboard.rb +254 -0
- data/tests/support/virtual_mic.rb +67 -0
- data/tests/test_ack.rb +22 -0
- data/tests/test_action_ids.rb +232 -0
- data/tests/test_auto_format.rb +122 -0
- data/tests/test_autocomplete.rb +211 -0
- data/tests/test_autosave.rb +145 -0
- data/tests/test_basic_editing.rb +46 -16
- data/tests/test_bookmarks.rb +206 -0
- data/tests/test_bracket_match.rb +88 -0
- data/tests/test_bundling.rb +92 -0
- data/tests/test_cli_help.rb +64 -0
- data/tests/test_color_highlight.rb +92 -0
- data/tests/test_command_line.rb +79 -0
- data/tests/test_command_line_file.rb +27 -0
- data/tests/test_context_menu_file.rb +147 -0
- data/tests/test_copy_paste.rb +106 -26
- data/tests/test_crash_handler.rb +39 -0
- data/tests/test_custom_two_phase.rb +92 -0
- data/tests/test_demo_player.rb +301 -0
- data/tests/test_demo_recorder.rb +202 -0
- data/tests/test_dialog_callback_errors.rb +44 -0
- data/tests/test_dictation.rb +294 -0
- data/tests/test_diff_buffer_name.rb +51 -0
- data/tests/test_dot_repeat.rb +88 -0
- data/tests/test_double_click.rb +41 -0
- data/tests/test_drag_selection.rb +125 -0
- data/tests/test_e2e_cmdline.rb +116 -0
- data/tests/test_e2e_dictation.rb +98 -0
- data/tests/test_e2e_replace_char.rb +58 -0
- data/tests/test_easy_jump.rb +93 -0
- data/tests/test_extract_file_links.rb +55 -0
- data/tests/test_file_format.rb +217 -0
- data/tests/test_file_manager.rb +72 -0
- data/tests/test_file_panel.rb +269 -0
- data/tests/test_flash.rb +78 -0
- data/tests/test_fold.rb +111 -0
- data/tests/test_font_refresh.rb +56 -0
- data/tests/test_form_input.rb +203 -0
- data/tests/test_func_panel.rb +68 -0
- data/tests/test_grep_apply.rb +46 -0
- data/tests/test_gtk_sync.rb +126 -0
- data/tests/test_hpt_highlight_visible.rb +75 -0
- data/tests/test_hpt_link_highlight.rb +82 -0
- data/tests/test_intro_page.rb +437 -0
- data/tests/test_jump_to_file.rb +41 -0
- data/tests/test_key_bindings.rb +208 -0
- data/tests/test_key_categories.rb +163 -0
- data/tests/test_keylog_panel.rb +261 -0
- data/tests/test_line_ends.rb +51 -0
- data/tests/test_line_tree.rb +86 -0
- data/tests/test_lsp_clangd.rb +281 -0
- data/tests/test_lsp_jump.rb +87 -0
- data/tests/test_lsp_position_encoding.rb +49 -0
- data/tests/test_lsp_symbols.rb +68 -0
- data/tests/test_macro.rb +137 -0
- data/tests/test_markdown_highlight.rb +57 -0
- data/tests/test_mode_badge.rb +41 -0
- data/tests/test_module_interface.rb +9 -9
- data/tests/test_notepad_bindings.rb +67 -0
- data/tests/test_perf_startup.rb +28 -0
- data/tests/test_popup_queue.rb +51 -0
- data/tests/test_random_edit.rb +109 -0
- data/tests/test_registers.rb +122 -0
- data/tests/test_revert.rb +127 -0
- data/tests/test_run_ruby.rb +77 -0
- data/tests/test_startup_file.rb +58 -0
- data/tests/test_status_area.rb +50 -0
- data/tests/test_text_objects.rb +163 -0
- data/tests/test_text_transforms.rb +341 -0
- data/tests/test_tmp_user_dir.rb +79 -0
- data/tests/test_tts.rb +68 -0
- data/tests/test_undo.rb +34 -34
- data/tests/test_user_dirs.rb +122 -0
- data/tests/test_vim_bindings.rb +353 -0
- data/tests/test_vim_conflicts.rb +100 -0
- data/tests/test_vim_operators.rb +116 -0
- data/tests/test_window_layout.rb +302 -0
- data/vimamsa.gemspec +3 -1
- data/vm_guest_run.sh +129 -0
- metadata +167 -10
data/lib/vimamsa/actions.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
|
|
2
|
+
module Vimamsa
|
|
1
3
|
class Action
|
|
2
4
|
attr_accessor :id, :method_name, :method, :opt
|
|
3
5
|
|
|
@@ -6,15 +8,309 @@ class Action
|
|
|
6
8
|
@id = id
|
|
7
9
|
@method = method
|
|
8
10
|
@opt = opt
|
|
9
|
-
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Segments of the id, general to specific: "move.word.next" =>
|
|
14
|
+
# ["move", "word", "next"]. An old symbol id is one segment.
|
|
15
|
+
def path
|
|
16
|
+
@id.to_s.split(".")
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Action ids are dotted paths, "move.word.next", from general to specific
|
|
21
|
+
# (doc/action_names_plan.md). Older ids are symbols (:close_current_buffer).
|
|
22
|
+
ACTION_ID_RE = /\A[a-z][a-z0-9_]*(\.[a-z0-9_]+)+\z/
|
|
23
|
+
|
|
24
|
+
# Old id => new dotted id. ActionList, bindkey, unbindkey and macros resolve
|
|
25
|
+
# these, so users' custom.rb and saved macros keep working. Keep each alias
|
|
26
|
+
# for at least two releases.
|
|
27
|
+
ACTION_ALIASES = {
|
|
28
|
+
# Duplicates merged (2026-11-20)
|
|
29
|
+
undo: "undo.last", edit_undo: "undo.last",
|
|
30
|
+
redo: "undo.redo", edit_redo: "undo.redo",
|
|
31
|
+
jump_last_edit: "jump.edit.prev", jump_to_last_edit: "jump.edit.prev",
|
|
32
|
+
move_backward_char: "move.char.prev", e_move_backward_char: "move.char.prev",
|
|
33
|
+
e_move_forward_char: "move.char.next",
|
|
34
|
+
move_next_line: "move.line.next", forward_line: "move.line.next",
|
|
35
|
+
move_prev_line: "move.line.prev", backward_line: "move.line.prev",
|
|
36
|
+
grep_buffer: "grep.buf", invoke_grep_search: "grep.buf",
|
|
37
|
+
# app namespace (2026-11-20)
|
|
38
|
+
quit: "app.quit",
|
|
39
|
+
restart_editor: "app.restart",
|
|
40
|
+
show_settings: "app.settings",
|
|
41
|
+
reload_customrb: "app.customrb.reload",
|
|
42
|
+
edit_customrb: "app.customrb.edit",
|
|
43
|
+
install_demo_files: "app.demo",
|
|
44
|
+
# mode namespace (2026-11-20)
|
|
45
|
+
insert_mode: "mode.insert",
|
|
46
|
+
start_visual_mode: "mode.visual",
|
|
47
|
+
prev_mode: "mode.prev",
|
|
48
|
+
start_cmd_line: "mode.cmdline",
|
|
49
|
+
notepad_escape: "mode.notepad.escape",
|
|
50
|
+
start_browse_mode: "mode.browse",
|
|
51
|
+
exit_browse_mode: "mode.browse.exit",
|
|
52
|
+
toggle_kbd_passthrough: "mode.passthrough.toggle",
|
|
53
|
+
minibuffer_end: "mode.minibuffer.end",
|
|
54
|
+
# help namespace (2026-11-20)
|
|
55
|
+
show_key_bindings: "help.keys",
|
|
56
|
+
show_free_key_bindings: "help.keys.free",
|
|
57
|
+
show_vim_binding_conflicts: "help.vim_conflicts",
|
|
58
|
+
show_message_history: "help.messages",
|
|
59
|
+
# debug namespace (2026-11-20)
|
|
60
|
+
enable_debug: "debug.on",
|
|
61
|
+
disable_debug: "debug.off",
|
|
62
|
+
savedebug: "debug.save",
|
|
63
|
+
eval_buf: "debug.eval.buf",
|
|
64
|
+
experimental_eval: "debug.eval.sel",
|
|
65
|
+
command_to_buf: "debug.command",
|
|
66
|
+
debug_buf_hex: "debug.buf.sha256",
|
|
67
|
+
print_buffer_access_list: "debug.buf.access",
|
|
68
|
+
run_tests: "debug.tests",
|
|
69
|
+
kbd_dump_state: "debug.kbd",
|
|
70
|
+
# move namespace (2026-11-20)
|
|
71
|
+
jump_beginning_of_line: "move.line.start",
|
|
72
|
+
jump_end_of_line: "move.line.end",
|
|
73
|
+
jump_next_word_start: "move.word.next",
|
|
74
|
+
jump_prev_word_start: "move.word.prev",
|
|
75
|
+
jump_next_word_end: "move.word.end",
|
|
76
|
+
jump_start_of_buffer: "move.buf.start",
|
|
77
|
+
jump_to_start_of_buffer: "move.buf.start",
|
|
78
|
+
jump_end_of_buffer: "move.buf.end",
|
|
79
|
+
jump_to_end_of_buffer: "move.buf.end",
|
|
80
|
+
jump_to_random: "move.random",
|
|
81
|
+
page_down: "move.page.next",
|
|
82
|
+
page_up: "move.page.prev",
|
|
83
|
+
# jump namespace (2026-11-20)
|
|
84
|
+
jump_to_next_edit: "jump.edit.next",
|
|
85
|
+
easy_jump: "jump.easy",
|
|
86
|
+
open_file_under_cursor: "jump.file",
|
|
87
|
+
line_action: "jump.line",
|
|
88
|
+
# search namespace (2026-11-20)
|
|
89
|
+
find_in_buffer: "search.buf",
|
|
90
|
+
find_next: "search.next",
|
|
91
|
+
gui_search_replace: "search.replace",
|
|
92
|
+
invoke_replace: "search.replace.cmd",
|
|
93
|
+
search_actions: "search.actions",
|
|
94
|
+
# grep namespace (2026-11-20)
|
|
95
|
+
grep_refresh: "grep.refresh",
|
|
96
|
+
ack_search: "ack.search",
|
|
97
|
+
content_search: "grep.files",
|
|
98
|
+
# edit namespace (2026-11-20)
|
|
99
|
+
delete_char_forward: "edit.delete.char",
|
|
100
|
+
vim_delete_char: "edit.delete.char.inline",
|
|
101
|
+
vim_delete_char_backward: "edit.delete.char.prev",
|
|
102
|
+
vim_delete_to_eol: "edit.delete.eol",
|
|
103
|
+
delete_to_word_end: "edit.delete.word.end",
|
|
104
|
+
delete_to_next_word_start: "edit.delete.word.next",
|
|
105
|
+
delete_to_line_start: "edit.delete.line.start",
|
|
106
|
+
delete_line: "edit.delete.line",
|
|
107
|
+
insert_backspace: "edit.backspace",
|
|
108
|
+
insert_delete: "edit.delete.char_or_sel",
|
|
109
|
+
vim_change_line: "edit.change.line",
|
|
110
|
+
vim_change_word: "edit.change.word",
|
|
111
|
+
vim_change_to_eol: "edit.change.eol",
|
|
112
|
+
vim_substitute_char: "edit.change.char",
|
|
113
|
+
vim_open_line_above: "edit.line.above",
|
|
114
|
+
insert_new_line: "edit.newline",
|
|
115
|
+
copy_cur_line: "edit.line.copy",
|
|
116
|
+
paste_after_cursor: "edit.paste.after",
|
|
117
|
+
paste_before_cursor: "edit.paste.before",
|
|
118
|
+
paste_over_after: "edit.paste.over.after",
|
|
119
|
+
paste_over_before: "edit.paste.over.before",
|
|
120
|
+
increment_word: "edit.word.increment",
|
|
121
|
+
auto_indent_buffer: "edit.indent.buf",
|
|
122
|
+
comment_selection: "edit.comment",
|
|
123
|
+
autocp_manual_trigger: "edit.complete",
|
|
124
|
+
toggle_autocomplete: "edit.complete.toggle",
|
|
125
|
+
# undo namespace (2026-11-20)
|
|
126
|
+
vim_repeat_last_action: "undo.repeat",
|
|
127
|
+
# case namespace (2026-11-20)
|
|
128
|
+
word_upcase: "case.word.upper",
|
|
129
|
+
word_downcase: "case.word.lower",
|
|
130
|
+
word_swapcase: "case.word.swap",
|
|
131
|
+
line_upcase: "case.line.upper",
|
|
132
|
+
line_downcase: "case.line.lower",
|
|
133
|
+
line_swapcase: "case.line.swap",
|
|
134
|
+
selection_upcase: "case.sel.upper",
|
|
135
|
+
selection_downcase: "case.sel.lower",
|
|
136
|
+
selection_swapcase: "case.sel.swap",
|
|
137
|
+
selection_capitalize: "case.sel.capitalize",
|
|
138
|
+
vim_toggle_case: "case.char.toggle",
|
|
139
|
+
# sel namespace (2026-11-20)
|
|
140
|
+
select_all: "sel.all",
|
|
141
|
+
insert_select_up: "sel.line.prev",
|
|
142
|
+
insert_select_down: "sel.line.next",
|
|
143
|
+
copy_selection: "sel.copy",
|
|
144
|
+
cut_selection: "sel.cut",
|
|
145
|
+
vim_change_selection: "sel.change",
|
|
146
|
+
selection_reverse: "sel.reverse",
|
|
147
|
+
selection_remove_indent: "sel.unindent",
|
|
148
|
+
selection_remove_common_indent: "sel.unindent.common",
|
|
149
|
+
V_join_lines: "sel.join",
|
|
150
|
+
V_to_latex_itemize: "sel.latex_itemize",
|
|
151
|
+
delete_selection: "sel.delete",
|
|
152
|
+
delete_append_selection: "sel.delete.append",
|
|
153
|
+
# buf namespace (2026-11-20)
|
|
154
|
+
buf_save: "buf.save",
|
|
155
|
+
buf_save_as: "buf.save.as",
|
|
156
|
+
buf_revert: "buf.revert",
|
|
157
|
+
buf_backup: "buf.backup",
|
|
158
|
+
backup_all_buffers: "buf.backup.all",
|
|
159
|
+
buf_new: "buf.new",
|
|
160
|
+
create_new_file: "buf.new",
|
|
161
|
+
close_current_buffer: "buf.close",
|
|
162
|
+
gui_select_buffer: "buf.switcher",
|
|
163
|
+
start_buf_manager: "buf.manager",
|
|
164
|
+
history_switch_backwards: "buf.history.prev",
|
|
165
|
+
history_switch_forwards: "buf.history.next",
|
|
166
|
+
select_buffer_language: "buf.language",
|
|
167
|
+
encrypt_file: "buf.encrypt",
|
|
168
|
+
set_unencrypted: "buf.encrypt.off",
|
|
169
|
+
git_diff_buffer: "buf.diff.git",
|
|
170
|
+
diff_buffer: "buf.diff",
|
|
171
|
+
diff_buffer_jump_to_source: "diffview.source",
|
|
172
|
+
# file namespace (2026-11-20)
|
|
173
|
+
git_diff_w: "file.diff.repo",
|
|
174
|
+
open_file_dialog: "file.open",
|
|
175
|
+
gui_file_finder: "file.finder",
|
|
176
|
+
start_file_selector: "file.explorer",
|
|
177
|
+
update_file_index: "file.finder.reindex",
|
|
178
|
+
gui_file_history_finder: "file.history",
|
|
179
|
+
fhist_remove_nonexisting: "file.history.prune",
|
|
180
|
+
delete_current_file: "file.delete",
|
|
181
|
+
set_executable: "file.executable",
|
|
182
|
+
put_file_path_to_clipboard: "file.path.copy",
|
|
183
|
+
put_file_ref_to_clipboard: "file.ref.copy",
|
|
184
|
+
extract_file_links: "file.links",
|
|
185
|
+
# panel namespace (2026-11-20)
|
|
186
|
+
toggle_file_panel: "panel.files.toggle",
|
|
187
|
+
toggle_func_panel: "panel.funcs.toggle",
|
|
188
|
+
toggle_keylog_panel: "panel.keylog.toggle",
|
|
189
|
+
refresh_func_panel: "panel.funcs.refresh",
|
|
190
|
+
file_panel_next_file: "panel.files.next",
|
|
191
|
+
file_panel_prev_file: "panel.files.prev",
|
|
192
|
+
file_panel_easy_jump: "panel.files.jump",
|
|
193
|
+
# view namespace (2026-11-20)
|
|
194
|
+
toggle_two_column: "view.columns.toggle",
|
|
195
|
+
toggle_active_window: "view.columns.switch",
|
|
196
|
+
center_on_current_line: "view.center",
|
|
197
|
+
gui_ensure_cursor_visible: "view.cursor.show",
|
|
198
|
+
gui_refresh_cursor: "view.cursor.refresh",
|
|
199
|
+
refresh_colors: "view.colors.reload",
|
|
200
|
+
# style namespace (2026-11-20)
|
|
201
|
+
set_line_style_h1: "style.line.h1",
|
|
202
|
+
set_line_style_h2: "style.line.h2",
|
|
203
|
+
set_line_style_h3: "style.line.h3",
|
|
204
|
+
set_line_style_h4: "style.line.h4",
|
|
205
|
+
set_line_style_heading: "style.line.heading",
|
|
206
|
+
set_line_style_title: "style.line.title",
|
|
207
|
+
set_line_style_bold: "style.line.bold",
|
|
208
|
+
set_line_style_italic: "style.line.italic",
|
|
209
|
+
clear_line_styles: "style.line.clear",
|
|
210
|
+
set_style_bold: "style.bold",
|
|
211
|
+
set_style_italic: "style.italic",
|
|
212
|
+
set_style_link: "style.link",
|
|
213
|
+
clear_formats: "style.clear",
|
|
214
|
+
show_images: "style.images",
|
|
215
|
+
# mark namespace (2026-11-20)
|
|
216
|
+
bookmark_add: "mark.add",
|
|
217
|
+
bookmark_list: "mark.list",
|
|
218
|
+
# term_lsp_macro namespace (2026-11-20)
|
|
219
|
+
execute_current_line_in_terminal: "term.line",
|
|
220
|
+
execute_current_line_in_terminal_autoclose: "term.line.autoclose",
|
|
221
|
+
lsp_jump_to_definition: "lsp.definition",
|
|
222
|
+
lsp_print_functions: "lsp.functions",
|
|
223
|
+
lsp_restart: "lsp.restart",
|
|
224
|
+
lsp_debug: "lsp.debug",
|
|
225
|
+
run_last_macro: "macro.run.last",
|
|
226
|
+
find_macro_gui: "macro.find",
|
|
227
|
+
gui_name_macro: "macro.name",
|
|
228
|
+
# modules namespace (2026-11-20)
|
|
229
|
+
insert_terminal: "terminal.insert",
|
|
230
|
+
insert_calculator: "calculator.insert",
|
|
231
|
+
toggle_highlight_colors: "color_highlight.toggle",
|
|
232
|
+
audio_stop: "audio.stop",
|
|
233
|
+
audio_forward: "audio.forward",
|
|
234
|
+
audio_backward: "audio.backward",
|
|
235
|
+
dictation_toggle: "dictation.toggle",
|
|
236
|
+
dictation_toggle_dialog: "dictation.toggle_dialog",
|
|
237
|
+
dictation_release_vram: "dictation.release_vram",
|
|
238
|
+
dictation_enter_mode: "dictation.enter_mode",
|
|
239
|
+
dictation_toggle_stay: "dictation.toggle_stay",
|
|
240
|
+
dictation_newline: "dictation.newline",
|
|
241
|
+
dictation_exit_mode: "dictation.exit_mode",
|
|
242
|
+
dictation_select_model: "dictation.select_model",
|
|
243
|
+
tts_speak_selection: "tts.speak_selection",
|
|
244
|
+
tts_stop: "tts.stop",
|
|
245
|
+
ollama_improve_selection: "ollama.improve_selection",
|
|
246
|
+
ollama_improve_selection_multi: "ollama.improve_selection_multi",
|
|
247
|
+
fexp_chdir_parent: "fexp.chdir_parent",
|
|
248
|
+
fexp_select: "fexp.select",
|
|
249
|
+
fexp_sort_mtime: "fexp.sort_mtime",
|
|
250
|
+
fexp_sort_fname: "fexp.sort_fname",
|
|
251
|
+
fexp_cut_file: "fexp.cut_file",
|
|
252
|
+
fexp_copy_file: "fexp.copy_file",
|
|
253
|
+
fexp_delete_file: "fexp.delete_file",
|
|
254
|
+
fexp_paste_files: "fexp.paste_files",
|
|
255
|
+
fexp_quit: "fexp.quit",
|
|
256
|
+
bmgr_select: "bmgr.select",
|
|
257
|
+
bmgr_close: "bmgr.close",
|
|
258
|
+
bmark_select: "bmark.select",
|
|
259
|
+
bmark_delete: "bmark.delete",
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
# A reference to an action by its dotted id, built by chaining: a.move.word.next
|
|
263
|
+
# is the reference "move.word.next" (nothing runs), and a trailing "!" runs
|
|
264
|
+
# it: a.buf.save!. Based on BasicObject, so ids like a.class or a.send work.
|
|
265
|
+
# Use a.… only in custom.rb and on the command line: in lib/, a local
|
|
266
|
+
# variable named "a" hides the method, so lib/ code uses the string form.
|
|
267
|
+
class ActionRef < BasicObject
|
|
268
|
+
def initialize(path)
|
|
269
|
+
@path = path
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
def to_s
|
|
273
|
+
@path.join(".")
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
alias to_str to_s
|
|
277
|
+
|
|
278
|
+
def inspect
|
|
279
|
+
"a." + to_s
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
def respond_to?(name, _priv = false)
|
|
283
|
+
[:to_s, :to_str, :inspect].include?(name)
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
def method_missing(name, *args)
|
|
287
|
+
s = name.to_s
|
|
288
|
+
# Conversion hooks Ruby probes for (to_ary, to_hash, ...) and predicates
|
|
289
|
+
# aren't path segments
|
|
290
|
+
::Kernel.raise ::NoMethodError, "undefined method '#{s}' for #{inspect}" if s.start_with?("to_") || s.end_with?("?", "=")
|
|
291
|
+
if s.end_with?("!")
|
|
292
|
+
id = (@path + [s.chomp("!")]).join(".")
|
|
293
|
+
if !$vma.actions.include?(id)
|
|
294
|
+
::Kernel.raise ::NameError, "Unknown action #{id}#{$vma.actions.did_you_mean(id)}"
|
|
295
|
+
end
|
|
296
|
+
return $vma.actions.call(id, *args)
|
|
297
|
+
end
|
|
298
|
+
ActionRef.new(@path + [s])
|
|
10
299
|
end
|
|
11
300
|
end
|
|
12
301
|
|
|
302
|
+
# Root of the action references: a.move.word.next, a.buf.save!
|
|
303
|
+
def a
|
|
304
|
+
ActionRef.new([])
|
|
305
|
+
end
|
|
306
|
+
|
|
13
307
|
def unreg_act(id)
|
|
14
308
|
vma.actions.unregister(id)
|
|
15
309
|
end
|
|
16
310
|
|
|
311
|
+
# id: a dotted id string ("buf.save"), an a.… reference, or an old symbol
|
|
17
312
|
def reg_act(id, callfunc, name = "", opt = {})
|
|
313
|
+
id = id.to_s if ActionRef === id
|
|
18
314
|
if callfunc.class == Proc
|
|
19
315
|
a = Action.new(id, name, callfunc, opt)
|
|
20
316
|
else
|
|
@@ -25,6 +321,7 @@ def reg_act(id, callfunc, name = "", opt = {})
|
|
|
25
321
|
end
|
|
26
322
|
a = Action.new(id, name, m, opt)
|
|
27
323
|
end
|
|
324
|
+
vma.actions.register(id, a)
|
|
28
325
|
return a
|
|
29
326
|
end
|
|
30
327
|
|
|
@@ -43,27 +340,77 @@ class ActionList
|
|
|
43
340
|
@actions = {}
|
|
44
341
|
end
|
|
45
342
|
|
|
343
|
+
# The registry key for id: an a.… reference becomes its string, and an old
|
|
344
|
+
# id listed in ACTION_ALIASES becomes its new id (noted once per old id).
|
|
345
|
+
def resolve(id)
|
|
346
|
+
id = id.to_s if ActionRef === id
|
|
347
|
+
if (id.class == Symbol || id.class == String) && (new_id = ACTION_ALIASES[id.to_sym])
|
|
348
|
+
@aliases_noted ||= {}
|
|
349
|
+
if !@aliases_noted[id.to_sym]
|
|
350
|
+
@aliases_noted[id.to_sym] = true
|
|
351
|
+
message("action :#{id} is now #{new_id}")
|
|
352
|
+
end
|
|
353
|
+
return new_id
|
|
354
|
+
end
|
|
355
|
+
id
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
# " (did you mean x.y?)" for an unknown id, or ""
|
|
359
|
+
def did_you_mean(id)
|
|
360
|
+
ids = @actions.keys.select { |k| k.class == String && k.match?(ACTION_ID_RE) } +
|
|
361
|
+
@actions.keys.select { |k| k.class == Symbol }.map(&:to_s)
|
|
362
|
+
c = DidYouMean::SpellChecker.new(dictionary: ids).correct(id.to_s).first
|
|
363
|
+
c ? " (did you mean #{c}?)" : ""
|
|
364
|
+
end
|
|
365
|
+
|
|
46
366
|
def register(id, obj)
|
|
47
|
-
@actions[id] = obj
|
|
367
|
+
@actions[resolve(id)] = obj
|
|
48
368
|
end
|
|
49
369
|
|
|
50
370
|
def unregister(id)
|
|
51
|
-
@actions.delete(id)
|
|
371
|
+
@actions.delete(resolve(id))
|
|
52
372
|
end
|
|
53
373
|
|
|
54
374
|
def include?(act)
|
|
55
|
-
return @actions.has_key?(act)
|
|
375
|
+
return @actions.has_key?(resolve(act))
|
|
56
376
|
end
|
|
57
377
|
|
|
58
378
|
def [](id)
|
|
59
|
-
@actions[id]
|
|
379
|
+
@actions[resolve(id)]
|
|
380
|
+
end
|
|
381
|
+
|
|
382
|
+
def ids
|
|
383
|
+
@actions.keys
|
|
384
|
+
end
|
|
385
|
+
|
|
386
|
+
# Dotted action ids (no Ruby-code bindings, no old symbol ids)
|
|
387
|
+
def dotted_ids
|
|
388
|
+
@actions.keys.select { |k| k.class == String && k.match?(ACTION_ID_RE) && !@actions[k].opt&.[](:code) }
|
|
389
|
+
end
|
|
390
|
+
|
|
391
|
+
# The next level of ids below prefix, sorted: complete("move.") =>
|
|
392
|
+
# ["move.buf.", "move.char.", ..., "move.random"]. An entry ending in "."
|
|
393
|
+
# has more below it; one that is also an action itself appears both ways
|
|
394
|
+
# ("buf.save" and "buf.save."). complete("") lists the namespaces.
|
|
395
|
+
def complete(prefix)
|
|
396
|
+
out = []
|
|
397
|
+
dotted_ids.each { |id|
|
|
398
|
+
next if !id.start_with?(prefix)
|
|
399
|
+
rest = id[prefix.size..]
|
|
400
|
+
seg, more = rest.split(".", 2)
|
|
401
|
+
next if seg.nil? || seg.empty?
|
|
402
|
+
out << (more ? "#{prefix}#{seg}." : "#{prefix}#{seg}")
|
|
403
|
+
}
|
|
404
|
+
out.uniq.sort
|
|
60
405
|
end
|
|
61
406
|
|
|
62
|
-
|
|
407
|
+
# args: the typed character for an action bound to a "<char>" key
|
|
408
|
+
def call(id, *args)
|
|
409
|
+
id = resolve(id)
|
|
63
410
|
@acth << id
|
|
64
411
|
a = @actions[id]
|
|
65
412
|
if a
|
|
66
|
-
a.method.call()
|
|
413
|
+
a.method.call(*args)
|
|
67
414
|
else
|
|
68
415
|
message("Unknown action: " + id.inspect)
|
|
69
416
|
end
|
|
@@ -75,8 +422,8 @@ class ActionList
|
|
|
75
422
|
|
|
76
423
|
def gui_search()
|
|
77
424
|
l = []
|
|
78
|
-
opt = { :title => "Search for actions", :desc => "Fuzzy search for actions. <up> or <down> to change
|
|
79
|
-
:columns => [{ :title => "Shortcut", :id => 0 }, { :title => "Action", :id => 1 }] }
|
|
425
|
+
opt = { :title => "Search for actions", :desc => "Fuzzy search for actions. <up> or <down> to change selected. <enter> to select current.",
|
|
426
|
+
:columns => [{ :title => "Shortcut", :id => 0 }, { :title => "Action", :id => 1 }, { :title => "Description", :id => 2 }] }
|
|
80
427
|
|
|
81
428
|
@select_keys = ["h", "l", "f", "d", "s", "a", "g", "z"]
|
|
82
429
|
|
|
@@ -88,15 +435,24 @@ class ActionList
|
|
|
88
435
|
|
|
89
436
|
@item_list = []
|
|
90
437
|
|
|
438
|
+
# Rows for Search for Actions: [key, id, description]. A query that
|
|
439
|
+
# starts with a namespace and a dot ("move." or "move.wo") searches only that
|
|
440
|
+
# namespace, and "move." alone lists all of it. An old id finds the action
|
|
441
|
+
# it was renamed to.
|
|
91
442
|
def search_actions_update_callback(search_str = "")
|
|
92
443
|
return [] if search_str == ""
|
|
93
444
|
|
|
94
|
-
|
|
445
|
+
old_ids = Hash.new { |h, k| h[k] = [] }
|
|
446
|
+
ACTION_ALIASES.each { |o, n| old_ids[n] << o.to_s }
|
|
447
|
+
|
|
448
|
+
ns = search_str[/\A[a-z_]+\./]
|
|
449
|
+
ns = nil if ns && !dotted_ids.any? { |id| id.start_with?(ns) }
|
|
450
|
+
|
|
451
|
+
item_list = []
|
|
95
452
|
for act_id in @actions.keys
|
|
453
|
+
next if ns && !act_id.to_s.start_with?(ns)
|
|
96
454
|
act = @actions[act_id]
|
|
97
|
-
item = {}
|
|
98
|
-
item[:key] = ""
|
|
99
|
-
|
|
455
|
+
item = { key: "" }
|
|
100
456
|
for mode_str in ["C", "V"]
|
|
101
457
|
c_kbd = vma.kbd.act_bindings[mode_str][act_id]
|
|
102
458
|
if c_kbd.class == String
|
|
@@ -105,26 +461,21 @@ class ActionList
|
|
|
105
461
|
break
|
|
106
462
|
end
|
|
107
463
|
end
|
|
108
|
-
# c_kbd = vma.kbd.act_bindings[mode_str][nfo[:action]]
|
|
109
464
|
item[:action] = act_id
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
465
|
+
desc = act.method_name.to_s
|
|
466
|
+
item[:desc] = desc == act_id.to_s ? "" : desc
|
|
467
|
+
item[:str] = item[:desc].empty? ? act_id.to_s : "#{act_id} #{desc}"
|
|
468
|
+
item[:match] = ([item[:str]] + old_ids[act_id]).join(" ")
|
|
469
|
+
item_list << item
|
|
115
470
|
end
|
|
116
471
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
@item_list = r
|
|
125
|
-
|
|
126
|
-
r = a.collect { |x| [x[0][:key], x[0][:str]] }
|
|
127
|
-
return r
|
|
472
|
+
if ns && search_str == ns
|
|
473
|
+
found = item_list.sort_by { |x| x[:action].to_s }.map { |x| [x] }
|
|
474
|
+
else
|
|
475
|
+
found = filter_items(item_list, 0, ns ? search_str[ns.size..] : search_str)
|
|
476
|
+
end
|
|
477
|
+
@item_list = found.collect { |x| [x[0][0], 0, x] }
|
|
478
|
+
return found.collect { |x| [x[0][:key], x[0][:action].to_s, x[0][:desc]] }
|
|
128
479
|
end
|
|
129
480
|
|
|
130
481
|
def search_actions_select_callback(search_str, idx)
|
|
@@ -134,12 +485,8 @@ class ActionList
|
|
|
134
485
|
debug "Selected:" + acc.to_s
|
|
135
486
|
gui_select_window_close(0)
|
|
136
487
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
elsif acc.class == Symbol
|
|
140
|
-
debug "Symbol"
|
|
141
|
-
call(acc)
|
|
142
|
-
end
|
|
488
|
+
# Dotted ids, old symbol ids and Ruby-code bindings alike
|
|
489
|
+
exec_action(acc)
|
|
143
490
|
end
|
|
144
491
|
|
|
145
492
|
def filter_items(item_list, item_key, search_str)
|
|
@@ -150,7 +497,7 @@ class ActionList
|
|
|
150
497
|
puts item.inspect
|
|
151
498
|
exit!
|
|
152
499
|
end
|
|
153
|
-
[item, srn_dst(search_str, item[:str])]
|
|
500
|
+
[item, srn_dst(search_str, item[:match] || item[:str])]
|
|
154
501
|
end
|
|
155
502
|
scores.sort_by! { |x| -x[1] }
|
|
156
503
|
debug scores.inspect
|
|
@@ -159,3 +506,4 @@ class ActionList
|
|
|
159
506
|
return scores
|
|
160
507
|
end
|
|
161
508
|
end
|
|
509
|
+
end # module Vimamsa
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
module Vimamsa
|
|
2
|
+
|
|
3
|
+
# From the AppImage, AppRun points GI_TYPELIB_PATH, GIO_MODULE_DIR, GST_*, ...
|
|
4
|
+
# at the bundle and unsets GEM_HOME, RUBYOPT, ... (scripts/appimage/AppRun). It
|
|
5
|
+
# lists those names in VMA_APPIMAGE_ENV and keeps each one's previous value in
|
|
6
|
+
# VMA_HOST_<name>. GLib, GIO, GObject Introspection and GStreamer read them once
|
|
7
|
+
# and keep what they read, so after startup the host's values go back into ENV.
|
|
8
|
+
# Programs the editor starts (git, a terminal, the user's own Ruby or Python
|
|
9
|
+
# GTK programs) then get the user's environment, not the bundle's typelibs,
|
|
10
|
+
# modules and gem settings. PATH keeps the bundle's ruby-lsp/rufo wrappers.
|
|
11
|
+
def restore_host_env
|
|
12
|
+
names = ENV["VMA_APPIMAGE_ENV"]
|
|
13
|
+
return if names.nil?
|
|
14
|
+
# Read on first use, so use them before the bundle paths go away
|
|
15
|
+
GdkPixbuf::Pixbuf.formats if defined?(GdkPixbuf::Pixbuf)
|
|
16
|
+
Gio::SettingsSchemaSource.default
|
|
17
|
+
Gio::Vfs.default
|
|
18
|
+
# GStreamer may only be loaded later (cnf.audio, the dictation module), but
|
|
19
|
+
# finds the bundled plugins only through GST_* (the plugin registry is
|
|
20
|
+
# cached in ~/.cache/vimamsa, so this is quick after the first start)
|
|
21
|
+
require "gstreamer"
|
|
22
|
+
Gst.init if Gst.respond_to?(:init)
|
|
23
|
+
names.split.each { |n|
|
|
24
|
+
host = "VMA_HOST_#{n}"
|
|
25
|
+
if ENV.key?(host)
|
|
26
|
+
ENV[n] = ENV.delete(host)
|
|
27
|
+
else
|
|
28
|
+
ENV.delete(n)
|
|
29
|
+
end
|
|
30
|
+
}
|
|
31
|
+
ENV.delete("VMA_APPIMAGE_ENV")
|
|
32
|
+
debug "Restored the host environment for child processes: #{names}"
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
end # module Vimamsa
|
data/lib/vimamsa/audio.rb
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
require "gstreamer"
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
def self.exists?(fn)
|
|
5
|
-
File.exist?(fn)
|
|
6
|
-
end
|
|
7
|
-
end
|
|
3
|
+
module Vimamsa
|
|
8
4
|
|
|
9
5
|
# following the example gstreamer-4.2.0/sample/helloworld_e.rb
|
|
10
6
|
class Audio
|
|
@@ -80,3 +76,4 @@ class Audio
|
|
|
80
76
|
end
|
|
81
77
|
end
|
|
82
78
|
|
|
79
|
+
end # module Vimamsa
|