vimamsa 0.1.27 → 0.1.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/appimage.yml +17 -10
  3. data/Dockerfile +2 -2
  4. data/README.md +162 -90
  5. data/custom_example.rb +33 -15
  6. data/doc/TODO.md +334 -110
  7. data/doc/action_names_plan.md +442 -0
  8. data/doc/bundling_plan.md +2 -1
  9. data/doc/delta_syntax_plan.md +293 -0
  10. data/doc/demo_recording_plan.md +288 -0
  11. data/doc/design_goals.md +27 -0
  12. data/doc/intro_page_plan.md +266 -0
  13. data/doc/key_bindings_report_plan.md +45 -0
  14. data/doc/line_tree_plan.md +89 -0
  15. data/doc/missing_vim_bindings.md +34 -44
  16. data/doc/modules_settings_plan.md +1 -1
  17. data/doc/registries_plan.md +202 -0
  18. data/doc/startup_speed_plan.md +97 -0
  19. data/doc/test_commands.md +232 -0
  20. data/doc/treap_visualizer.html +585 -0
  21. data/doc/vim_compatibility_plan.md +186 -31
  22. data/doc/vimlike_vim_conflicts.md +236 -228
  23. data/doc/vm_snapshots_plan.md +4 -4
  24. data/doc/wysiwyg_plan.md +231 -0
  25. data/docker_cmd.sh +1 -1
  26. data/exe/run_tests.rb +85 -3
  27. data/exe/vimamsa +49 -6
  28. data/help/intro.txt +30 -0
  29. data/help/vim_intro.txt +31 -0
  30. data/img/demo.gif +0 -0
  31. data/img/demo.mp4 +0 -0
  32. data/lang/hyperplaintext.lang +1 -1
  33. data/lib/vimamsa/ack.rb +2 -0
  34. data/lib/vimamsa/actions.rb +381 -36
  35. data/lib/vimamsa/bookmarks.rb +8 -8
  36. data/lib/vimamsa/buffer.rb +84 -38
  37. data/lib/vimamsa/buffer_changetext.rb +58 -36
  38. data/lib/vimamsa/buffer_list.rb +2 -2
  39. data/lib/vimamsa/buffer_manager.rb +6 -6
  40. data/lib/vimamsa/cli_help.rb +75 -0
  41. data/lib/vimamsa/clipboard.rb +6 -3
  42. data/lib/vimamsa/conf.rb +9 -0
  43. data/lib/vimamsa/crash_handler.rb +2 -2
  44. data/lib/vimamsa/debug.rb +2 -2
  45. data/lib/vimamsa/demo_player.rb +494 -0
  46. data/lib/vimamsa/demo_recorder.rb +277 -0
  47. data/lib/vimamsa/diff_buffer.rb +1 -1
  48. data/lib/vimamsa/dot_repeat.rb +104 -0
  49. data/lib/vimamsa/easy_jump.rb +54 -3
  50. data/lib/vimamsa/editor.rb +136 -65
  51. data/lib/vimamsa/file_history.rb +1 -1
  52. data/lib/vimamsa/file_manager.rb +23 -23
  53. data/lib/vimamsa/form_input.rb +388 -0
  54. data/lib/vimamsa/gui.rb +89 -13
  55. data/lib/vimamsa/gui_command_line.rb +44 -5
  56. data/lib/vimamsa/gui_form_generator.rb +17 -6
  57. data/lib/vimamsa/gui_func_panel.rb +1 -1
  58. data/lib/vimamsa/gui_key_hint.rb +165 -0
  59. data/lib/vimamsa/gui_keylog_panel.rb +164 -2
  60. data/lib/vimamsa/gui_menu.rb +69 -50
  61. data/lib/vimamsa/gui_select_window.rb +77 -43
  62. data/lib/vimamsa/gui_settings.rb +9 -5
  63. data/lib/vimamsa/gui_sourceview.rb +28 -81
  64. data/lib/vimamsa/gui_theme.rb +11 -2
  65. data/lib/vimamsa/hook.rb +2 -0
  66. data/lib/vimamsa/intro_page.rb +367 -0
  67. data/lib/vimamsa/key_actions.rb +315 -225
  68. data/lib/vimamsa/key_binding_tree.rb +228 -61
  69. data/lib/vimamsa/key_bindings_notepad.rb +18 -16
  70. data/lib/vimamsa/key_bindings_report.rb +290 -67
  71. data/lib/vimamsa/key_bindings_vim.rb +43 -297
  72. data/lib/vimamsa/key_bindings_vim_core.rb +356 -0
  73. data/lib/vimamsa/key_bindings_vimlike.rb +347 -339
  74. data/lib/vimamsa/key_names.rb +80 -0
  75. data/lib/vimamsa/langservp.rb +62 -7
  76. data/lib/vimamsa/line_tree.rb +367 -0
  77. data/lib/vimamsa/macro.rb +20 -3
  78. data/lib/vimamsa/rbvma.rb +15 -0
  79. data/lib/vimamsa/registers.rb +125 -0
  80. data/lib/vimamsa/run_ruby.rb +64 -0
  81. data/lib/vimamsa/search_replace.rb +4 -4
  82. data/lib/vimamsa/string_util.rb +17 -3
  83. data/lib/vimamsa/tests.rb +8 -8
  84. data/lib/vimamsa/text_objects.rb +11 -54
  85. data/lib/vimamsa/text_transforms.rb +4 -0
  86. data/lib/vimamsa/tmp_user_dir.rb +39 -0
  87. data/lib/vimamsa/user_dirs.rb +83 -0
  88. data/lib/vimamsa/version.rb +1 -1
  89. data/lib/vimamsa/vim_operators.rb +365 -0
  90. data/modules/calculator/calculator.rb +5 -5
  91. data/modules/color_highlight/color_highlight.rb +3 -3
  92. data/modules/dictation/dictation.rb +32 -32
  93. data/modules/ollama/ollama.rb +5 -5
  94. data/modules/terminal/terminal.rb +5 -5
  95. data/modules/tts/tts.rb +10 -10
  96. data/run_e2e_vm.sh +3 -3
  97. data/run_tests_vm.rb +163 -0
  98. data/scripts/appimage/AppRun +7 -0
  99. data/scripts/appimage/build_in_container.sh +11 -1
  100. data/scripts/appimage/smoke_test.sh +1 -1
  101. data/scripts/demo/demo_easyjump_steps.txt +60 -0
  102. data/scripts/demo/demo_files_steps.txt +52 -0
  103. data/scripts/demo/demo_steps.txt +9 -1
  104. data/scripts/demo/notes.txt +6 -0
  105. data/scripts/demo/record_demo.rb +60 -81
  106. data/scripts/demo/report.rb +7 -0
  107. data/scripts/demo/shapes.rb +1 -0
  108. data/scripts/demo/square/shapes.rb +29 -0
  109. data/scripts/demo/square/steps.txt +185 -0
  110. data/scripts/lib/perf_startup.rb +138 -0
  111. data/scripts/lib/script_helpers.rb +53 -0
  112. data/scripts/perf_compare.rb +34 -0
  113. data/scripts/profile_startup.rb +72 -0
  114. data/tests/test_action_ids.rb +232 -0
  115. data/tests/test_auto_format.rb +2 -2
  116. data/tests/test_autocomplete.rb +1 -1
  117. data/tests/test_basic_editing.rb +18 -18
  118. data/tests/test_bookmarks.rb +6 -6
  119. data/tests/test_bracket_match.rb +3 -0
  120. data/tests/test_cli_help.rb +64 -0
  121. data/tests/test_color_highlight.rb +2 -2
  122. data/tests/test_command_line.rb +1 -1
  123. data/tests/test_context_menu_file.rb +18 -0
  124. data/tests/test_copy_paste.rb +33 -33
  125. data/tests/test_custom_two_phase.rb +1 -1
  126. data/tests/test_demo_player.rb +355 -0
  127. data/tests/test_demo_recorder.rb +202 -0
  128. data/tests/test_dictation.rb +16 -16
  129. data/tests/test_dot_repeat.rb +88 -0
  130. data/tests/test_easy_jump.rb +93 -0
  131. data/tests/test_extract_file_links.rb +3 -3
  132. data/tests/test_file_panel.rb +2 -2
  133. data/tests/test_flash.rb +1 -1
  134. data/tests/test_fold.rb +1 -1
  135. data/tests/test_form_input.rb +203 -0
  136. data/tests/test_func_panel.rb +2 -2
  137. data/tests/test_gtk_sync.rb +7 -7
  138. data/tests/test_intro_page.rb +437 -0
  139. data/tests/test_key_categories.rb +163 -0
  140. data/tests/test_keylog_panel.rb +163 -3
  141. data/tests/test_line_ends.rb +51 -0
  142. data/tests/test_line_tree.rb +86 -0
  143. data/tests/test_lsp_clangd.rb +2 -2
  144. data/tests/test_lsp_root.rb +43 -0
  145. data/tests/test_macro.rb +2 -2
  146. data/tests/test_module_interface.rb +9 -9
  147. data/tests/test_notepad_bindings.rb +5 -5
  148. data/tests/test_perf_startup.rb +28 -0
  149. data/tests/test_random_edit.rb +27 -27
  150. data/tests/test_registers.rb +131 -0
  151. data/tests/test_run_ruby.rb +77 -0
  152. data/tests/test_startup_file.rb +45 -4
  153. data/tests/test_text_objects.rb +1 -1
  154. data/tests/test_text_transforms.rb +12 -0
  155. data/tests/test_tmp_user_dir.rb +79 -0
  156. data/tests/test_tts.rb +10 -10
  157. data/tests/test_undo.rb +34 -34
  158. data/tests/test_user_dirs.rb +122 -0
  159. data/tests/test_vim_bindings.rb +107 -6
  160. data/tests/test_vim_conflicts.rb +41 -4
  161. data/tests/test_vim_operators.rb +116 -0
  162. data/tests/test_window_layout.rb +83 -0
  163. data/vimamsa.gemspec +1 -1
  164. data/vm_guest_run.sh +75 -28
  165. metadata +60 -4
  166. data/run_tests.rb +0 -89
  167. data/run_tests_vm.sh +0 -130
@@ -1,13 +1,5 @@
1
1
 
2
2
  module Vimamsa
3
- def e_move_forward_char
4
- buf.move(FORWARD_CHAR)
5
- end
6
-
7
- def e_move_backward_char
8
- buf.move(BACKWARD_CHAR)
9
- end
10
-
11
3
  def history_switch_backwards
12
4
  bufs.history_switch_backwards
13
5
  end
@@ -21,108 +13,105 @@ def jump_to_next_edit
21
13
  end
22
14
 
23
15
 
24
- reg_act(:command_to_buf, proc { command_to_buf }, "Execute command, output to buffer")
16
+ reg_act("debug.command", proc { command_to_buf }, "Execute command, output to buffer")
25
17
 
26
- reg_act(:lsp_debug, proc { vma.buf.lsp_get_def }, "LSP get definition")
27
- reg_act(:lsp_jump_to_definition, proc { vma.buf.lsp_jump_to_def }, "LSP jump to definition")
28
- reg_act(:lsp_restart, proc { require "vimamsa/langservp"; lsp_restart },
18
+ reg_act("lsp.debug", proc { vma.buf.lsp_get_def }, "LSP get definition")
19
+ reg_act("lsp.definition", proc { vma.buf.lsp_jump_to_def }, "LSP jump to definition")
20
+ reg_act("lsp.restart", proc { require "vimamsa/langservp"; lsp_restart },
29
21
  "LSP: restart the language server of the current file (e.g. after adding compile_flags.txt)")
30
22
 
31
- reg_act(:eval_buf, proc { vma.buf.eval_whole_buf }, "Eval whole current buffer as ruby code (DANGEROUS)")
32
-
33
- reg_act(:show_settings, proc { show_settings_dialog }, "Show settings")
34
- reg_act(:refresh_colors, proc { gui_reload_theme_and_colors }, "Reload theme color palettes + config and refresh the UI (no restart)")
35
- reg_act(:cut_selection, proc { buf.delete(SELECTION) }, "Cut selection to clipboard")
36
-
37
- reg_act(:insert_backspace, proc { buf.selection_active? ? buf.delete(SELECTION) : buf.delete(BACKWARD_CHAR) }, "Delete backwards")
38
- reg_act(:insert_delete, proc { buf.selection_active? ? buf.delete(SELECTION) : buf.delete(CURRENT_CHAR_FORWARD) }, "Delete forward (selection-aware)")
39
- reg_act(:select_all, proc { buf.select_all }, "Select all text")
40
- reg_act(:insert_select_up, proc { insert_select_move(BACKWARD_LINE) }, "Select texte upwards")
41
- reg_act(:insert_select_down, proc { insert_select_move(FORWARD_LINE) }, "Select text downwards")
42
-
43
- reg_act(:copy_selection, proc { buf.copy_active_selection }, "Copy selection to clipboard")
44
- reg_act(:enable_debug, proc { cnf.debug = true }, "Enable debug")
45
- reg_act(:disable_debug, proc { cnf.debug = false }, "Disable debug")
46
-
47
- reg_act(:experimental_eval, proc { bindkey "V , e", "vma.buf.convert_selected_text(:eval)" }, "Enable key binding:\"[VISUAL] , e:\" Eval selected text")
48
-
49
- reg_act(:easy_jump, proc { EasyJump.start }, "Easy jump")
50
- reg_act(:gui_ensure_cursor_visible, proc { vma.gui.view.ensure_cursor_visible }, "Scroll to current cursor position")
51
- reg_act(:gui_refresh_cursor, proc { vma.buf.refresh_cursor }, "Refresh cursor")
52
-
53
- reg_act(:savedebug, "savedebug", "Save debug info", { :group => :debug })
54
- reg_act(:open_file_dialog, "open_file_dialog", "Open file", { :group => :file })
55
- reg_act(:create_new_file, "create_new_file", "Create new file", { :group => :file })
56
- reg_act(:backup_all_buffers, proc { backup_all_buffers }, "Backup all buffers", { :group => :file })
57
- reg_act(:e_move_forward_char, "e_move_forward_char", "Move forward one character", { :group => [:move, :basic] })
58
- reg_act(:e_move_backward_char, "e_move_backward_char", "Move backward one character", { :group => [:move, :basic] })
59
- # reg_act(:history_switch_backwards, proc{bufs.history_switch_backwards}, "", { :group => :file })
60
- reg_act(:history_switch_backwards, proc { bufs.history_switch(-1) }, "Prev buffer", { :group => :file })
61
- reg_act(:history_switch_forwards, proc { bufs.history_switch(+1) }, "Next buffer", { :group => :file })
62
- reg_act(:print_buffer_access_list, proc { bufs.print_by_access_time }, "Print buffers by access time", { :group => :file })
63
- reg_act(:center_on_current_line, "center_on_current_line", "", { :group => :view })
64
- reg_act(:run_last_macro, proc { vma.macro.run_last_macro }, "Run last recorded or executed macro", { :group => :macro })
65
- reg_act(:jump_to_next_edit, "jump_to_next_edit", "Jump to next edit pos")
66
- reg_act(:jump_to_last_edit, proc { buf.jump_to_last_edit }, "Jump to last edit pos")
67
- reg_act(:jump_to_random, proc { buf.jump_to_random_pos }, "")
68
- reg_act(:insert_new_line, proc { buf.insert_new_line() }, "Insert new line")
69
- reg_act(:show_key_bindings, proc { show_key_bindings }, "Show key bindings")
70
- reg_act(:show_free_key_bindings, proc { show_free_key_bindings }, "Show available (unbound) key binding slots")
71
- reg_act(:show_vim_binding_conflicts, proc { show_vim_binding_conflicts }, "Show which vim key bindings conflict with the vimlike keymap")
72
- reg_act(:put_file_path_to_clipboard, proc { buf.put_file_path_to_clipboard }, "Put file path of current file to clipboard")
73
- reg_act(:put_file_ref_to_clipboard, proc { buf.put_file_ref_to_clipboard }, "Put file ref of current file to clipboard")
74
-
75
- # reg_act(:encrypt_file, proc{buf.set_encrypted},"Set current file to encrypt on save")
76
- reg_act(:encrypt_file, proc { encrypt_cur_buffer }, "Set current file to encrypt on save")
77
- reg_act(:set_unencrypted, proc { buf.set_unencrypted }, "Set current file to save unencrypted")
78
- reg_act(:set_executable, proc { buf.set_executable }, "Set current file permissions to executable")
79
- # reg_act(:close_all_buffers, proc { bufs.close_all_buffers() }, "Close all buffers")
80
- reg_act(:close_current_buffer, proc { bufs.close_current_buffer(true) }, "Close current buffer")
81
- reg_act(:toggle_file_panel, proc { vma.gui.toggle_file_panel }, "Toggle file panel")
82
- reg_act(:file_panel_prev_file, proc { vma.gui.file_panel_select_adjacent(-1) }, "Switch to previous file in file panel order")
83
- reg_act(:file_panel_next_file, proc { vma.gui.file_panel_select_adjacent(1) }, "Switch to next file in file panel order")
84
- reg_act(:file_panel_easy_jump, proc { vma.gui.file_panel_easy_jump }, "Easy jump: pick a file in the file panel by label")
85
- reg_act(:show_message_history, proc { vma.gui.show_message_history }, "Show message history")
86
- reg_act(:start_cmd_line, proc { vma.gui.cmd_line.start }, "Open command line (:)")
87
- reg_act(:toggle_func_panel, proc { vma.gui.toggle_func_panel }, "Toggle LSP function panel")
88
- reg_act(:refresh_func_panel, proc { vma.gui.func_panel_refresh }, "Refresh LSP function panel")
89
- reg_act(:toggle_keylog_panel, proc { vma.gui.toggle_keylog_panel }, "Toggle key log panel")
90
- reg_act(:git_diff_w, proc { git_diff_w }, "Show git diff -w for whole repository")
91
- reg_act(:lsp_print_functions, proc { lsp_print_functions }, "LSP print functions in current file")
92
- reg_act(:comment_selection, proc { buf.comment_selection }, "Comment selection")
93
- reg_act(:delete_char_forward, proc { buf.delete(CURRENT_CHAR_FORWARD) }, "Delete char forward", { :group => [:edit, :basic] })
94
- reg_act(:gui_file_finder, proc { vma.FileFinder.start_gui }, "Fuzzy file finder")
95
- reg_act(:gui_file_history_finder, proc { vma.FileHistory.start_gui }, "Fuzzy file history finder")
96
- reg_act(:gui_search_replace, proc { gui_search_replace }, "Search and replace")
97
- reg_act(:select_buffer_language, proc { gui_select_buffer_language }, "Select syntax highlighting language for current buffer")
98
- reg_act(:find_next, proc { $search.jump_to_next() }, "Find next")
99
-
100
- reg_act(:set_style_bold, proc { buf.style_transform(:bold) }, "Set text weight to bold")
101
- reg_act(:set_style_link, proc { buf.style_transform(:link) }, "Set text as link")
102
- reg_act(:set_style_italic, proc { buf.style_transform(:italic) }, "Set text style to italic")
103
- reg_act(:V_join_lines, proc { vma.buf.convert_selected_text(:joinlines) }, "Join lines")
104
- reg_act(:V_to_latex_itemize, proc { vma.buf.convert_selected_text(:latex_itemize) }, "Convert selection to LaTeX itemize list")
105
- reg_act(:clear_formats, proc { buf.style_transform(:clear) }, "Clear style formats")
106
- reg_act(:set_line_style_heading, proc { buf.set_line_style(:heading) }, "Set style of current line as heading")
107
- reg_act(:set_line_style_h1, proc { buf.set_line_style(:h1) }, "Set cur line as Heading 1")
108
- reg_act(:set_line_style_h2, proc { buf.set_line_style(:h2) }, "Set cur line as Heading 1")
109
- reg_act(:set_line_style_h3, proc { buf.set_line_style(:h3) }, "Set cur line as Heading 1")
110
- reg_act(:set_line_style_h4, proc { buf.set_line_style(:h4) }, "Set cur line as Heading 1")
111
- reg_act(:set_line_style_bold, proc { buf.set_line_style(:bold) }, "Set style of current line as bold")
112
- reg_act(:set_line_style_title, proc { buf.set_line_style(:title) }, "Set style of current line as title")
113
- reg_act(:set_line_style_italic, proc { buf.set_line_style(:italic) }, "Set style of current line as italic")
114
- reg_act(:clear_line_styles, proc { buf.set_line_style(:clear) }, "Clear styles of current line")
115
- reg_act(:gui_select_buffer, proc { vma.kbd.set_mode("S"); gui_select_buffer }, "Select buffer")
116
- reg_act :open_file_dialog, "open_file_dialog", "Open file"
117
- reg_act :minibuffer_end, proc { minibuffer_end }
118
- reg_act(:invoke_replace, "invoke_replace", "Invoke replace")
119
- reg_act(:diff_buffer, "diff_buffer", "")
120
- reg_act(:git_diff_buffer, proc { git_diff_buffer }, "Show git diff of current file")
121
- reg_act(:diff_buffer_jump_to_source, proc { diff_buffer_jump_to_source }, "Jump to corresponding line in source from diff buffer")
122
- # reg_act(:invoke_grep_search, proc{invoke_grep_search}, "")
123
- reg_act(:invoke_grep_search, proc { gui_grep }, "Grep current buffer")
124
- reg_act(:ack_search, proc { gui_ack }, "") #invoke_ack_search
125
- reg_act(:extract_file_links, proc {
23
+ reg_act("debug.eval.buf", proc { vma.buf.eval_whole_buf }, "Eval whole current buffer as ruby code (DANGEROUS)")
24
+
25
+ reg_act("app.settings", proc { show_settings_dialog }, "Show settings")
26
+ reg_act("view.colors.reload", proc { gui_reload_theme_and_colors }, "Reload theme color palettes + config and refresh the UI (no restart)")
27
+ reg_act("sel.cut", proc { buf.delete(SELECTION) }, "Cut selection to clipboard")
28
+
29
+ reg_act("edit.backspace", proc { buf.selection_active? ? buf.delete(SELECTION) : buf.delete(BACKWARD_CHAR) }, "Delete backwards")
30
+ reg_act("edit.delete.char_or_sel", proc { buf.selection_active? ? buf.delete(SELECTION) : buf.delete(CURRENT_CHAR_FORWARD) }, "Delete forward (selection-aware)")
31
+ reg_act("sel.all", proc { buf.select_all }, "Select all text")
32
+ reg_act("sel.line.prev", proc { insert_select_move(BACKWARD_LINE) }, "Select texte upwards")
33
+ reg_act("sel.line.next", proc { insert_select_move(FORWARD_LINE) }, "Select text downwards")
34
+
35
+ reg_act("sel.copy", proc { buf.copy_active_selection }, "Copy selection to clipboard")
36
+ reg_act("debug.on", proc { cnf.debug = true }, "Enable debug")
37
+ reg_act("debug.off", proc { cnf.debug = false }, "Disable debug")
38
+
39
+ reg_act("debug.eval.sel", proc { bindkey "V , e", "vma.buf.convert_selected_text(:eval)" }, "Enable key binding:\"[VISUAL] , e:\" Eval selected text")
40
+
41
+ reg_act("jump.easy", proc { EasyJump.start }, "Easy jump")
42
+ reg_act("view.cursor.show", proc { vma.gui.view.ensure_cursor_visible }, "Scroll to current cursor position")
43
+ reg_act("view.cursor.refresh", proc { vma.buf.refresh_cursor }, "Refresh cursor")
44
+
45
+ reg_act("debug.save", "savedebug", "Save debug info")
46
+ reg_act("file.open", "open_file_dialog", "Open file")
47
+ reg_act("buf.backup.all", proc { backup_all_buffers }, "Backup all buffers")
48
+ reg_act("move.char.next", proc { buf.move(FORWARD_CHAR) }, "Move forward one character")
49
+ reg_act("move.char.prev", proc { buf.move(BACKWARD_CHAR) }, "Move backward one character")
50
+ reg_act("move.line.next", proc { buf.move(FORWARD_LINE) }, "Move one line forward")
51
+ reg_act("move.line.prev", proc { buf.move(BACKWARD_LINE) }, "Move one line backward")
52
+ # reg_act("buf.history.prev", proc{bufs.history_switch_backwards}, "")
53
+ reg_act("buf.history.prev", proc { bufs.history_switch(-1) }, "Prev buffer")
54
+ reg_act("buf.history.next", proc { bufs.history_switch(+1) }, "Next buffer")
55
+ reg_act("debug.buf.access", proc { bufs.print_by_access_time }, "Print buffers by access time")
56
+ reg_act("view.center", "center_on_current_line", "Center the view on the cursor line")
57
+ reg_act("macro.run.last", proc { vma.macro.run_last_macro }, "Run last recorded or executed macro")
58
+ reg_act("jump.edit.next", "jump_to_next_edit", "Jump to next edit pos")
59
+ reg_act("jump.edit.prev", proc { buf.jump_to_last_edit }, "Jump to the last edit location")
60
+ reg_act("move.random", proc { buf.jump_to_random_pos }, "Jump to a random position")
61
+ reg_act("edit.newline", proc { buf.insert_new_line() }, "Insert new line")
62
+ reg_act("help.keys", proc { show_key_bindings }, "Show key bindings")
63
+ reg_act("help.keys.free", proc { show_free_key_bindings }, "Show available (unbound) key binding slots")
64
+ reg_act("help.vim_conflicts", proc { show_vim_binding_conflicts }, "Show which vim key bindings conflict with the vimlike keymap")
65
+ reg_act("file.path.copy", proc { buf.put_file_path_to_clipboard }, "Put file path of current file to clipboard")
66
+ reg_act("file.ref.copy", proc { buf.put_file_ref_to_clipboard }, "Put file ref of current file to clipboard")
67
+
68
+ # reg_act("buf.encrypt", proc{buf.set_encrypted},"Set current file to encrypt on save")
69
+ reg_act("buf.encrypt", proc { encrypt_cur_buffer }, "Set current file to encrypt on save")
70
+ reg_act("buf.encrypt.off", proc { buf.set_unencrypted }, "Set current file to save unencrypted")
71
+ reg_act("file.executable", proc { buf.set_executable }, "Set current file permissions to executable")
72
+ # reg_act("buf.close.all", proc { bufs.close_all_buffers() }, "Close all buffers")
73
+ reg_act("buf.close", proc { bufs.close_current_buffer(true) }, "Close current buffer")
74
+ reg_act("panel.files.toggle", proc { vma.gui.toggle_file_panel }, "Toggle file panel")
75
+ reg_act("panel.files.prev", proc { vma.gui.file_panel_select_adjacent(-1) }, "Switch to previous file in file panel order")
76
+ reg_act("panel.files.next", proc { vma.gui.file_panel_select_adjacent(1) }, "Switch to next file in file panel order")
77
+ reg_act("panel.files.jump", proc { vma.gui.file_panel_easy_jump }, "Easy jump: pick a file in the file panel by label")
78
+ reg_act("help.messages", proc { vma.gui.show_message_history }, "Show message history")
79
+ reg_act("mode.cmdline", proc { vma.gui.cmd_line.start }, "Open command line (:)")
80
+ reg_act("panel.funcs.toggle", proc { vma.gui.toggle_func_panel }, "Toggle LSP function panel")
81
+ reg_act("panel.funcs.refresh", proc { vma.gui.func_panel_refresh }, "Refresh LSP function panel")
82
+ reg_act("panel.keylog.toggle", proc { vma.gui.toggle_keylog_panel }, "Toggle key log panel")
83
+ reg_act("file.diff.repo", proc { git_diff_w }, "Show git diff -w for whole repository")
84
+ reg_act("lsp.functions", proc { lsp_print_functions }, "LSP print functions in current file")
85
+ reg_act("edit.comment", proc { buf.comment_selection }, "Comment selection")
86
+ reg_act("edit.delete.char", proc { buf.delete(CURRENT_CHAR_FORWARD) }, "Delete char forward")
87
+ reg_act("file.finder", proc { vma.FileFinder.start_gui }, "Fuzzy file finder")
88
+ reg_act("file.history", proc { vma.FileHistory.start_gui }, "Fuzzy file history finder")
89
+ reg_act("search.replace", proc { gui_search_replace }, "Search and replace")
90
+ reg_act("buf.language", proc { gui_select_buffer_language }, "Select syntax highlighting language for current buffer")
91
+ reg_act("search.next", proc { $search.jump_to_next() }, "Find next")
92
+
93
+ reg_act("style.bold", proc { buf.style_transform(:bold) }, "Set text weight to bold")
94
+ reg_act("style.link", proc { buf.style_transform(:link) }, "Set text as link")
95
+ reg_act("style.italic", proc { buf.style_transform(:italic) }, "Set text style to italic")
96
+ reg_act("sel.join", proc { vma.buf.convert_selected_text(:joinlines) }, "Join lines")
97
+ reg_act("sel.latex_itemize", proc { vma.buf.convert_selected_text(:latex_itemize) }, "Convert selection to LaTeX itemize list")
98
+ reg_act("style.clear", proc { buf.style_transform(:clear) }, "Clear style formats")
99
+ reg_act("style.line.heading", proc { buf.set_line_style(:heading) }, "Set style of current line as heading")
100
+ reg_act("style.line.h1", proc { buf.set_line_style(:h1) }, "Set cur line as Heading 1")
101
+ reg_act("style.line.h2", proc { buf.set_line_style(:h2) }, "Set cur line as Heading 1")
102
+ reg_act("style.line.h3", proc { buf.set_line_style(:h3) }, "Set cur line as Heading 1")
103
+ reg_act("style.line.h4", proc { buf.set_line_style(:h4) }, "Set cur line as Heading 1")
104
+ reg_act("style.line.bold", proc { buf.set_line_style(:bold) }, "Set style of current line as bold")
105
+ reg_act("style.line.title", proc { buf.set_line_style(:title) }, "Set style of current line as title")
106
+ reg_act("style.line.italic", proc { buf.set_line_style(:italic) }, "Set style of current line as italic")
107
+ reg_act("style.line.clear", proc { buf.set_line_style(:clear) }, "Clear styles of current line")
108
+ reg_act("buf.switcher", proc { vma.kbd.set_mode("S"); gui_select_buffer }, "Select buffer")
109
+ reg_act "mode.minibuffer.end", proc { minibuffer_end }
110
+ reg_act("search.replace.cmd", "invoke_replace", "Invoke replace")
111
+ reg_act("buf.diff", "diff_buffer", "")
112
+ reg_act("buf.diff.git", proc { git_diff_buffer }, "Show git diff of current file")
113
+ reg_act("diffview.source", proc { diff_buffer_jump_to_source }, "Jump to corresponding line in source from diff buffer")
114
+ reg_act("file.links", proc {
126
115
  links = buf.file_links
127
116
  if links.empty?
128
117
  message("No links to existing files")
@@ -132,7 +121,7 @@ reg_act(:extract_file_links, proc {
132
121
  message("#{links.size} file link(s)")
133
122
  end
134
123
  }, "Extract links to existing files from current file into a new buffer")
135
- reg_act(:open_file_under_cursor, proc {
124
+ reg_act("jump.file", proc {
136
125
  # Like vim gf, and the "Open file" items of the right-click menu
137
126
  fn = buf.file_path_at(buf.pos)
138
127
  if fn.nil?
@@ -142,183 +131,181 @@ reg_act(:open_file_under_cursor, proc {
142
131
  else
143
132
  open_with_default_program(fn)
144
133
  end
145
- }, "Open file whose path is under the cursor", { :group => :file })
146
- reg_act :update_file_index, proc { FileFinder.update_index }, "Update file index"
147
- reg_act :delete_to_word_end, proc { buf.delete2(:to_word_end) }, "Delete to file end", { :group => [:edit, :basic] }
148
- reg_act :delete_to_next_word_start, proc { buf.delete2(:to_next_word) }, "Delete to start of next word", { :group => [:edit, :basic] }
149
- reg_act :delete_to_line_start, proc { buf.delete2(:to_line_start) }, "Delete to line start", { :group => [:edit, :basic] }
150
-
151
- reg_act(:ack_search, proc { gui_ack }, "Ack")
152
-
153
- reg_act(:copy_cur_line, proc { buf.copy_line }, "Copy the current line")
154
- reg_act(:paste_before_cursor, proc { buf.paste(BEFORE) }, "Paste text before the cursor")
155
- reg_act(:paste_after_cursor, proc { buf.paste(AFTER) }, "Paste text after the cursor")
156
- reg_act(:paste_over_after, proc { buf.paste_over(AFTER) }, "Paste over selection or after cursor")
157
- reg_act(:paste_over_before, proc { buf.paste_over(BEFORE) }, "Paste over selection or before cursor")
158
- reg_act(:redo, proc { buf.redo() }, "Redo the last undone action")
159
- reg_act(:undo, proc { buf.undo() }, "Undo the last action")
160
- reg_act(:jump_end_of_line, proc { buf.jump(END_OF_LINE) }, "Move to the end of the current line")
161
- reg_act(:jump_end_of_buffer, proc { buf.jump(END_OF_BUFFER) }, "Move to the end of the buffer")
162
- reg_act(:jump_start_of_buffer, proc { buf.jump(START_OF_BUFFER) }, "Move to the start of the buffer")
163
- reg_act(:jump_beginning_of_line, proc { buf.jump(BEGINNING_OF_LINE) }, "Move to the beginning of the current line")
164
- reg_act(:jump_next_word_end, proc { buf.jump_word(FORWARD, WORD_END) }, "Jump to the end of the next word")
165
- reg_act(:jump_prev_word_start, proc { buf.jump_word(BACKWARD, WORD_START) }, "Jump to the start of the previous word")
166
- reg_act(:jump_next_word_start, proc { buf.jump_word(FORWARD, WORD_START) }, "Jump to the start of the next word")
167
- reg_act(:insert_mode, proc { vma.kbd.set_mode(:insert) }, "Switch to INSERT mode")
168
- reg_act(:prev_mode, proc { vma.kbd.to_previous_mode }, "Return to the previous mode")
169
- reg_act(:move_prev_line, proc { buf.move(BACKWARD_LINE) }, "Move the cursor to the previous line")
170
- reg_act(:move_next_line, proc { buf.move(FORWARD_LINE) }, "Move the cursor to the next line")
171
- reg_act(:move_backward_char, proc { buf.move(BACKWARD_CHAR) }, "Move one character backward")
172
- reg_act(:start_visual_mode, proc { buf.start_selection; vma.kbd.set_mode(:visual) }, "Enter VISUAL mode (for selections)")
173
- reg_act(:jump_last_edit, proc { buf.jump_to_last_edit }, "Jump to the last edit location")
174
- reg_act(:install_demo_files, proc { install_demo_files }, "Install and show Demo")
175
- reg_act(:reload_customrb, proc { reload_customrb }, "Reload custom.rb")
176
-
177
- reg_act(:toggle_autocomplete, proc {
134
+ }, "Open file whose path is under the cursor")
135
+ reg_act "file.finder.reindex", proc { FileFinder.update_index }, "Update file index"
136
+ reg_act "edit.delete.word.end", proc { buf.delete2(:to_word_end) }, "Delete to the end of the word"
137
+ reg_act "edit.delete.word.next", proc { buf.delete2(:to_next_word) }, "Delete to start of next word"
138
+ reg_act "edit.delete.line.start", proc { buf.delete2(:to_line_start) }, "Delete to line start"
139
+
140
+ reg_act("ack.search", proc { gui_ack }, "Search file contents with ack (external program)")
141
+
142
+ reg_act("edit.line.copy", proc { buf.copy_line }, "Copy the current line")
143
+ reg_act("edit.paste.before", proc { buf.paste(BEFORE) }, "Paste text before the cursor")
144
+ reg_act("edit.paste.after", proc { buf.paste(AFTER) }, "Paste text after the cursor")
145
+ reg_act("edit.paste.over.after", proc { buf.paste_over(AFTER) }, "Paste over selection or after cursor")
146
+ reg_act("edit.paste.over.before", proc { buf.paste_over(BEFORE) }, "Paste over selection or before cursor")
147
+ reg_act("undo.redo", proc { buf.redo() }, "Redo the last undone action")
148
+ reg_act("undo.last", proc { buf.undo() }, "Undo the last action")
149
+ reg_act("move.line.end", proc { buf.jump(END_OF_LINE) }, "Move to the end of the current line")
150
+ reg_act("move.buf.end", proc { buf.jump(END_OF_BUFFER) }, "Move to the end of the buffer")
151
+ reg_act("move.buf.start", proc { buf.jump(START_OF_BUFFER) }, "Move to the start of the buffer")
152
+ reg_act("move.line.start", proc { buf.jump(BEGINNING_OF_LINE) }, "Move to the beginning of the current line")
153
+ reg_act("move.word.end", proc { buf.jump_word(FORWARD, WORD_END) }, "Jump to the end of the next word")
154
+ reg_act("move.word.prev", proc { buf.jump_word(BACKWARD, WORD_START) }, "Jump to the start of the previous word")
155
+ reg_act("move.word.next", proc { buf.jump_word(FORWARD, WORD_START) }, "Jump to the start of the next word")
156
+ reg_act("mode.insert", proc { vma.kbd.set_mode(:insert) }, "Switch to INSERT mode")
157
+ reg_act("mode.prev", proc { vma.kbd.to_previous_mode }, "Return to the previous mode")
158
+ reg_act("mode.visual", proc { buf.start_selection; vma.kbd.set_mode(:visual) }, "Enter VISUAL mode (for selections)")
159
+ reg_act("app.demo", proc { install_demo_files }, "Install and show Demo")
160
+ reg_act("help.demo", proc { DemoPlayer.toggle(:basic) }, "Play the basic editing demo (again: stop it)")
161
+ reg_act("help.demo.easyjump", proc { DemoPlayer.toggle(:easyjump) }, "Play the easy jump demo (again: stop it)")
162
+ reg_act("help.demo.files", proc { DemoPlayer.toggle(:files) }, "Play the file switching demo (again: stop it)")
163
+ reg_act("help.demo.pause", proc { DemoPlayer.pause_toggle }, "Pause or continue the demo")
164
+ reg_act("help.demo.faster", proc { DemoPlayer.faster }, "Play the demo faster")
165
+ reg_act("help.demo.slower", proc { DemoPlayer.slower }, "Play the demo slower")
166
+ reg_act("help.demo.stop", proc { DemoPlayer.stop }, "Stop the demo")
167
+ reg_act("help.demo.record", proc { DemoRecorder.toggle }, "Record a demo (again: stop and save it)")
168
+ reg_act("help.demo.recorded.last", proc {
169
+ k = DemoRecorder.last_saved || DemoPlayer.user_demos.keys.last
170
+ k ? DemoPlayer.toggle(k) : message("No recorded demos (Help ▸ Demos ▸ Record demo)")
171
+ }, "Play the demo recorded last")
172
+ reg_act("help.intro", proc { show_help_page("intro") }, "Show the introduction page")
173
+ reg_act("help.vim_intro", proc { show_help_page("vim_intro") }, "Show the main differences from Vim")
174
+ reg_act("help.intro.startup.toggle", proc { toggle_intro_on_startup }, "Show the introduction page at start, or not")
175
+ reg_act("app.customrb.reload", proc { reload_customrb }, "Reload custom.rb")
176
+
177
+ reg_act("edit.complete.toggle", proc {
178
178
  cnf.autocomplete.enabled = !(cnf.autocomplete.enabled? != false)
179
179
  vma.buf&.view&.hide_completions unless cnf.autocomplete.enabled?
180
180
  message("Autocomplete: #{cnf.autocomplete.enabled? ? "ON" : "OFF"}")
181
181
  }, "Toggle autocomplete on/off")
182
182
 
183
- reg_act(:restart_editor, proc { restart_editor }, "Restart: quit, reload config and reopen files")
183
+ reg_act("app.restart", proc { restart_editor }, "Restart: quit, reload config and reopen files")
184
184
 
185
- reg_act :start_browse_mode, proc {
185
+ reg_act "mode.browse", proc {
186
186
  vma.kbd.set_mode(:browse)
187
187
  bufs.reset_navigation
188
188
  }, "Start browse mode"
189
- reg_act :kbd_dump_state, proc { vma.kbd.dump_state; pp ["vma.buf.mode_stack", vma.buf.mode_stack] }, "Dump keyboard tree state"
190
- reg_act :toggle_kbd_passthrough, proc {
189
+ reg_act "debug.kbd", proc { vma.kbd.dump_state; pp ["vma.buf.mode_stack", vma.buf.mode_stack] }, "Dump keyboard tree state"
190
+ reg_act "mode.passthrough.toggle", proc {
191
191
  vma.gui.instance_variable_set(:@kbd_passthrough, !vma.gui.instance_variable_get(:@kbd_passthrough))
192
192
  state = vma.gui.instance_variable_get(:@kbd_passthrough) ? "ON" : "OFF"
193
193
  message("Keyboard passthrough: #{state}")
194
194
  }, "Toggle keyboard event passthrough (allow other widgets to receive key events)"
195
195
 
196
- reg_act :exit_browse_mode, proc {
196
+ reg_act "mode.browse.exit", proc {
197
197
  bufs.add_current_buf_to_history
198
198
  # Load previously saved buffer specific mode stack
199
199
  buf.restore_kbd_mode
200
200
  }, "Exit browse mode"
201
201
 
202
- # reg_act :page_down, proc { page_down }, "Page down", :group => [:move, :basic]
203
- reg_act :page_down, proc { vma.gui.page_down }, "Page down", :group => [:move, :basic]
202
+ # reg_act "move.page.next", proc { page_down }, "Page down"
203
+ reg_act "move.page.next", proc { vma.gui.page_down }, "Page down"
204
204
 
205
- reg_act :page_up, proc { vma.gui.page_up }, "Page up", :group => [:move, :basic]
206
- reg_act :jump_to_start_of_buffer, proc { buf.jump(START_OF_BUFFER) }, "Jump to start of buffer"
207
- reg_act :jump_to_end_of_buffer, proc { buf.jump(END_OF_BUFFER) }, "Jump to end of buffer"
208
- reg_act(:auto_indent_buffer, proc { buf.auto_format }, "Auto format buffer")
209
- reg_act(:execute_current_line_in_terminal, proc { buf.execute_current_line_in_terminal }, "Execute current line in terminal")
210
- reg_act(:execute_current_line_in_terminal_autoclose, proc { buf.execute_current_line_in_terminal(true) }, "Execute current line in terminal. Close after execution.")
211
- reg_act(:show_images, proc { hpt_scan_images() }, "Show images inserted with ⟦img:file.png⟧ syntax")
212
- reg_act(:delete_current_file, proc { bufs.delete_current_buffer() }, "Delete current file")
205
+ reg_act "move.page.prev", proc { vma.gui.page_up }, "Page up"
206
+ reg_act("edit.indent.buf", proc { buf.auto_format }, "Auto format buffer")
207
+ reg_act("term.line", proc { buf.execute_current_line_in_terminal }, "Execute current line in terminal")
208
+ reg_act("buf.run.ruby", proc { run_buffer_as_ruby }, "Run the file as Ruby (saved first); its output in a new buffer")
209
+ reg_act("term.line.autoclose", proc { buf.execute_current_line_in_terminal(true) }, "Execute current line in terminal. Close after execution.")
210
+ reg_act("style.images", proc { hpt_scan_images() }, "Show images inserted with ⟦img:file.png⟧ syntax")
211
+ reg_act("file.delete", proc { bufs.delete_current_buffer() }, "Delete current file")
213
212
 
214
- reg_act(:audio_stop, proc { Audio.stop }, "Stop audio playback")
213
+ reg_act("audio.stop", proc { Audio.stop }, "Stop audio playback")
215
214
 
216
215
  act_list = {
217
216
  # File handling
218
- :buf_save => { :proc => proc { buf.save },
219
- :desc => "Save buffer", :group => :file },
220
-
221
- :buf_save_as => { :proc => proc { buf.save_as },
222
- :desc => "Save file as", :group => :file },
223
- :buf_new => { :proc => proc { create_new_file() }, :desc => "Create a new file", :group => :file },
224
- :buf_revert => { :proc => proc { buf.revert },
225
- :desc => "Reload file from disk", :group => :file },
226
- :buf_backup => { :proc => proc { buf.backup() }, :desc => "Backup current file", :group => :file },
217
+ "buf.save" => { :proc => proc { buf.save },
218
+ :desc => "Save buffer" },
227
219
 
228
- :edit_redo => { :proc => proc { buf.redo },
229
- :desc => "Redo edit", :group => :edit },
220
+ "buf.save.as" => { :proc => proc { buf.save_as },
221
+ :desc => "Save file as" },
222
+ "buf.new" => { :proc => proc { create_new_file() }, :desc => "Create a new file" },
223
+ "buf.revert" => { :proc => proc { buf.revert },
224
+ :desc => "Reload file from disk" },
225
+ "buf.backup" => { :proc => proc { buf.backup() }, :desc => "Backup current file" },
230
226
 
231
- :edit_undo => { :proc => proc { buf.undo },
232
- :desc => "Undo edit", :group => :edit },
227
+ "search.buf" => { :proc => proc { invoke_search },
228
+ :desc => "Find" },
233
229
 
234
- :find_in_buffer => { :proc => proc { invoke_search },
235
- :desc => "Find", :group => :edit },
230
+ "case.sel.upper" => { :proc => proc { buf.transform_selection(:upcase) },
231
+ :desc => "Transform text: upcase" },
236
232
 
237
- :selection_upcase => { :proc => proc { buf.transform_selection(:upcase) },
238
- :desc => "Transform text: upcase", :group => :edit },
233
+ "case.sel.lower" => { :proc => proc { buf.transform_selection(:downcase) },
234
+ :desc => "Transform text: downcase" },
239
235
 
240
- :selection_downcase => { :proc => proc { buf.transform_selection(:downcase) },
241
- :desc => "Transform text: downcase", :group => :edit },
236
+ "case.sel.capitalize" => { :proc => proc { buf.transform_selection(:capitalize) },
237
+ :desc => "Transform text: capitalize" },
242
238
 
243
- :selection_capitalize => { :proc => proc { buf.transform_selection(:capitalize) },
244
- :desc => "Transform text: capitalize", :group => :edit },
239
+ "case.sel.swap" => { :proc => proc { buf.transform_selection(:swapcase) },
240
+ :desc => "Transform text: swapcase" },
245
241
 
246
- :selection_swapcase => { :proc => proc { buf.transform_selection(:swapcase) },
247
- :desc => "Transform text: swapcase", :group => :edit },
242
+ "sel.reverse" => { :proc => proc { buf.transform_selection(:reverse) },
243
+ :desc => "Transform text: reverse" },
248
244
 
249
- :selection_reverse => { :proc => proc { buf.transform_selection(:reverse) },
250
- :desc => "Transform text: reverse", :group => :edit },
245
+ "sel.unindent" => { :proc => proc { buf.remove_indent_selection },
246
+ :desc => "Remove indentation from selected lines (or current line)" },
251
247
 
252
- :selection_remove_indent => { :proc => proc { buf.remove_indent_selection },
253
- :desc => "Remove indentation from selected lines (or current line)", :group => :edit },
248
+ "sel.unindent.common" => { :proc => proc { buf.remove_common_indent_selection },
249
+ :desc => "Remove indentation common to all selected lines (keeps relative indent)" },
254
250
 
255
- :selection_remove_common_indent => { :proc => proc { buf.remove_common_indent_selection },
256
- :desc => "Remove indentation common to all selected lines (keeps relative indent)", :group => :edit },
251
+ "case.word.upper" => { :proc => proc { buf.transform_range(:to_next_word, :upcase) },
252
+ :desc => "Upcase to start of next word (vim gUw)" },
257
253
 
258
- :word_upcase => { :proc => proc { buf.transform_range(:to_next_word, :upcase) },
259
- :desc => "Upcase to start of next word (vim gUw)", :group => :edit },
254
+ "case.word.lower" => { :proc => proc { buf.transform_range(:to_next_word, :downcase) },
255
+ :desc => "Downcase to start of next word (vim guw)" },
260
256
 
261
- :word_downcase => { :proc => proc { buf.transform_range(:to_next_word, :downcase) },
262
- :desc => "Downcase to start of next word (vim guw)", :group => :edit },
257
+ "case.word.swap" => { :proc => proc { buf.transform_range(:to_next_word, :swapcase) },
258
+ :desc => "Swap case to start of next word (vim g~w)" },
263
259
 
264
- :word_swapcase => { :proc => proc { buf.transform_range(:to_next_word, :swapcase) },
265
- :desc => "Swap case to start of next word (vim g~w)", :group => :edit },
260
+ "case.line.upper" => { :proc => proc { buf.transform_range(:line, :upcase) },
261
+ :desc => "Upcase current line (vim gUU)" },
266
262
 
267
- :line_upcase => { :proc => proc { buf.transform_range(:line, :upcase) },
268
- :desc => "Upcase current line (vim gUU)", :group => :edit },
263
+ "case.line.lower" => { :proc => proc { buf.transform_range(:line, :downcase) },
264
+ :desc => "Downcase current line (vim guu)" },
269
265
 
270
- :line_downcase => { :proc => proc { buf.transform_range(:line, :downcase) },
271
- :desc => "Downcase current line (vim guu)", :group => :edit },
266
+ "case.line.swap" => { :proc => proc { buf.transform_range(:line, :swapcase) },
267
+ :desc => "Swap case of current line (vim g~~)" },
272
268
 
273
- :line_swapcase => { :proc => proc { buf.transform_range(:line, :swapcase) },
274
- :desc => "Swap case of current line (vim g~~)", :group => :edit },
275
-
276
- :vim_toggle_case => { :proc => proc {
269
+ "case.char.toggle" => { :proc => proc {
277
270
  b = buf
278
271
  c = b.current_char
279
272
  if !c.nil? and c != "\n"
280
273
  b.replace_with_char(c.swapcase) # does not advance the cursor
281
274
  b.move(FORWARD_CHAR) # vim ~ advances, even on non-letters
282
275
  end
283
- }, :desc => "Toggle case of char and advance (vim ~)", :group => :edit },
284
-
285
- :forward_line => { :proc => proc { buf.move(FORWARD_LINE) },
286
- :desc => "Move one line forward", :group => [:move, :basic] },
276
+ }, :desc => "Toggle case of char and advance (vim ~)" },
287
277
 
288
- :backward_line => { :proc => proc { buf.move(BACKWARD_LINE) },
289
- :desc => "Move one line backward", :group => [:move, :basic] },
290
-
291
- :increment_word => { :proc => proc { buf.increment_current_word },
292
- :desc => "Increment word", :group => [:edit, :extra] },
278
+ "edit.word.increment" => { :proc => proc { buf.increment_current_word },
279
+ :desc => "Increment word" },
293
280
 
294
281
  # { :proc => proc { },
295
- # :desc => "", :group => : },
282
+ # :desc => "" },
296
283
 
297
- :search_actions => { :proc => proc { vma.actions.gui_search },
298
- :desc => "Search actions", :group => :search },
284
+ "search.actions" => { :proc => proc { vma.actions.gui_search },
285
+ :desc => "Search actions" },
299
286
 
300
- :edit_customrb => { :proc => proc { jump_to_file("~/.config/vimamsa/custom.rb") },
301
- :desc => "Customize (edit custom.rb)", :group => :search },
287
+ "app.customrb.edit" => { :proc => proc { jump_to_file(get_dot_path("custom.rb")) },
288
+ :desc => "Customize (edit custom.rb)" },
302
289
 
303
- :toggle_active_window => { :proc => proc { vma.gui.toggle_active_window },
304
- :desc => "Switch active column in two column mode", :group => :search },
290
+ "view.columns.switch" => { :proc => proc { vma.gui.toggle_active_window },
291
+ :desc => "Switch active column in two column mode" },
305
292
 
306
- :toggle_two_column => { :proc => proc { vma.gui.toggle_two_column },
307
- :desc => "Toggle two column mode", :group => :search },
293
+ "view.columns.toggle" => { :proc => proc { vma.gui.toggle_two_column },
294
+ :desc => "Toggle two column mode" },
308
295
 
309
- :content_search => { :proc => proc { FileContentSearch.start_gui },
310
- :desc => "Search content of files", :group => :search },
296
+ "grep.files" => { :proc => proc { FileContentSearch.start_gui },
297
+ :desc => "Search content of files" },
311
298
 
312
- :quit => { :proc => proc { _quit },
313
- :desc => "Quit", :group => :app },
299
+ "app.quit" => { :proc => proc { _quit },
300
+ :desc => "Quit" },
314
301
 
315
- :run_tests => { :proc => proc { run_tests },
302
+ "debug.tests" => { :proc => proc { run_tests },
316
303
  :desc => "Run tests" },
317
304
 
318
- :debug_buf_hex => { :proc => proc { puts "SHA256: " + (Digest::SHA2.hexdigest vma.buf.to_s) },
305
+ "debug.buf.sha256" => { :proc => proc { puts "SHA256: " + (Digest::SHA2.hexdigest vma.buf.to_s) },
319
306
  :desc => "Output SHA256 hex digest of curent buffer" },
320
307
 
321
- :autocp_manual_trigger => { :proc => proc { vma.buf.view.autocp_manual_trigger },
308
+ "edit.complete" => { :proc => proc { vma.buf.view.autocp_manual_trigger },
322
309
  :desc => "Trigger autocomplete" },
323
310
 
324
311
  }
@@ -327,6 +314,109 @@ for k, v in act_list
327
314
  reg_act(k, v[:proc], v[:desc])
328
315
  end
329
316
 
317
+ # ── Actions that were Ruby-code bindings (doc/action_names_plan.md step 6) ──
318
+ # An action bound to a "<char>" key gets the typed character as its argument
319
+ # (KeyBindingTree runs it as a.<id>!('<char>')).
320
+
321
+ reg_act("move.line.goto", proc { buf.jump_to_line() }, "Go to line <count>")
322
+ reg_act("move.line.first_char", proc { buf.jump(FIRST_NON_WHITESPACE) }, "Move to the first non-blank character of the line")
323
+ reg_act("move.page.next.quarter", proc { vma.gui.page_down(multip: 0.25) }, "Scroll down a quarter page")
324
+ reg_act("move.page.prev.quarter", proc { vma.gui.page_up(multip: 0.25) }, "Scroll up a quarter page")
325
+ reg_act("move.page.next.cursor", proc { buf.move(:forward_page) }, "Move the cursor to the bottom of the view and scroll")
326
+ reg_act("move.page.prev.cursor", proc { buf.move(:backward_page) }, "Move the cursor to the top of the view and scroll")
327
+ # Insert mode: a plain arrow key ends a shift-arrow selection
328
+ reg_act("move.char.next.unselect", proc { insert_move(FORWARD_CHAR) }, "Move forward one character, ending the selection")
329
+ reg_act("move.char.prev.unselect", proc { insert_move(BACKWARD_CHAR) }, "Move backward one character, ending the selection")
330
+ reg_act("move.line.next.unselect", proc { insert_move(FORWARD_LINE) }, "Move one line forward, ending the selection")
331
+ reg_act("move.line.prev.unselect", proc { insert_move(BACKWARD_LINE) }, "Move one line backward, ending the selection")
332
+ reg_act("move.page.next.unselect", proc { insert_move(:pagedown) }, "Page down, ending the selection")
333
+ reg_act("move.page.prev.unselect", proc { insert_move(:pageup) }, "Page up, ending the selection")
334
+ reg_act("move.line.start.unselect", proc { buf.end_selection; buf.jump(BEGINNING_OF_LINE) }, "Move to the beginning of the line, ending the selection")
335
+ reg_act("move.line.end.unselect", proc { buf.end_selection; buf.jump(END_OF_LINE) }, "Move to the end of the line, ending the selection")
336
+
337
+ reg_act("kbd.count.digit", proc { |c| vma.kbd.set_next_command_count(c) }, "Type a digit of the repeat count")
338
+
339
+ reg_act("jump.char.next", proc { |c| buf.jump_to_next_instance_of_char(c) }, "Jump to the next <char>")
340
+ reg_act("jump.char.prev", proc { |c| buf.jump_to_next_instance_of_char(c, BACKWARD) }, "Jump to the previous <char>")
341
+ reg_act("jump.space.next", proc { buf.jump_to_next_instance_of_char(" ") }, "Jump to the next space")
342
+ reg_act("jump.space.prev", proc { buf.jump_to_next_instance_of_char(" ", BACKWARD) }, "Jump to the previous space")
343
+ reg_act("jump.char.repeat", proc { repeat_last_find }, "Repeat the last character jump (f, F)")
344
+ reg_act("search.prev", proc { $search.jump_to_previous() }, "Find previous")
345
+ reg_act("search.word.next", proc { buf.jump_to_next_instance_of_word }, "Find the next occurrence of the word under the cursor")
346
+
347
+ reg_act("mode.insert.after", proc { buf.move(FORWARD_CHAR); vma.kbd.set_mode(:insert) }, "Switch to INSERT mode after the cursor")
348
+ reg_act("mode.insert.line.start", proc { buf.jump(FIRST_NON_WHITESPACE); vma.kbd.set_mode(:insert) }, "Switch to INSERT mode at the first non-blank character of the line")
349
+ reg_act("mode.insert.line.end", proc { buf.jump(END_OF_LINE); vma.kbd.set_mode(:insert) }, "Switch to INSERT mode at the end of the line")
350
+ reg_act("mode.insert.line.below", proc { buf.jump(END_OF_LINE); buf.insert_txt("\n"); vma.kbd.set_mode(:insert) }, "Open a new line below and switch to INSERT mode")
351
+ reg_act("mode.replace", proc { vma.kbd.set_mode(:replace) }, "Switch to REPLACE mode")
352
+ reg_act("mode.visual.exit", proc { buf.end_visual_mode }, "Leave VISUAL mode")
353
+ reg_act("mode.audio", proc { vma.kbd.set_mode(:audio) }, "Switch to audio playback mode")
354
+ reg_act("mode.browse.center", proc { center_on_current_line(); call_action("mode.browse.exit") }, "Center on the cursor line and leave browse mode")
355
+
356
+ reg_act("edit.insert.char", proc { |c| buf.insert_txt(c) }, "Insert <char>")
357
+ reg_act("edit.insert.space", proc { buf.insert_txt(" ") }, "Insert a space")
358
+ reg_act("edit.insert.password", proc { generate_password_to_buf(15) }, "Insert a random 15-character password")
359
+ reg_act("edit.tab", proc { buf.insert_tab }, "Insert a tab or spaces (indents the selection in VISUAL mode)")
360
+ reg_act("edit.untab", proc { buf.unindent }, "Unindent the current line one level")
361
+ reg_act("edit.line.below", proc { buf.jump(END_OF_LINE); buf.insert_txt("\n") }, "Insert an empty line below")
362
+ reg_act("edit.line.join", proc { buf.join_lines() }, "Join the next line to the current line")
363
+ reg_act("edit.copy.line.end", proc { buf.copy(:to_line_end) }, "Copy to the end of the line")
364
+ reg_act("edit.copy.line.start", proc { buf.copy(:to_line_start) }, "Copy to the start of the line")
365
+ reg_act("edit.copy.word.end", proc { buf.copy(:to_word_end) }, "Copy to the end of the word")
366
+ reg_act("edit.copy.word.next", proc { buf.copy(:to_next_word) }, "Copy to the start of the next word")
367
+ reg_act("edit.copy.mark", proc { |c| buf.copy(:to_mark, c) }, "Copy to mark <char>")
368
+ reg_act("edit.delete.mark", proc { |c| buf.delete2(:to_mark, c) }, "Delete to mark <char>")
369
+ reg_act("edit.delete.find.next", proc { |c| buf.delete2(:to_char, c) }, "Delete up to the next <char>")
370
+ reg_act("edit.delete.find.prev", proc { |c| buf.delete2(:to_char_backward, c) }, "Delete back to the previous <char>")
371
+ reg_act("edit.delete.space.next", proc { buf.delete2(:to_char, " ") }, "Delete up to the next space")
372
+ reg_act("edit.delete.space.prev", proc { buf.delete2(:to_char_backward, " ") }, "Delete back to the previous space")
373
+ reg_act("edit.replace.char", proc { |c| buf.replace_with_char(c) }, "Replace the character under the cursor with <char>")
374
+ reg_act("edit.replace.space", proc { buf.replace_with_char(" ") }, "Replace the character under the cursor with a space")
375
+ reg_act("edit.replace.char.next", proc { |c| buf.replace_with_char(c); buf.move(FORWARD_CHAR) }, "Replace the character under the cursor with <char> and move forward")
376
+ reg_act("edit.register", proc { |c| vma.set_register(c) }, "Use register <char> for the next copy, delete or paste")
377
+ reg_act("edit.paste.register", proc { |c| buf.paste(BEFORE, c) }, "Paste from register <char> before the cursor")
378
+ reg_act("edit.insert.register", proc { |c| buf.insert_register(c) }, "Insert the text of register <char>")
379
+ reg_act("edit.register.list", proc { show_registers }, "Show the registers")
380
+ reg_act("edit.comment.line", proc { buf.comment_line() }, "Comment the current line")
381
+ reg_act("edit.comment.line.off", proc { buf.comment_line(:uncomment) }, "Uncomment the current line")
382
+ reg_act("edit.comment.off", proc { buf.comment_selection(:uncomment) }, "Uncomment the selection")
383
+ reg_act("edit.complete.next", proc { vma.buf.view.autocp_select_next }, "Select the next completion")
384
+ reg_act("edit.complete.prev", proc { vma.buf.view.autocp_select_previous }, "Select the previous completion")
385
+ reg_act("edit.complete.accept", proc { vma.buf.view.autocp_select }, "Insert the selected completion")
386
+ reg_act("edit.complete.hide", proc { vma.buf.view.hide_completions }, "Hide the completion popup")
387
+
388
+ reg_act("sel.char.next", proc { insert_select_move(FORWARD_CHAR) }, "Extend the selection one character forward")
389
+ reg_act("sel.char.prev", proc { insert_select_move(BACKWARD_CHAR) }, "Extend the selection one character backward")
390
+ reg_act("sel.page.next", proc { insert_select_move(:pagedown) }, "Extend the selection a page down")
391
+ reg_act("sel.page.prev", proc { insert_select_move(:pageup) }, "Extend the selection a page up")
392
+ reg_act("sel.line.start", proc { buf.continue_selection; buf.jump(BEGINNING_OF_LINE) }, "Extend the selection to the beginning of the line")
393
+ reg_act("sel.line.end", proc { buf.continue_selection; buf.jump(END_OF_LINE) }, "Extend the selection to the end of the line")
394
+ reg_act("sel.delete", proc { buf.delete(SELECTION) }, "Delete the selection")
395
+ reg_act("sel.delete.append", proc { buf.delete(SELECTION, :append) }, "Delete the selection and append it to the clipboard")
396
+ reg_act("sel.copy.append", proc { buf.copy_active_selection(:append) }, "Append the selection to the clipboard")
397
+ reg_act("sel.indent.more", proc { buf.indent_selection }, "Indent the selected lines one level")
398
+ reg_act("sel.indent.less", proc { buf.unindent_selection }, "Unindent the selected lines one level")
399
+
400
+ reg_act("mark.set", proc { |c| buf.mark_current_position(c) }, "Set mark <char> at the cursor")
401
+ reg_act("mark.jump", proc { |c| buf.jump_to_mark(c) }, "Jump to mark <char>")
402
+
403
+ reg_act("macro.record", proc { |c| vma.kbd.set_mode(:macro); vma.macro.start_recording(c) }, "Record a macro into register <char>")
404
+ reg_act("macro.record.stop", proc { vma.kbd.to_previous_mode; vma.macro.end_recording }, "Stop recording the macro")
405
+ reg_act("macro.run", proc { |c| vma.macro.run_macro(c) }, "Run macro <char>")
406
+ reg_act("macro.save", proc { vma.macro.save }, "Save the recorded and named macros")
407
+ reg_act("macro.save.a", proc { vma.macro.save_macro("a") }, "Save macro a as a Ruby file")
408
+
409
+ reg_act("buf.switch.last", proc { bufs.switch_to_last_buf }, "Switch to the last used buffer")
410
+ reg_act("buf.close.scrap", proc { bufs.close_scrap_buffers }, "Close all buffers that have no file")
411
+ reg_act("buf.list.save", proc { save_buffer_list }, "Save the list of open buffers")
412
+ reg_act("buf.list.load", proc { load_buffer_list }, "Open the saved list of buffers")
413
+
414
+ reg_act("debug.deltas", proc { debug_dump_deltas }, "Print the change deltas of the buffer")
415
+ reg_act("debug.clipboard", proc { debug_dump_clipboard }, "Print the clipboard contents")
416
+ reg_act("debug.buf.print", proc { debug_print_buffer }, "Print the buffer object and its text")
417
+ reg_act("debug.overlay.clear", proc { vma.gui.clear_overlay }, "Clear the drawing overlay")
418
+ reg_act("debug.pry", proc { require "pry"; binding.pry }, "Open a pry console in the terminal")
419
+
330
420
  def gui_select_buffer_language
331
421
  lm = GtkSource::LanguageManager.new
332
422
  lm.set_search_path(lm.search_path << ppath("lang/"))