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
@@ -1,11 +1,5 @@
1
- def e_move_forward_char
2
- buf.move(FORWARD_CHAR)
3
- end
4
-
5
- def e_move_backward_char
6
- buf.move(BACKWARD_CHAR)
7
- end
8
1
 
2
+ module Vimamsa
9
3
  def history_switch_backwards
10
4
  bufs.history_switch_backwards
11
5
  end
@@ -19,238 +13,433 @@ def jump_to_next_edit
19
13
  end
20
14
 
21
15
 
22
- reg_act(:command_to_buf, proc { command_to_buf }, "Execute command, output to buffer")
23
-
24
- reg_act(:lsp_debug, proc { vma.buf.lsp_get_def }, "LSP get definition")
25
- reg_act(:lsp_jump_to_definition, proc { vma.buf.lsp_jump_to_def }, "LSP jump to definition")
26
-
27
- reg_act(:eval_buf, proc { vma.buf.eval_whole_buf }, "Eval whole current buffer as ruby code (DANGEROUS)")
28
-
29
- reg_act(:show_settings, proc { show_settings_dialog }, "Show settings")
30
- reg_act(:cut_selection, proc { buf.delete(SELECTION) }, "Cut selection to clipboard")
31
-
32
- reg_act(:insert_backspace, proc { buf.selection_active? ? buf.delete(SELECTION) : buf.delete(BACKWARD_CHAR) }, "Delete backwards")
33
- reg_act(:insert_select_up, proc { insert_select_move(BACKWARD_LINE) }, "Select texte upwards")
34
- reg_act(:insert_select_down, proc { insert_select_move(FORWARD_LINE) }, "Select text downwards")
35
-
36
- reg_act(:copy_selection, proc { buf.copy_active_selection }, "Copy selection to clipboard")
37
- reg_act(:enable_debug, proc { cnf.debug = true }, "Enable debug")
38
- reg_act(:disable_debug, proc { cnf.debug = false }, "Disable debug")
39
-
40
- reg_act(:experimental_eval, proc { bindkey "V , e", "vma.buf.convert_selected_text(:eval)" }, "Enable key binding:\"[VISUAL] , e:\" Eval selected text")
41
-
42
- reg_act(:easy_jump, proc { EasyJump.start }, "Easy jump")
43
- reg_act(:gui_ensure_cursor_visible, proc { vma.gui.view.ensure_cursor_visible }, "Scroll to current cursor position")
44
- reg_act(:gui_refresh_cursor, proc { vma.buf.refresh_cursor }, "Refresh cursor")
45
-
46
- reg_act(:savedebug, "savedebug", "Save debug info", { :group => :debug })
47
- reg_act(:open_file_dialog, "open_file_dialog", "Open file", { :group => :file })
48
- reg_act(:create_new_file, "create_new_file", "Create new file", { :group => :file })
49
- reg_act(:backup_all_buffers, proc { backup_all_buffers }, "Backup all buffers", { :group => :file })
50
- reg_act(:e_move_forward_char, "e_move_forward_char", "Move forward", { :group => [:move, :basic] })
51
- reg_act(:e_move_backward_char, "e_move_backward_char", "Move forward", { :group => [:move, :basic] })
52
- # reg_act(:history_switch_backwards, proc{bufs.history_switch_backwards}, "", { :group => :file })
53
- reg_act(:history_switch_backwards, proc { bufs.history_switch(-1) }, "Prev buffer", { :group => :file })
54
- reg_act(:history_switch_forwards, proc { bufs.history_switch(+1) }, "Next buffer", { :group => :file })
55
- reg_act(:print_buffer_access_list, proc { bufs.print_by_access_time }, "Print buffers by access time", { :group => :file })
56
- reg_act(:center_on_current_line, "center_on_current_line", "", { :group => :view })
57
- reg_act(:run_last_macro, proc { vma.macro.run_last_macro }, "Run last recorded or executed macro", { :group => :macro })
58
- reg_act(:jump_to_next_edit, "jump_to_next_edit", "Jump to next edit pos")
59
- reg_act(:jump_to_last_edit, proc { buf.jump_to_last_edit }, "Jump to last edit pos")
60
- reg_act(:jump_to_random, proc { buf.jump_to_random_pos }, "")
61
- reg_act(:insert_new_line, proc { buf.insert_new_line() }, "Insert new line")
62
- reg_act(:show_key_bindings, proc { show_key_bindings }, "Show key bindings")
63
- reg_act(:show_free_key_bindings, proc { show_free_key_bindings }, "Show available (unbound) key binding slots")
64
- reg_act(:put_file_path_to_clipboard, proc { buf.put_file_path_to_clipboard }, "Put file path of current file to clipboard")
65
- reg_act(:put_file_ref_to_clipboard, proc { buf.put_file_ref_to_clipboard }, "Put file ref of current file to clipboard")
66
-
67
- # reg_act(:encrypt_file, proc{buf.set_encrypted},"Set current file to encrypt on save")
68
- reg_act(:encrypt_file, proc { encrypt_cur_buffer }, "Set current file to encrypt on save")
69
- reg_act(:set_unencrypted, proc { buf.set_unencrypted }, "Set current file to save unencrypted")
70
- reg_act(:set_executable, proc { buf.set_executable }, "Set current file permissions to executable")
71
- # reg_act(:close_all_buffers, proc { bufs.close_all_buffers() }, "Close all buffers")
72
- reg_act(:close_current_buffer, proc { bufs.close_current_buffer(true) }, "Close current buffer")
73
- reg_act(:toggle_file_panel, proc { vma.gui.toggle_file_panel }, "Toggle file panel")
74
- reg_act(:show_message_history, proc { vma.gui.show_message_history }, "Show message history")
75
- reg_act(:toggle_func_panel, proc { vma.gui.toggle_func_panel }, "Toggle LSP function panel")
76
- reg_act(:refresh_func_panel, proc { vma.gui.func_panel_refresh }, "Refresh LSP function panel")
77
- reg_act(:git_diff_w, proc { git_diff_w }, "Show git diff -w for whole repository")
78
- reg_act(:lsp_print_functions, proc { lsp_print_functions }, "LSP print functions in current file")
79
- reg_act(:comment_selection, proc { buf.comment_selection }, "Comment selection")
80
- reg_act(:delete_char_forward, proc { buf.delete(CURRENT_CHAR_FORWARD) }, "Delete char forward", { :group => [:edit, :basic] })
81
- reg_act(:gui_file_finder, proc { vma.FileFinder.start_gui }, "Fuzzy file finder")
82
- reg_act(:gui_file_history_finder, proc { vma.FileHistory.start_gui }, "Fuzzy file history finder")
83
- reg_act(:gui_search_replace, proc { gui_search_replace }, "Search and replace")
84
- reg_act(:find_next, proc { $search.jump_to_next() }, "Find next")
85
-
86
- reg_act(:set_style_bold, proc { buf.style_transform(:bold) }, "Set text weight to bold")
87
- reg_act(:set_style_link, proc { buf.style_transform(:link) }, "Set text as link")
88
- reg_act(:V_join_lines, proc { vma.buf.convert_selected_text(:joinlines) }, "Join lines")
89
- reg_act(:clear_formats, proc { buf.style_transform(:clear) }, "Clear style formats")
90
- reg_act(:set_line_style_heading, proc { buf.set_line_style(:heading) }, "Set style of current line as heading")
91
- reg_act(:set_line_style_h1, proc { buf.set_line_style(:h1) }, "Set cur line as Heading 1")
92
- reg_act(:set_line_style_h2, proc { buf.set_line_style(:h2) }, "Set cur line as Heading 1")
93
- reg_act(:set_line_style_h3, proc { buf.set_line_style(:h3) }, "Set cur line as Heading 1")
94
- reg_act(:set_line_style_h4, proc { buf.set_line_style(:h4) }, "Set cur line as Heading 1")
95
- reg_act(:set_line_style_bold, proc { buf.set_line_style(:bold) }, "Set style of current line as bold")
96
- reg_act(:set_line_style_title, proc { buf.set_line_style(:title) }, "Set style of current line as title")
97
- reg_act(:clear_line_styles, proc { buf.set_line_style(:clear) }, "Clear styles of current line")
98
- reg_act(:gui_select_buffer, proc { vma.kbd.set_mode("S"); gui_select_buffer }, "Select buffer")
99
- reg_act :open_file_dialog, "open_file_dialog", "Open file"
100
- reg_act :minibuffer_end, proc { minibuffer_end }
101
- reg_act(:invoke_replace, "invoke_replace", "Invoke replace")
102
- reg_act(:diff_buffer, "diff_buffer", "")
103
- reg_act(:git_diff_buffer, proc { git_diff_buffer }, "Show git diff of current file")
104
- reg_act(:diff_buffer_jump_to_source, proc { diff_buffer_jump_to_source }, "Jump to corresponding line in source from diff buffer")
105
- # reg_act(:invoke_grep_search, proc{invoke_grep_search}, "")
106
- reg_act(:invoke_grep_search, proc { gui_grep }, "Grep current buffer")
107
- reg_act(:ack_search, proc { gui_ack }, "") #invoke_ack_search
108
- reg_act :update_file_index, proc { FileFinder.update_index }, "Update file index"
109
- reg_act :delete_to_word_end, proc { buf.delete2(:to_word_end) }, "Delete to file end", { :group => [:edit, :basic] }
110
- reg_act :delete_to_next_word_start, proc { buf.delete2(:to_next_word) }, "Delete to start of next word", { :group => [:edit, :basic] }
111
- reg_act :delete_to_line_start, proc { buf.delete2(:to_line_start) }, "Delete to line start", { :group => [:edit, :basic] }
112
-
113
- reg_act(:ack_search, proc { gui_ack }, "Ack")
114
-
115
- reg_act(:copy_cur_line, proc { buf.copy_line }, "Copy the current line")
116
- reg_act(:paste_before_cursor, proc { buf.paste(BEFORE) }, "Paste text before the cursor")
117
- reg_act(:paste_after_cursor, proc { buf.paste(AFTER) }, "Paste text after the cursor")
118
- reg_act(:paste_over_after, proc { buf.paste_over(AFTER) }, "Paste over selection or after cursor")
119
- reg_act(:paste_over_before, proc { buf.paste_over(BEFORE) }, "Paste over selection or before cursor")
120
- reg_act(:redo, proc { buf.redo() }, "Redo the last undone action")
121
- reg_act(:undo, proc { buf.undo() }, "Undo the last action")
122
- reg_act(:jump_end_of_line, proc { buf.jump(END_OF_LINE) }, "Move to the end of the current line")
123
- reg_act(:jump_end_of_buffer, proc { buf.jump(END_OF_BUFFER) }, "Move to the end of the buffer")
124
- reg_act(:jump_start_of_buffer, proc { buf.jump(START_OF_BUFFER) }, "Move to the start of the buffer")
125
- reg_act(:jump_beginning_of_line, proc { buf.jump(BEGINNING_OF_LINE) }, "Move to the beginning of the current line")
126
- reg_act(:jump_next_word_end, proc { buf.jump_word(FORWARD, WORD_END) }, "Jump to the end of the next word")
127
- reg_act(:jump_prev_word_start, proc { buf.jump_word(BACKWARD, WORD_START) }, "Jump to the start of the previous word")
128
- reg_act(:jump_next_word_start, proc { buf.jump_word(FORWARD, WORD_START) }, "Jump to the start of the next word")
129
- reg_act(:insert_mode, proc { vma.kbd.set_mode(:insert) }, "Switch to INSERT mode")
130
- reg_act(:prev_mode, proc { vma.kbd.to_previous_mode }, "Return to the previous mode")
131
- reg_act(:move_prev_line, proc { buf.move(BACKWARD_LINE) }, "Move the cursor to the previous line")
132
- reg_act(:move_next_line, proc { buf.move(FORWARD_LINE) }, "Move the cursor to the next line")
133
- reg_act(:move_backward_char, proc { buf.move(BACKWARD_CHAR) }, "Move one character backward")
134
- reg_act(:start_visual_mode, proc { buf.start_selection; vma.kbd.set_mode(:visual) }, "Enter VISUAL mode (for selections)")
135
- reg_act(:jump_last_edit, proc { buf.jump_to_last_edit }, "Jump to the last edit location")
136
- reg_act(:install_demo_files, proc { install_demo_files }, "Install and show Demo")
137
- reg_act(:reload_customrb, proc { reload_customrb }, "Reload custom.rb")
138
-
139
- reg_act :start_browse_mode, proc {
16
+ reg_act("debug.command", proc { command_to_buf }, "Execute command, output to buffer")
17
+
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 },
21
+ "LSP: restart the language server of the current file (e.g. after adding compile_flags.txt)")
22
+
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 {
115
+ links = buf.file_links
116
+ if links.empty?
117
+ message("No links to existing files")
118
+ else
119
+ # One absolute path per line: enter on a line opens the file
120
+ create_new_buffer(links.join("\n") + "\n", "filelinks")
121
+ message("#{links.size} file link(s)")
122
+ end
123
+ }, "Extract links to existing files from current file into a new buffer")
124
+ reg_act("jump.file", proc {
125
+ # Like vim gf, and the "Open file" items of the right-click menu
126
+ fn = buf.file_path_at(buf.pos)
127
+ if fn.nil?
128
+ message("No file under cursor")
129
+ elsif file_is_text_file(fn)
130
+ open_new_file(fn)
131
+ else
132
+ open_with_default_program(fn)
133
+ end
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
+ cnf.autocomplete.enabled = !(cnf.autocomplete.enabled? != false)
179
+ vma.buf&.view&.hide_completions unless cnf.autocomplete.enabled?
180
+ message("Autocomplete: #{cnf.autocomplete.enabled? ? "ON" : "OFF"}")
181
+ }, "Toggle autocomplete on/off")
182
+
183
+ reg_act("app.restart", proc { restart_editor }, "Restart: quit, reload config and reopen files")
184
+
185
+ reg_act "mode.browse", proc {
140
186
  vma.kbd.set_mode(:browse)
141
187
  bufs.reset_navigation
142
188
  }, "Start browse mode"
143
- reg_act :kbd_dump_state, proc { vma.kbd.dump_state }, "Dump keyboard tree state"
144
- 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 {
145
191
  vma.gui.instance_variable_set(:@kbd_passthrough, !vma.gui.instance_variable_get(:@kbd_passthrough))
146
192
  state = vma.gui.instance_variable_get(:@kbd_passthrough) ? "ON" : "OFF"
147
193
  message("Keyboard passthrough: #{state}")
148
194
  }, "Toggle keyboard event passthrough (allow other widgets to receive key events)"
149
195
 
150
- reg_act :exit_browse_mode, proc {
196
+ reg_act "mode.browse.exit", proc {
151
197
  bufs.add_current_buf_to_history
152
198
  # Load previously saved buffer specific mode stack
153
199
  buf.restore_kbd_mode
154
200
  }, "Exit browse mode"
155
201
 
156
- # reg_act :page_down, proc { page_down }, "Page down", :group => [:move, :basic]
157
- 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"
158
204
 
159
- reg_act :page_up, proc { vma.gui.page_up }, "Page up", :group => [:move, :basic]
160
- reg_act :jump_to_start_of_buffer, proc { buf.jump(START_OF_BUFFER) }, "Jump to start of buffer"
161
- reg_act :jump_to_end_of_buffer, proc { buf.jump(END_OF_BUFFER) }, "Jump to end of buffer"
162
- reg_act(:auto_indent_buffer, proc { buf.indent }, "Auto format buffer")
163
- reg_act(:execute_current_line_in_terminal, proc { buf.execute_current_line_in_terminal }, "Execute current line in terminal")
164
- reg_act(:execute_current_line_in_terminal_autoclose, proc { buf.execute_current_line_in_terminal(true) }, "Execute current line in terminal. Close after execution.")
165
- reg_act(:show_images, proc { hpt_scan_images() }, "Show images inserted with ⟦img:file.png⟧ syntax")
166
- 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")
167
212
 
168
- reg_act(:audio_stop, proc { Audio.stop }, "Stop audio playback")
213
+ reg_act("audio.stop", proc { Audio.stop }, "Stop audio playback")
169
214
 
170
215
  act_list = {
171
216
  # File handling
172
- :buf_save => { :proc => proc { buf.save },
173
- :desc => "Save buffer", :group => :file },
217
+ "buf.save" => { :proc => proc { buf.save },
218
+ :desc => "Save buffer" },
219
+
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" },
226
+
227
+ "search.buf" => { :proc => proc { invoke_search },
228
+ :desc => "Find" },
229
+
230
+ "case.sel.upper" => { :proc => proc { buf.transform_selection(:upcase) },
231
+ :desc => "Transform text: upcase" },
174
232
 
175
- :buf_save_as => { :proc => proc { buf.save_as },
176
- :desc => "Save file as", :group => :file },
177
- :buf_new => { :proc => proc { create_new_file() }, :desc => "Create a new file", :group => :file },
178
- :buf_revert => { :proc => proc { buf.revert },
179
- :desc => "Reload file from disk", :group => :file },
180
- :buf_backup => { :proc => proc { buf.backup() }, :desc => "Backup current file", :group => :file },
233
+ "case.sel.lower" => { :proc => proc { buf.transform_selection(:downcase) },
234
+ :desc => "Transform text: downcase" },
181
235
 
182
- :edit_redo => { :proc => proc { buf.redo },
183
- :desc => "Redo edit", :group => :edit },
236
+ "case.sel.capitalize" => { :proc => proc { buf.transform_selection(:capitalize) },
237
+ :desc => "Transform text: capitalize" },
184
238
 
185
- :edit_undo => { :proc => proc { buf.undo },
186
- :desc => "Undo edit", :group => :edit },
239
+ "case.sel.swap" => { :proc => proc { buf.transform_selection(:swapcase) },
240
+ :desc => "Transform text: swapcase" },
187
241
 
188
- :find_in_buffer => { :proc => proc { invoke_search },
189
- :desc => "Find", :group => :edit },
242
+ "sel.reverse" => { :proc => proc { buf.transform_selection(:reverse) },
243
+ :desc => "Transform text: reverse" },
190
244
 
191
- :selection_upcase => { :proc => proc { buf.transform_selection(:upcase) },
192
- :desc => "Transform text: upcase", :group => :edit },
245
+ "sel.unindent" => { :proc => proc { buf.remove_indent_selection },
246
+ :desc => "Remove indentation from selected lines (or current line)" },
193
247
 
194
- :selection_downcase => { :proc => proc { buf.transform_selection(:downcase) },
195
- :desc => "Transform text: downcase", :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)" },
196
250
 
197
- :selection_capitalize => { :proc => proc { buf.transform_selection(:capitalize) },
198
- :desc => "Transform text: capitalize", :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)" },
199
253
 
200
- :selection_swapcase => { :proc => proc { buf.transform_selection(:swapcase) },
201
- :desc => "Transform text: swapcase", :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)" },
202
256
 
203
- :selection_reverse => { :proc => proc { buf.transform_selection(:reverse) },
204
- :desc => "Transform text: reverse", :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)" },
205
259
 
206
- :forward_line => { :proc => proc { buf.move(FORWARD_LINE) },
207
- :desc => "Move one line forward", :group => [:move, :basic] },
260
+ "case.line.upper" => { :proc => proc { buf.transform_range(:line, :upcase) },
261
+ :desc => "Upcase current line (vim gUU)" },
208
262
 
209
- :backward_line => { :proc => proc { buf.move(BACKWARD_LINE) },
210
- :desc => "Move one line backward", :group => [:move, :basic] },
263
+ "case.line.lower" => { :proc => proc { buf.transform_range(:line, :downcase) },
264
+ :desc => "Downcase current line (vim guu)" },
211
265
 
212
- :increment_word => { :proc => proc { buf.increment_current_word },
213
- :desc => "Increment word", :group => [:edit, :extra] },
266
+ "case.line.swap" => { :proc => proc { buf.transform_range(:line, :swapcase) },
267
+ :desc => "Swap case of current line (vim g~~)" },
268
+
269
+ "case.char.toggle" => { :proc => proc {
270
+ b = buf
271
+ c = b.current_char
272
+ if !c.nil? and c != "\n"
273
+ b.replace_with_char(c.swapcase) # does not advance the cursor
274
+ b.move(FORWARD_CHAR) # vim ~ advances, even on non-letters
275
+ end
276
+ }, :desc => "Toggle case of char and advance (vim ~)" },
277
+
278
+ "edit.word.increment" => { :proc => proc { buf.increment_current_word },
279
+ :desc => "Increment word" },
214
280
 
215
281
  # { :proc => proc { },
216
- # :desc => "", :group => : },
282
+ # :desc => "" },
217
283
 
218
- :search_actions => { :proc => proc { vma.actions.gui_search },
219
- :desc => "Search actions", :group => :search },
284
+ "search.actions" => { :proc => proc { vma.actions.gui_search },
285
+ :desc => "Search actions" },
220
286
 
221
- :edit_customrb => { :proc => proc { jump_to_file("~/.config/vimamsa/custom.rb") },
222
- :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)" },
223
289
 
224
- :toggle_active_window => { :proc => proc { vma.gui.toggle_active_window },
225
- :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" },
226
292
 
227
- :toggle_two_column => { :proc => proc { vma.gui.toggle_two_column },
228
- :desc => "Toggle two column mode", :group => :search },
293
+ "view.columns.toggle" => { :proc => proc { vma.gui.toggle_two_column },
294
+ :desc => "Toggle two column mode" },
229
295
 
230
- :content_search => { :proc => proc { FileContentSearch.start_gui },
231
- :desc => "Search content of files", :group => :search },
296
+ "grep.files" => { :proc => proc { FileContentSearch.start_gui },
297
+ :desc => "Search content of files" },
232
298
 
233
- :quit => { :proc => proc { _quit },
234
- :desc => "Quit", :group => :app },
299
+ "app.quit" => { :proc => proc { _quit },
300
+ :desc => "Quit" },
235
301
 
236
- :run_tests => { :proc => proc { run_tests },
302
+ "debug.tests" => { :proc => proc { run_tests },
237
303
  :desc => "Run tests" },
238
304
 
239
- :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) },
240
306
  :desc => "Output SHA256 hex digest of curent buffer" },
241
307
 
242
- :start_autocomplete => { :proc => proc { vma.buf.view.start_autocomplete },
243
- :desc => "Start autocomplete" },
244
-
245
- :show_autocomplete => { :proc => proc {
246
- # vma.buf.view.signal_emit("show-completion")
247
- # vma.buf.view.show_completion
248
- vma.buf.view.show_completions
249
- },
250
- :desc => "Show autocomplete" },
308
+ "edit.complete" => { :proc => proc { vma.buf.view.autocp_manual_trigger },
309
+ :desc => "Trigger autocomplete" },
251
310
 
252
311
  }
253
312
 
254
313
  for k, v in act_list
255
314
  reg_act(k, v[:proc], v[:desc])
256
315
  end
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
+
420
+ def gui_select_buffer_language
421
+ lm = GtkSource::LanguageManager.new
422
+ lm.set_search_path(lm.search_path << ppath("lang/"))
423
+ all_lang_ids = lm.language_ids.sort
424
+ @_lang_select_list = all_lang_ids
425
+
426
+ update_callback = proc do |search_str|
427
+ filtered = search_str.empty? ? all_lang_ids : all_lang_ids.select { |id| id.include?(search_str.downcase) }
428
+ @_lang_select_list = filtered
429
+ filtered.map { |id| [id] }
430
+ end
431
+
432
+ select_callback = proc do |_str, idx|
433
+ gui_select_window_close(0)
434
+ vma.buf.set_language(@_lang_select_list[idx])
435
+ end
436
+
437
+ opt = {
438
+ :title => "Select language",
439
+ :columns => [{ :title => "Language", :id => 0 }],
440
+ }
441
+
442
+ gui_select_update_window(all_lang_ids.map { |id| [id] }, [], select_callback, update_callback, opt)
443
+ end
444
+
445
+ end # module Vimamsa