vimamsa 0.1.26 → 0.1.27

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 (170) 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 +62 -16
  6. data/custom_example.rb +43 -13
  7. data/doc/TODO.md +461 -0
  8. data/doc/bundling_plan.md +569 -0
  9. data/doc/key_bindings_report_plan.md +168 -0
  10. data/doc/missing_vim_bindings.md +71 -0
  11. data/doc/modules_settings_plan.md +433 -0
  12. data/doc/refactor_dedup_plan.md +117 -0
  13. data/doc/unused_code_plan.md +120 -0
  14. data/doc/vim_compatibility_plan.md +296 -0
  15. data/doc/vimlike_vim_conflicts.md +254 -0
  16. data/doc/vm_snapshots_plan.md +146 -0
  17. data/exe/run_tests.rb +117 -3
  18. data/exe/vimamsa +24 -4
  19. data/fonts/OFL-Oxanium.txt +93 -0
  20. data/fonts/Oxanium[wght].ttf +0 -0
  21. data/icon.png +0 -0
  22. data/img/demo.gif +0 -0
  23. data/lang/hyperplaintext.lang +6 -0
  24. data/lib/vimamsa/ack.rb +11 -1
  25. data/lib/vimamsa/actions.rb +4 -1
  26. data/lib/vimamsa/appimage_env.rb +35 -0
  27. data/lib/vimamsa/audio.rb +2 -5
  28. data/lib/vimamsa/bookmarks.rb +302 -0
  29. data/lib/vimamsa/buffer.rb +593 -82
  30. data/lib/vimamsa/buffer_changetext.rb +102 -42
  31. data/lib/vimamsa/buffer_cursor.rb +7 -0
  32. data/lib/vimamsa/buffer_list.rb +4 -0
  33. data/lib/vimamsa/buffer_manager.rb +4 -1
  34. data/lib/vimamsa/bundled_fonts.rb +32 -0
  35. data/lib/vimamsa/clipboard.rb +3 -0
  36. data/lib/vimamsa/conf.rb +59 -3
  37. data/lib/vimamsa/constants.rb +3 -0
  38. data/lib/vimamsa/crash_handler.rb +149 -0
  39. data/lib/vimamsa/debug.rb +4 -1
  40. data/lib/vimamsa/desktop_install.rb +96 -0
  41. data/lib/vimamsa/diff_buffer.rb +39 -10
  42. data/lib/vimamsa/easy_jump.rb +3 -0
  43. data/lib/vimamsa/editor.rb +263 -57
  44. data/lib/vimamsa/encrypt.rb +78 -29
  45. data/lib/vimamsa/file_finder.rb +4 -19
  46. data/lib/vimamsa/file_history.rb +3 -0
  47. data/lib/vimamsa/file_manager.rb +30 -15
  48. data/lib/vimamsa/fold.rb +226 -0
  49. data/lib/vimamsa/gui.rb +520 -106
  50. data/lib/vimamsa/gui_command_line.rb +208 -0
  51. data/lib/vimamsa/gui_dialog.rb +94 -42
  52. data/lib/vimamsa/gui_file_panel.rb +356 -25
  53. data/lib/vimamsa/gui_form_generator.rb +59 -35
  54. data/lib/vimamsa/gui_func_panel.rb +67 -22
  55. data/lib/vimamsa/gui_image.rb +3 -0
  56. data/lib/vimamsa/gui_keylog_panel.rb +246 -0
  57. data/lib/vimamsa/gui_menu.rb +23 -11
  58. data/lib/vimamsa/gui_select_window.rb +19 -48
  59. data/lib/vimamsa/gui_settings.rb +78 -37
  60. data/lib/vimamsa/gui_sourceview.rb +273 -19
  61. data/lib/vimamsa/gui_sourceview_autocomplete.rb +319 -90
  62. data/lib/vimamsa/gui_text.rb +63 -2
  63. data/lib/vimamsa/gui_theme.rb +606 -0
  64. data/lib/vimamsa/hook.rb +3 -0
  65. data/lib/vimamsa/hyper_plain_text.rb +3 -0
  66. data/lib/vimamsa/key_actions.rb +112 -13
  67. data/lib/vimamsa/key_binding_tree.rb +242 -215
  68. data/lib/vimamsa/key_bindings_notepad.rb +43 -0
  69. data/lib/vimamsa/key_bindings_report.rb +261 -0
  70. data/lib/vimamsa/key_bindings_vim.rb +354 -0
  71. data/lib/vimamsa/key_bindings_vimlike.rb +65 -9
  72. data/lib/vimamsa/langservp.rb +271 -54
  73. data/lib/vimamsa/macro.rb +3 -0
  74. data/lib/vimamsa/main.rb +14 -8
  75. data/lib/vimamsa/rbvma.rb +26 -1
  76. data/lib/vimamsa/search.rb +3 -0
  77. data/lib/vimamsa/search_replace.rb +11 -10
  78. data/lib/vimamsa/string_util.rb +120 -40
  79. data/lib/vimamsa/terminal.rb +3 -0
  80. data/lib/vimamsa/test_framework.rb +28 -2
  81. data/lib/vimamsa/tests.rb +3 -0
  82. data/lib/vimamsa/text_objects.rb +353 -0
  83. data/lib/vimamsa/text_transforms.rb +14 -0
  84. data/lib/vimamsa/util.rb +46 -7
  85. data/lib/vimamsa/version.rb +1 -1
  86. data/lib/vimamsa.rb +0 -1
  87. data/modules/color_highlight/color_highlight.rb +118 -0
  88. data/modules/color_highlight/color_highlight_info.rb +3 -0
  89. data/modules/dictation/dictation.rb +1054 -0
  90. data/modules/dictation/dictation_info.rb +3 -0
  91. data/modules/dictation/whisper_worker.py +273 -0
  92. data/modules/ollama/ollama.rb +107 -0
  93. data/modules/ollama/ollama_info.rb +3 -0
  94. data/modules/tts/tts.rb +119 -0
  95. data/modules/tts/tts_info.rb +3 -0
  96. data/run_e2e_vm.sh +28 -0
  97. data/run_tests_vm.sh +130 -0
  98. data/scripts/appimage/AppRun +54 -0
  99. data/scripts/appimage/Dockerfile +18 -0
  100. data/scripts/appimage/build.sh +19 -0
  101. data/scripts/appimage/build_in_container.sh +192 -0
  102. data/scripts/appimage/smoke_test.sh +27 -0
  103. data/scripts/demo/demo_steps.txt +59 -0
  104. data/scripts/demo/record_demo.rb +177 -0
  105. data/scripts/demo/shapes.rb +28 -0
  106. data/styles/134272-molokai.xml +3 -0
  107. data/styles/molokai_cyber.xml +48 -0
  108. data/styles/molokai_edit.xml +1 -0
  109. data/tests/support/virtual_keyboard.rb +254 -0
  110. data/tests/support/virtual_mic.rb +67 -0
  111. data/tests/test_ack.rb +22 -0
  112. data/tests/test_auto_format.rb +122 -0
  113. data/tests/test_autocomplete.rb +211 -0
  114. data/tests/test_autosave.rb +145 -0
  115. data/tests/test_basic_editing.rb +33 -3
  116. data/tests/test_bookmarks.rb +206 -0
  117. data/tests/test_bracket_match.rb +85 -0
  118. data/tests/test_bundling.rb +92 -0
  119. data/tests/test_color_highlight.rb +92 -0
  120. data/tests/test_command_line.rb +79 -0
  121. data/tests/test_command_line_file.rb +27 -0
  122. data/tests/test_context_menu_file.rb +129 -0
  123. data/tests/test_copy_paste.rb +80 -0
  124. data/tests/test_crash_handler.rb +39 -0
  125. data/tests/test_custom_two_phase.rb +92 -0
  126. data/tests/test_dialog_callback_errors.rb +44 -0
  127. data/tests/test_dictation.rb +294 -0
  128. data/tests/test_diff_buffer_name.rb +51 -0
  129. data/tests/test_double_click.rb +41 -0
  130. data/tests/test_drag_selection.rb +125 -0
  131. data/tests/test_e2e_cmdline.rb +116 -0
  132. data/tests/test_e2e_dictation.rb +98 -0
  133. data/tests/test_e2e_replace_char.rb +58 -0
  134. data/tests/test_extract_file_links.rb +55 -0
  135. data/tests/test_file_format.rb +217 -0
  136. data/tests/test_file_manager.rb +72 -0
  137. data/tests/test_file_panel.rb +269 -0
  138. data/tests/test_flash.rb +78 -0
  139. data/tests/test_fold.rb +111 -0
  140. data/tests/test_font_refresh.rb +56 -0
  141. data/tests/test_func_panel.rb +68 -0
  142. data/tests/test_grep_apply.rb +46 -0
  143. data/tests/test_gtk_sync.rb +126 -0
  144. data/tests/test_hpt_highlight_visible.rb +75 -0
  145. data/tests/test_hpt_link_highlight.rb +82 -0
  146. data/tests/test_jump_to_file.rb +41 -0
  147. data/tests/test_key_bindings.rb +208 -0
  148. data/tests/test_keylog_panel.rb +101 -0
  149. data/tests/test_lsp_clangd.rb +281 -0
  150. data/tests/test_lsp_jump.rb +87 -0
  151. data/tests/test_lsp_position_encoding.rb +49 -0
  152. data/tests/test_lsp_symbols.rb +68 -0
  153. data/tests/test_macro.rb +137 -0
  154. data/tests/test_markdown_highlight.rb +57 -0
  155. data/tests/test_mode_badge.rb +41 -0
  156. data/tests/test_notepad_bindings.rb +67 -0
  157. data/tests/test_popup_queue.rb +51 -0
  158. data/tests/test_random_edit.rb +109 -0
  159. data/tests/test_revert.rb +127 -0
  160. data/tests/test_startup_file.rb +58 -0
  161. data/tests/test_status_area.rb +50 -0
  162. data/tests/test_text_objects.rb +163 -0
  163. data/tests/test_text_transforms.rb +329 -0
  164. data/tests/test_tts.rb +68 -0
  165. data/tests/test_vim_bindings.rb +252 -0
  166. data/tests/test_vim_conflicts.rb +63 -0
  167. data/tests/test_window_layout.rb +219 -0
  168. data/vimamsa.gemspec +3 -1
  169. data/vm_guest_run.sh +109 -0
  170. metadata +112 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 65bf166a03bdc844a703bbb423e80eee58b65da2aea57039727929c04a6cca79
4
- data.tar.gz: 9ee3ebab2b820f77992defb5f435451b9bb40e57cf4062ce9636a36622abfcf6
3
+ metadata.gz: 30dc038cb0e2f120cf8952d943f181a915d76627c4e9f788b5c1b5928b266229
4
+ data.tar.gz: b4c8cb93244fa18791cb85ffcbfd91949fd146b6afe498527d45777e7a11b5f8
5
5
  SHA512:
6
- metadata.gz: 20fba0fe91e750581930bd4fd6c804774c67d625ee6811380e6006856e1dd8e2ffdb41227233d600e81756e2db9edc49251d7fba4f917a7a517ef68add7725fe
7
- data.tar.gz: 953f3d3d7590f4e87c5723f7351ffddcd8f9e6031b7683007312397418468c2232edca42fbcd424bea3929e4af9fc8cec326158c543d19407601d637ff7c37dd
6
+ metadata.gz: c6e79f3ffbe2b42638d1ad659dced6ff1924339b18090c278c2e96e220471857344d0a2777e484d8776a2c6acd56b1f9c73ebc829e56f1da3f88603bbe56df4e
7
+ data.tar.gz: 3ea0451e5d26c8439e92a6faa0e2d57868dbaa747126217c4a03c7069b94cf7304a9ebca7999a77e66439356b18c90fb139d88ef7beb8a1a66c0fa650270afd9
@@ -0,0 +1,93 @@
1
+ # Builds the AppImage on GitHub's runners (scripts/appimage, doc/bundling_plan.md).
2
+ # - Push a tag vX.Y.Z (matching lib/vimamsa/version.rb): build, test on a clean
3
+ # Ubuntu, sign a build provenance attestation and attach the AppImage to the
4
+ # GitHub release for that tag.
5
+ # - Run it by hand (Actions ▸ AppImage ▸ Run workflow): build and test only;
6
+ # the AppImage is kept as a workflow artifact.
7
+ name: AppImage
8
+
9
+ on:
10
+ push:
11
+ tags: ["v*"]
12
+ workflow_dispatch:
13
+
14
+ permissions:
15
+ contents: write # create the release and upload the file
16
+ id-token: write # sign the attestation
17
+ attestations: write
18
+
19
+ jobs:
20
+ appimage:
21
+ runs-on: ubuntu-24.04
22
+ timeout-minutes: 60
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+ with:
26
+ fetch-depth: 0 # the build clones this checkout; avoid a shallow source
27
+
28
+ - name: Check the tag matches the version
29
+ if: github.ref_type == 'tag'
30
+ run: |
31
+ v=$(ruby -Ilib -e 'require "vimamsa/version"; print Vimamsa::VERSION')
32
+ if [ "v$v" != "$GITHUB_REF_NAME" ]; then
33
+ echo "::error::tag $GITHUB_REF_NAME but lib/vimamsa/version.rb says $v"
34
+ exit 1
35
+ fi
36
+
37
+ # The compiled Ruby and the pinned appimagetool/runtime (all checked by
38
+ # the build script); gems and libraries are always built fresh
39
+ - uses: actions/cache@v4
40
+ with:
41
+ path: build/appimage/cache
42
+ key: appimage-cache-${{ hashFiles('scripts/appimage/Dockerfile', 'scripts/appimage/build_in_container.sh') }}
43
+
44
+ - name: Build
45
+ run: scripts/appimage/build.sh
46
+
47
+ - name: Test on a clean Ubuntu 24.04
48
+ run: scripts/appimage/smoke_test.sh build/appimage/Vimamsa-*-x86_64.AppImage
49
+
50
+ # One file name for every release, so the README can link to
51
+ # releases/latest/download/Vimamsa-x86_64.AppImage
52
+ - name: Name the file
53
+ run: |
54
+ mkdir -p dist
55
+ cp build/appimage/Vimamsa-*-x86_64.AppImage dist/Vimamsa-x86_64.AppImage
56
+ (cd dist && sha256sum Vimamsa-x86_64.AppImage > Vimamsa-x86_64.AppImage.sha256)
57
+
58
+ - name: Attest build provenance
59
+ if: github.ref_type == 'tag'
60
+ uses: actions/attest-build-provenance@v2
61
+ with:
62
+ subject-path: dist/Vimamsa-x86_64.AppImage
63
+
64
+ - name: Attach to the release
65
+ if: github.ref_type == 'tag'
66
+ env:
67
+ GH_TOKEN: ${{ github.token }}
68
+ run: |
69
+ notes="Download \`Vimamsa-x86_64.AppImage\`, make it executable and run it:
70
+
71
+ \`\`\`
72
+ chmod +x Vimamsa-x86_64.AppImage
73
+ ./Vimamsa-x86_64.AppImage
74
+ \`\`\`
75
+
76
+ Needs x86_64 Linux with glibc 2.39 or newer (Ubuntu 24.04, Fedora 40, Debian 13 or newer).
77
+
78
+ Built by GitHub Actions from this tag. To check that the file came from this repository's workflow:
79
+ \`gh attestation verify Vimamsa-x86_64.AppImage --repo $GITHUB_REPOSITORY\`"
80
+ if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then
81
+ gh release upload "$GITHUB_REF_NAME" dist/* --clobber
82
+ else
83
+ gh release create "$GITHUB_REF_NAME" dist/* --title "Vimamsa ${GITHUB_REF_NAME#v}" \
84
+ --notes "$notes" --generate-notes
85
+ fi
86
+
87
+ - name: Keep as a workflow artifact
88
+ if: github.ref_type != 'tag'
89
+ uses: actions/upload-artifact@v4
90
+ with:
91
+ name: Vimamsa-x86_64.AppImage
92
+ path: dist/
93
+ retention-days: 14
data/.gitignore CHANGED
@@ -2,7 +2,10 @@
2
2
  /.yardoc
3
3
  /_yardoc/
4
4
  /coverage/
5
- /doc/
6
5
  /pkg/
7
6
  /spec/reports/
8
7
  /tmp/
8
+ /build/
9
+
10
+ # Vimamsa editor autosave files (.<name>_vma_autosave)
11
+ *_vma_autosave
data/Dockerfile CHANGED
@@ -36,10 +36,13 @@ RUN gem install bundler -v '~> 2.4'
36
36
 
37
37
  RUN echo "alias ll='ls -ltrh'" >> ~/.bashrc
38
38
  ARG CACHE_BUST=1
39
- RUN git clone https://github.com/SamiSieranoja/vimamsa.git && cd vimamsa && gem build vimamsa.gemspec && gem install vimamsa-0.1.*.gem
40
- RUN cp /usr/local/bundle/gems/vimamsa-0.1.23/ext/vmaext/vmaext.so vimamsa/lib/
39
+ RUN git clone https://github.com/SamiSieranoja/vimamsa.git && cd vimamsa && gem build vimamsa.gemspec && gem install vimamsa-*.gem
41
40
 
42
- WORKDIR /app/vimamsa
43
- CMD ["bash", "-c", "xvfb-run -a ruby run_tests.rb 2>&1"]
41
+ # Tests should not depend on writing to these directories
42
+ RUN chmod a-w -R /usr/local/bundle/gems/vimamsa*
43
+ RUN chmod a-w -R vimamsa
44
+
45
+ CMD ["bash", "-c", "xvfb-run -a ruby /usr/local/bundle/gems/vimamsa-*/run_tests.rb /tmp/report00.txt"]
46
+ # CMD ["bash", "-c", "cd vimamsa && xvfb-run -a ruby run_tests.rb"]
44
47
 
45
48
 
data/README.md CHANGED
@@ -4,23 +4,53 @@ Vi/Vim -inspired experimental GUI-oriented text editor written with Ruby and GTK
4
4
 
5
5
  <!-- toc -->
6
6
 
7
- - [Requirements](#requirements)
8
- - [Installation](#installation)
7
+ - [Download (AppImage)](#download-appimage)
8
+ - [Install as a Ruby gem](#install-as-a-ruby-gem)
9
9
  * [Other install options](#other-install-options)
10
10
  - [Run](#run)
11
- - [Screenshots](#screenshots)
11
+ - [Demo](#demo)
12
12
  - [Key bindings](#key-bindings)
13
13
  - [Current limitations](#current-limitations)
14
14
 
15
15
  <!-- tocstop -->
16
16
 
17
- ## Requirements
18
- - Ruby 3.0+
19
- - GTK 4
17
+ ## Download (AppImage)
18
+
19
+ The easiest way: one file, nothing to install (Ruby, GTK and everything else
20
+ the editor needs are inside it).
21
+
22
+ 1. Download [Vimamsa-x86_64.AppImage](https://github.com/SamiSieranoja/vimamsa/releases/latest/download/Vimamsa-x86_64.AppImage)
23
+ (all versions: [Releases](https://github.com/SamiSieranoja/vimamsa/releases)).
24
+ 2. Make it executable and run it:
25
+ ```
26
+ chmod +x Vimamsa-x86_64.AppImage
27
+ ./Vimamsa-x86_64.AppImage [file]
28
+ ```
29
+ (or in the file manager: Properties ▸ "Allow executing file as program", then
30
+ double-click it).
31
+
32
+ On the first start it adds Vimamsa to the application menu. If you move the
33
+ file, start it once from the new place to update the menu entry. To update, download the new
34
+ version over the old file.
20
35
 
36
+ Requirements: x86_64 Linux with glibc 2.39 or newer: Ubuntu 24.04, Linux Mint 22,
37
+ Fedora 40, Debian 13, Arch, openSUSE Tumbleweed or newer. On an older system it
38
+ stops at start with `GLIBC_2.39 not found`; use the gem install below instead.
39
+ If your home directory is mounted `noexec`, move the file to a place where programs
40
+ can run.
21
41
 
22
- ## Installation
42
+ The AppImage is built by [GitHub Actions](.github/workflows/appimage.yml) from the
43
+ tagged source. To check that a downloaded file came from this repository's build
44
+ (needs the [GitHub CLI](https://cli.github.com/)):
45
+ ```
46
+ gh attestation verify Vimamsa-x86_64.AppImage --repo SamiSieranoja/vimamsa
47
+ ```
23
48
 
49
+ ## Install as a Ruby gem
50
+
51
+ Requirements:
52
+ - Ruby 3.1+
53
+ - GTK 4
24
54
 
25
55
  On Ubuntu (22.04):
26
56
  ```
@@ -45,10 +75,6 @@ sudo gem install --local vimamsa-0.1.*.gem
45
75
 
46
76
  ```
47
77
 
48
- Older version for GTK3:
49
-
50
- sudo gem install vimamsa -v 0.1.10
51
-
52
78
  ## Run
53
79
  ```
54
80
  vimamsa
@@ -61,10 +87,15 @@ sudo apt install ack-grep clang-format
61
87
 
62
88
  For customization, edit ~/.vimamsa/custom.rb
63
89
 
64
- ## Screenshots
90
+ ## Demo
65
91
 
66
- <a href="https://raw.githubusercontent.com/SamiSieranoja/vimamsa/refs/heads/master/img/screenshot1.png" target="_blank"><img src="https://raw.githubusercontent.com/SamiSieranoja/vimamsa/refs/heads/master/img/screenshot1.png" width="400"/></a>
67
- <a href="https://raw.githubusercontent.com/SamiSieranoja/vimamsa/refs/heads/master/img/screenshot2.png" target="_blank"><img src="https://raw.githubusercontent.com/SamiSieranoja/vimamsa/refs/heads/master/img/screenshot2.png" width="400"/></a>
92
+ ![Vimamsa demo: moving with hjkl and words, yy p, dd, undo/redo, Insert and Visual mode, easy jump, with the key log panel showing each key](img/demo.gif)
93
+
94
+ Moving with `h j k l` and `w e b`, `y y p`, `d d`, undo `u` / redo `ctrl-r`,
95
+ typing in Insert mode and back to Command mode with `ctrl` (press and release
96
+ it alone), selecting in Visual mode, and easy jump (`s`: type a word's label to
97
+ jump there). The key log panel on the right (View ▸ Toggle
98
+ key log panel) shows each key and the action it ran.
68
99
 
69
100
  ## Key bindings
70
101
 
@@ -155,10 +186,22 @@ Syntax:
155
186
  </tbody>
156
187
  </table>
157
188
 
158
- Bindings can be customized in ~/.vimamsa/custom.rb
189
+ Bindings can be customized in ~/.config/vimamsa/custom.rb
159
190
  For example, to bind ctrl-n to action "create new file":
160
191
  ```
161
192
  bindkey 'C ctrl-n', 'create_new_file()'
193
+
194
+ ```
195
+
196
+ custom.rb is loaded in two phases. The body of the file runs early, before
197
+ modules are initialized, so that the settings it makes (cnf.\*) are visible to
198
+ them. Modes that are created by modules (e.g. "fexp" for the file selector,
199
+ "grep") do not exist yet at that point; bindings for those go in an optional
200
+ function `hook_custom_after_init`, which is called after everything is loaded:
201
+ ```
202
+ def hook_custom_after_init
203
+ bindkey 'fexp , x', :my_action
204
+ end
162
205
  ```
163
206
 
164
207
 
@@ -166,7 +209,10 @@ bindkey 'C ctrl-n', 'create_new_file()'
166
209
  - Cursor sometimes vanishes when dragging or resizing the window. At least some cases are fixed in new GTK4 versions ( >= 4.18, in Ubuntu Ubuntu 25.04). Workaround is to press ctrl key twice.
167
210
 
168
211
  ## Current limitations
169
- - UTF8 only
212
+ - Linux only
213
+
214
+ Mainly tested with:
215
+ - UTF8, English or Finnish
170
216
  - Line endings with "\n"
171
217
 
172
218
 
data/custom_example.rb CHANGED
@@ -64,35 +64,65 @@ reg_act(:insert_lorem_ipsum, proc { insert_lorem_ipsum }, "Insert lorem ipsum")
64
64
 
65
65
  def open_mtg(urlpref = nil)
66
66
  require "uri"
67
- l = vma.buf.get_current_line.strip
68
- m = l.match(/[^;!]+/)
69
- if m
70
- cardname = m[0].strip
71
- # cardname = "Omnath, locus of mana"
72
- u = URI.encode_www_form_component(cardname)
73
- url = "https://gatherer.wizards.com/Pages/Card/Details.aspx?name=#{u}"
74
- if !urlpref.nil?
75
- url = urlpref + u
76
- end
77
- open_url(url)
67
+ cardname = if vma.buf.visual_mode?
68
+ vma.buf.get_current_selection.strip
69
+ else
70
+ l = vma.buf.get_current_line.strip
71
+ m = l.match(/(\w[\w\'\-\s]+)/)
72
+ m ? m[0].strip : nil
78
73
  end
74
+ return if cardname.nil? || cardname.empty?
75
+ u = URI.encode_www_form_component(cardname)
76
+ url = urlpref ? urlpref + u : "https://gatherer.wizards.com/Pages/Card/Details.aspx?name=#{u}"
77
+ open_url(url)
79
78
  end
80
79
 
81
80
  # reg_act(:open_mtg, proc { open_mtg }, "open mtg card info")
82
- # bindkey "C , , m", :open_mtg
81
+ # bindkey "VC , , m", :open_mtg
82
+ # Try on this line:
83
83
  # Restless Cottage
84
- # https://duckduckgo.com/?ia=web&origin=funnel_home_website&t=h_&q=
85
84
 
86
85
  # Primitive support for LSP (not well tested)
87
86
  # To enable LSP:
88
87
  # cnf.lsp.enabled = true
88
+
89
+ # solargraph (Ruby):
89
90
  # cnf.lsp.server.solargraph = { name: "solargraph", command: "solargraph stdio", type: "stdio" }
90
91
  # cnf.lsp.server.solargraph.languages = ["ruby"]
91
92
 
93
+ # ruby-lsp (Ruby):
94
+ # cnf.lsp.server.ruby_lsp = { name: "ruby-lsp", command: "bundle exec ruby-lsp", type: "stdio" }
95
+ # cnf.lsp.server.ruby_lsp.languages = ["ruby"]
96
+
97
+
92
98
  # cnf.lsp.server.clangd = { name: "clangd", command: "clangd-12 --offset-encoding=utf-8", type: "stdio" }
93
99
  # cnf.lsp.server.clangd.languages = ["c", "cpp"]
94
100
 
101
+ # Autocomplete (word completion popup in insert mode). Disabled by default.
102
+ # Candidates come from words in open buffers, plus the LSP server when
103
+ # cnf.lsp.enabled and a server is configured for the file's language.
104
+ # Enable it and (optionally) tune the defaults shown:
105
+ # cnf.autocomplete.enabled = true
106
+ # cnf.autocomplete.auto_trigger = true # popup while typing (false: ctrl-space/ctrl-h only)
107
+ # cnf.autocomplete.min_chars = 2 # typed chars before the popup opens
108
+ # cnf.autocomplete.max_items = 50 # candidates kept in the list
109
+ # cnf.autocomplete.visible_items = 10 # popup rows before scrolling
110
+ # cnf.autocomplete.lsp.enabled = true
111
+ # cnf.autocomplete.lsp.debounce = 0.15 # seconds before asking the server
112
+
95
113
  # Uncomment this if you don't want to see the state trail of previous action
96
114
  # on top right corner:
97
115
  # cnf.kbd.show_prev_action = false
98
116
 
117
+ # Add comment character rule for a file type not detected automatically:
118
+ # cnf.comment_chars! << { pattern: /\.lua$/, char: "--" }
119
+
120
+ # Second phase of this file. Everything above runs early during startup, before
121
+ # the file selector, grep and the modules are initialized, so that the cnf.*
122
+ # settings above are visible to them. Their keyboard modes (e.g. "fexp" for the
123
+ # file selector, "grep") do not exist yet at that point: bindings for those go
124
+ # here, in a function that is called after everything has been loaded.
125
+ # def hook_custom_after_init
126
+ # bindkey "fexp , x", :my_file_action
127
+ # end
128
+