vimamsa 0.1.28 → 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.
- checksums.yaml +4 -4
- data/.github/workflows/appimage.yml +17 -10
- data/Dockerfile +2 -2
- data/README.md +31 -9
- data/custom_example.rb +16 -10
- data/doc/TODO.md +7 -0
- data/doc/test_commands.md +232 -0
- data/doc/vimlike_vim_conflicts.md +6 -6
- data/docker_cmd.sh +1 -1
- data/exe/run_tests.rb +77 -2
- data/lib/vimamsa/buffer.rb +1 -1
- data/lib/vimamsa/demo_player.rb +41 -5
- data/lib/vimamsa/editor.rb +47 -19
- data/lib/vimamsa/gui.rb +6 -0
- data/lib/vimamsa/gui_func_panel.rb +1 -1
- data/lib/vimamsa/gui_sourceview.rb +13 -0
- data/lib/vimamsa/intro_page.rb +0 -1
- data/lib/vimamsa/key_binding_tree.rb +1 -1
- data/lib/vimamsa/key_bindings_report.rb +2 -2
- data/lib/vimamsa/key_bindings_vim.rb +2 -6
- data/lib/vimamsa/{vim_core.rb → key_bindings_vim_core.rb} +2 -1
- data/lib/vimamsa/key_bindings_vimlike.rb +2 -2
- data/lib/vimamsa/langservp.rb +62 -7
- data/lib/vimamsa/rbvma.rb +1 -1
- data/lib/vimamsa/version.rb +1 -1
- data/run_tests_vm.rb +25 -0
- data/scripts/appimage/AppRun +7 -0
- data/scripts/appimage/build_in_container.sh +11 -1
- data/scripts/appimage/smoke_test.sh +1 -1
- data/tests/test_demo_player.rb +54 -0
- data/tests/test_lsp_root.rb +43 -0
- data/tests/test_registers.rb +9 -0
- data/tests/test_startup_file.rb +44 -3
- data/vm_guest_run.sh +53 -26
- metadata +4 -3
- data/run_tests.rb +0 -89
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9b9f8e01a0389ef6c6bb5f04616856b2d6fa8e99c9ec178507eb3ece03084bd4
|
|
4
|
+
data.tar.gz: '0868c083559ba6d905586816333200fe70f5c45eaed306de522f3a89b0791caa'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2b7c3a573ca292a07b9e93b5db746b8884f99b2c04b9a9e193481751f8e51fa4280cdec82b625782d1100f8109ac46944a4c0b82c2a681ea70041f779ba5360f
|
|
7
|
+
data.tar.gz: 88be098c45d80459e6e725a0da2da180e18e14ee1d94f6e391ea0bc5fb4808d34cd77d952b3dc1ab839b2fed0d69ca9df76c328d9a8738125c592bb7b096f5d9
|
|
@@ -47,36 +47,43 @@ jobs:
|
|
|
47
47
|
- name: Test on a clean Ubuntu 24.04
|
|
48
48
|
run: scripts/appimage/smoke_test.sh build/appimage/Vimamsa-*-x86_64.AppImage
|
|
49
49
|
|
|
50
|
-
#
|
|
50
|
+
# The file with its version (Vimamsa-0.1.28-x86_64.AppImage), and the
|
|
51
|
+
# same file under one name for every release, so the README can link to
|
|
51
52
|
# releases/latest/download/Vimamsa-x86_64.AppImage
|
|
52
|
-
- name: Name the
|
|
53
|
+
- name: Name the files
|
|
53
54
|
run: |
|
|
54
55
|
mkdir -p dist
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
f=$(ls build/appimage/Vimamsa-*-x86_64.AppImage)
|
|
57
|
+
cp "$f" dist/
|
|
58
|
+
cp "$f" dist/Vimamsa-x86_64.AppImage
|
|
59
|
+
(cd dist && for a in *.AppImage; do sha256sum "$a" > "$a.sha256"; done)
|
|
57
60
|
|
|
58
61
|
- name: Attest build provenance
|
|
59
62
|
if: github.ref_type == 'tag'
|
|
60
63
|
uses: actions/attest-build-provenance@v2
|
|
61
64
|
with:
|
|
62
|
-
subject-path: dist
|
|
65
|
+
subject-path: dist/*.AppImage
|
|
63
66
|
|
|
64
67
|
- name: Attach to the release
|
|
65
68
|
if: github.ref_type == 'tag'
|
|
66
69
|
env:
|
|
67
70
|
GH_TOKEN: ${{ github.token }}
|
|
68
71
|
run: |
|
|
69
|
-
|
|
72
|
+
v="${GITHUB_REF_NAME#v}"
|
|
73
|
+
notes="Download \`Vimamsa-$v-x86_64.AppImage\`, make it executable and run it:
|
|
70
74
|
|
|
71
75
|
\`\`\`
|
|
72
|
-
chmod +x Vimamsa-x86_64.AppImage
|
|
73
|
-
./Vimamsa-x86_64.AppImage
|
|
76
|
+
chmod +x Vimamsa-$v-x86_64.AppImage
|
|
77
|
+
./Vimamsa-$v-x86_64.AppImage
|
|
74
78
|
\`\`\`
|
|
75
79
|
|
|
80
|
+
\`Vimamsa-x86_64.AppImage\` is the same file under the name every release has
|
|
81
|
+
(the README links to the latest one).
|
|
82
|
+
|
|
76
83
|
Needs x86_64 Linux with glibc 2.39 or newer (Ubuntu 24.04, Fedora 40, Debian 13 or newer).
|
|
77
84
|
|
|
78
85
|
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\`"
|
|
86
|
+
\`gh attestation verify Vimamsa-$v-x86_64.AppImage --repo $GITHUB_REPOSITORY\`"
|
|
80
87
|
if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then
|
|
81
88
|
gh release upload "$GITHUB_REF_NAME" dist/* --clobber
|
|
82
89
|
else
|
|
@@ -88,6 +95,6 @@ jobs:
|
|
|
88
95
|
if: github.ref_type != 'tag'
|
|
89
96
|
uses: actions/upload-artifact@v4
|
|
90
97
|
with:
|
|
91
|
-
name: Vimamsa-
|
|
98
|
+
name: Vimamsa-AppImage
|
|
92
99
|
path: dist/
|
|
93
100
|
retention-days: 14
|
data/Dockerfile
CHANGED
|
@@ -42,7 +42,7 @@ RUN git clone https://github.com/SamiSieranoja/vimamsa.git && cd vimamsa && gem
|
|
|
42
42
|
RUN chmod a-w -R /usr/local/bundle/gems/vimamsa*
|
|
43
43
|
RUN chmod a-w -R vimamsa
|
|
44
44
|
|
|
45
|
-
CMD ["bash", "-c", "xvfb-run -a ruby /usr/local/bundle/gems/vimamsa-*/run_tests.rb
|
|
46
|
-
# CMD ["bash", "-c", "cd vimamsa && xvfb-run -a ruby run_tests.rb"]
|
|
45
|
+
CMD ["bash", "-c", "xvfb-run -a ruby /usr/local/bundle/gems/vimamsa-*/exe/run_tests.rb"]
|
|
46
|
+
# CMD ["bash", "-c", "cd vimamsa && xvfb-run -a ruby exe/run_tests.rb"]
|
|
47
47
|
|
|
48
48
|
|
data/README.md
CHANGED
|
@@ -16,11 +16,14 @@ Vi/Vim -inspired experimental GUI-oriented text editor written with Ruby and GTK
|
|
|
16
16
|
|
|
17
17
|
## Download (AppImage)
|
|
18
18
|
|
|
19
|
+
[](https://github.com/SamiSieranoja/vimamsa/releases/latest)
|
|
20
|
+
|
|
19
21
|
The easiest way: one file, nothing to install (Ruby, GTK and everything else
|
|
20
22
|
the editor needs are inside it).
|
|
21
23
|
|
|
22
|
-
1. Download [Vimamsa-x86_64.AppImage](https://github.com/SamiSieranoja/vimamsa/releases/latest/download/Vimamsa-x86_64.AppImage)
|
|
23
|
-
(
|
|
24
|
+
1. Download [Vimamsa-x86_64.AppImage](https://github.com/SamiSieranoja/vimamsa/releases/latest/download/Vimamsa-x86_64.AppImage),
|
|
25
|
+
the latest release (each release also has the file with its version in
|
|
26
|
+
the name, e.g. Vimamsa-0.1.28-x86_64.AppImage: [Releases](https://github.com/SamiSieranoja/vimamsa/releases)).
|
|
24
27
|
2. Make it executable and run it:
|
|
25
28
|
```
|
|
26
29
|
chmod +x Vimamsa-x86_64.AppImage
|
|
@@ -160,7 +163,6 @@ Syntax:
|
|
|
160
163
|
| `z` | Enter BROWSE mode |
|
|
161
164
|
| `O` | Move to end of line |
|
|
162
165
|
| `X` | Insert an empty line below |
|
|
163
|
-
| `C` | Search in files (grep) |
|
|
164
166
|
| `tab` | Switch between current and previous buffer |
|
|
165
167
|
| `M` | Run the last recorded macro |
|
|
166
168
|
| `enter` | On a link: open url in browser. On `/path/to/file.txt:linenum`: open the file, jump to linenum |
|
|
@@ -170,13 +172,13 @@ Syntax:
|
|
|
170
172
|
| `ctrl-w` | Close buffer |
|
|
171
173
|
| `ctrl-c` / `ctrl-x` | Comment / uncomment line |
|
|
172
174
|
| `ctrl-q` | Quit |
|
|
173
|
-
| `g s` | Jump to a file in the file panel
|
|
175
|
+
| `g s` | Easy Jump to a file in the file panel|
|
|
174
176
|
| `alt-h` / `alt-l` | Previous / next file in the file panel |
|
|
175
177
|
| `, b` | Switch buffer (buffer manager) |
|
|
176
178
|
| `, f` | File explorer: browse directories (`h` parent directory, `l` or `enter` open) |
|
|
177
|
-
| `,
|
|
179
|
+
| `, z` | File finder (fuzzy search for file names) |
|
|
178
180
|
| `, h` | File history |
|
|
179
|
-
| `, g` | Search for a string in the current buffer, show matching lines |
|
|
181
|
+
| `, g` | Grep: Search for a string in the current buffer, show matching lines |
|
|
180
182
|
| `, a` | Search in files using ack |
|
|
181
183
|
| `, r r` | Search and replace |
|
|
182
184
|
| `, e` or `:` | Command line |
|
|
@@ -186,9 +188,9 @@ Syntax:
|
|
|
186
188
|
| `, r v b` | Revert buffer from disk |
|
|
187
189
|
| `, M` / `, '` | Add bookmark / list bookmarks |
|
|
188
190
|
| `, v` | Auto-indent buffer |
|
|
189
|
-
| `, w` | Switch between columns |
|
|
190
191
|
| `, , w` | Toggle two-column view |
|
|
191
|
-
| `,
|
|
192
|
+
| `, w` | Switch between columns |
|
|
193
|
+
| `, m h` | Show messages (toggle) |
|
|
192
194
|
|
|
193
195
|
**Insert mode** (similar to bash or emacs)
|
|
194
196
|
|
|
@@ -256,7 +258,7 @@ end
|
|
|
256
258
|
|
|
257
259
|
|
|
258
260
|
## Known issues
|
|
259
|
-
- Cursor sometimes vanishes when dragging or resizing the window.
|
|
261
|
+
- Cursor sometimes vanishes (e.g. when dragging or resizing the window). A manifestation of a GTK bug, fixed in new GTK4 versions ( >= 4.18, in Ubuntu Ubuntu 25.04+). Workaround is to press ctrl key twice.
|
|
260
262
|
|
|
261
263
|
## Current limitations
|
|
262
264
|
- Linux only
|
|
@@ -265,4 +267,24 @@ Mainly tested with:
|
|
|
265
267
|
- UTF8, English or Finnish
|
|
266
268
|
- Line endings with "\n"
|
|
267
269
|
|
|
270
|
+
## History
|
|
271
|
+
|
|
272
|
+
The name ```vimamsa``` was taken from a Pali language dictionary. It can mean `experiment`, `investigation` or `review`.
|
|
273
|
+
|
|
274
|
+
This software has been in development since at least 2015. Since 2025, development has been done mainly using AI tools (claude).
|
|
275
|
+
|
|
276
|
+
## Design goals and future plans
|
|
277
|
+
|
|
278
|
+
- GUI-based instead of focusing on running in terminal
|
|
279
|
+
- Separate key bindings from actions. Should be able to adapt any type of editor keybindings.
|
|
280
|
+
- Compatibility with the most popular vim features
|
|
281
|
+
- More modes than in vim(?) and with flexible customization.
|
|
282
|
+
- Extending with Ruby only.
|
|
283
|
+
- Support for images and other graphical elements
|
|
284
|
+
- Vim-style editing, but hopefully easier to learn.
|
|
285
|
+
- Should have a proper module API. But APIs are often too limited. Should also allow user access to all internal functions and to be able to break stuff.
|
|
286
|
+
|
|
287
|
+
In future:
|
|
288
|
+
- WYSIWYG -editing (replacing need for LaTeX or Word)
|
|
289
|
+
- All-in-one approach like in Emacs. Email, File management, Terminal, Playing audio. Control everything with vim-bindings.
|
|
268
290
|
|
data/custom_example.rb
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
# Eval selected text as ruby code (e.g. use as calculator):
|
|
8
|
-
# bindkey "V , e", "
|
|
9
|
-
# syntax: bindkey "mode key1 key2 ..."
|
|
8
|
+
# bindkey "V , e", "sel.convert.eval"
|
|
9
|
+
# syntax: bindkey "mode key1 key2 ...", "action.id"
|
|
10
10
|
|
|
11
11
|
# Execute in new gnome-terminal tab
|
|
12
12
|
# bindkey "C , , t", "term.line"
|
|
@@ -14,15 +14,16 @@
|
|
|
14
14
|
# Actions have dotted ids, from general to specific: "move.word.next",
|
|
15
15
|
# "buf.save", "sel.copy" (Search for Actions, [C] , , s, lists them). Bind one
|
|
16
16
|
# by its id, or with the a.… form, which reports a typo when the binding is made:
|
|
17
|
-
# bindkey "C , w", a.move.word.next
|
|
17
|
+
# bindkey "C , i w", a.move.word.next
|
|
18
18
|
# Run one from here or from the command line (:) with a trailing "!":
|
|
19
19
|
# a.buf.save!
|
|
20
20
|
# Your own actions: use the "custom." namespace, as below.
|
|
21
21
|
|
|
22
|
-
#
|
|
22
|
+
# Settings are cnf.* values (the Settings dialog writes them to settings.rb):
|
|
23
|
+
# cnf.tab.width = 4
|
|
23
24
|
|
|
24
25
|
# Open this file every time the program starts
|
|
25
|
-
cnf.startup_file = "~/Documents/startup.txt"
|
|
26
|
+
# cnf.startup_file = "~/Documents/startup.txt"
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
|
|
@@ -55,7 +56,7 @@ reg_act("custom.c_header", proc { collect_c_header }, "Collect function definiti
|
|
|
55
56
|
|
|
56
57
|
# Extract all numbers from txt selection
|
|
57
58
|
c = Converter.new(lambda { |x| x.scan(/([\+\-]?\d+(\.\d+)?)/).collect { |x| x[0] }.join(" ") }, :lambda, :getnums)
|
|
58
|
-
# (
|
|
59
|
+
# (action sel.convert.getnums; in the action search, e.g. "conv getnum")
|
|
59
60
|
|
|
60
61
|
|
|
61
62
|
def insert_lorem_ipsum()
|
|
@@ -76,18 +77,19 @@ def open_mtg(urlpref = nil)
|
|
|
76
77
|
vma.buf.get_current_selection.strip
|
|
77
78
|
else
|
|
78
79
|
l = vma.buf.get_current_line.strip
|
|
79
|
-
m = l.match(/(\w[\w\'
|
|
80
|
+
m = l.match(/(\w[\w\'\-\,\s]+)/)
|
|
80
81
|
m ? m[0].strip : nil
|
|
81
82
|
end
|
|
82
83
|
return if cardname.nil? || cardname.empty?
|
|
83
84
|
u = URI.encode_www_form_component(cardname)
|
|
85
|
+
message(u)
|
|
84
86
|
url = urlpref ? urlpref + u : "https://gatherer.wizards.com/Pages/Card/Details.aspx?name=#{u}"
|
|
85
87
|
open_url(url)
|
|
86
88
|
end
|
|
87
89
|
|
|
88
90
|
# reg_act("custom.mtg", proc { open_mtg }, "open mtg card info")
|
|
89
91
|
# bindkey "VC , , m", "custom.mtg"
|
|
90
|
-
# Try on this line:
|
|
92
|
+
# Try on this line (keys ", , m" in command or visual mode):
|
|
91
93
|
# Restless Cottage
|
|
92
94
|
|
|
93
95
|
# The introduction page (Help ▸ Introduction) is shown at start once. To show
|
|
@@ -103,11 +105,15 @@ end
|
|
|
103
105
|
# cnf.lsp.server.solargraph.languages = ["ruby"]
|
|
104
106
|
|
|
105
107
|
# ruby-lsp (Ruby):
|
|
106
|
-
#
|
|
108
|
+
# The AppImage puts its own ruby-lsp on PATH. "bundle exec" only works when
|
|
109
|
+
# the editor's current directory (or a parent) has a Gemfile; started from
|
|
110
|
+
# anywhere else it fails ("Could not locate Gemfile") for every Ruby buffer.
|
|
111
|
+
# cnf.lsp.server.ruby_lsp = { name: "ruby-lsp",
|
|
112
|
+
# command: ENV["APPIMAGE"] ? "ruby-lsp" : "bundle exec ruby-lsp", type: "stdio" }
|
|
107
113
|
# cnf.lsp.server.ruby_lsp.languages = ["ruby"]
|
|
108
114
|
|
|
109
115
|
|
|
110
|
-
# cnf.lsp.server.clangd = { name: "clangd", command: "clangd
|
|
116
|
+
# cnf.lsp.server.clangd = { name: "clangd", command: "clangd --offset-encoding=utf-8", type: "stdio" }
|
|
111
117
|
# cnf.lsp.server.clangd.languages = ["c", "cpp"]
|
|
112
118
|
|
|
113
119
|
# Autocomplete (word completion popup in insert mode). Disabled by default.
|
data/doc/TODO.md
CHANGED
|
@@ -606,6 +606,13 @@ Constraints:
|
|
|
606
606
|
|
|
607
607
|
Format: `- **Item title** (2026-MM-DD, `abc1234`[..`def5678`]): one or two lines on what was changed.`
|
|
608
608
|
|
|
609
|
+
- **Demo playback: no user input while running; restart after edits** (2026-11-22,
|
|
610
|
+
`5254114`): while a demo plays, the user's keys and clicks/drags in the text are
|
|
611
|
+
ignored (`DemoPlayer.blocks_input?`, checked in `gui.rb` and `gui_sourceview.rb`), with a
|
|
612
|
+
message to pause it. Paused, the editor can be used; if the text, cursor, mode or
|
|
613
|
+
current buffer changed, continuing starts the demo from the beginning. Tests in
|
|
614
|
+
`tests/test_demo_player.rb`.
|
|
615
|
+
|
|
609
616
|
- **XDG dirs instead of `~/.vimamsa`** (2026-11-22, uncommitted): generated files
|
|
610
617
|
(session, buffer list, command and file history, file index, recorded macros,
|
|
611
618
|
backups, crash reports, listen dir) go in `~/.local/share/vimamsa`; config stays in
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
# Test commands
|
|
2
|
+
|
|
3
|
+
How to run the different kinds of tests, with a focus on the ones that a
|
|
4
|
+
plain `./run_tests_vm.rb` (no parameters) does **not** run.
|
|
5
|
+
|
|
6
|
+
## The default run
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
./run_tests_vm.rb
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
This syncs the working tree into the test VM (`$VM_NAME`) and runs
|
|
13
|
+
`ruby exe/run_tests.rb` without arguments on the VM's real desktop. That
|
|
14
|
+
runs every `tests/test_*.rb` file **except** the excluded ones listed below.
|
|
15
|
+
Some tests in the included files still skip themselves when an opt-in variable
|
|
16
|
+
or a tool is missing (see "Tests that skip in the default run").
|
|
17
|
+
|
|
18
|
+
Any arguments to `run_tests_vm.rb` go unchanged to `exe/run_tests.rb` inside
|
|
19
|
+
the guest, so every command below that uses `exe/run_tests.rb` also works
|
|
20
|
+
as `./run_tests_vm.rb <args>`. Run tests in the VM rather than locally where
|
|
21
|
+
you can.
|
|
22
|
+
|
|
23
|
+
### Argument forms (`exe/run_tests.rb`)
|
|
24
|
+
|
|
25
|
+
| Argument | Meaning |
|
|
26
|
+
|---|---|
|
|
27
|
+
| *(none)* | every `tests/test_*.rb` except the excluded files |
|
|
28
|
+
| `tests/test_foo.rb` | one file, by path |
|
|
29
|
+
| `foo` or `test_foo` | shorthand for `tests/test_foo.rb` |
|
|
30
|
+
| `foo,bar` | several files |
|
|
31
|
+
| `TestFoo` | only classes with that name (an argument starting with a capital letter) |
|
|
32
|
+
| `duration=N` | run time in seconds for `test_random_edit` |
|
|
33
|
+
| `ref=REF`, `runs=N` | comparison commit and run count for `test_perf_startup` |
|
|
34
|
+
| `--headless` | invisible display (see below) |
|
|
35
|
+
|
|
36
|
+
Naming a file explicitly bypasses the exclusion list, which is how the
|
|
37
|
+
excluded tests are run. An argument that is not recognized (for example a
|
|
38
|
+
mistyped file name) stops the run with exit code 2 instead of being ignored.
|
|
39
|
+
`ruby exe/run_tests.rb --help` lists all of this.
|
|
40
|
+
|
|
41
|
+
## Files excluded from the default run
|
|
42
|
+
|
|
43
|
+
These are listed in `excluded` in `exe/run_tests.rb` and run only when you
|
|
44
|
+
name them.
|
|
45
|
+
|
|
46
|
+
### Random edit stress test — `test_random_edit`
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
./run_tests_vm.rb test_random_edit # 300 s (DURATION default)
|
|
50
|
+
./run_tests_vm.rb test_random_edit duration=60 # shorter run
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
This runs random safe editor actions (moves, deletes, undo/redo, paste, mode
|
|
54
|
+
switches, random inserts) for the given time. It fails if any action raises an
|
|
55
|
+
exception. It is excluded because of how long it runs.
|
|
56
|
+
|
|
57
|
+
### Alternative key-binding schemes — `test_vim_bindings`, `test_notepad_bindings`
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
./run_tests_vm.rb vim_bindings
|
|
61
|
+
./run_tests_vm.rb notepad_bindings
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Each one loads a different binding scheme (`key_bindings_vim.rb` /
|
|
65
|
+
`key_bindings_notepad.rb`), and that permanently rebinds keys in the shared
|
|
66
|
+
test process. **Run each one by itself.** Don't combine them with each other
|
|
67
|
+
or with other files (`vim_bindings,undo`), or the files that run after them
|
|
68
|
+
will see the wrong bindings.
|
|
69
|
+
|
|
70
|
+
`test_vim_bindings` contains oracle tests. Each key sequence is replayed in a
|
|
71
|
+
real `nvim` or `vim` on the same text, and the two resulting buffers must
|
|
72
|
+
match. That needs `nvim` or `vim` on `PATH` (the VM provisioning installs
|
|
73
|
+
`vim`).
|
|
74
|
+
|
|
75
|
+
### Startup time regression — `test_perf_startup`
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
./run_tests_vm.rb perf_startup # vs the previous commit
|
|
79
|
+
./run_tests_vm.rb perf_startup ref=HEAD~10 runs=7 # vs another commit
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
This starts the editor several times at the current version and at `ref`
|
|
83
|
+
(default 5 runs each) and compares the fastest startups. It fails if the
|
|
84
|
+
current version is more than 25 % **and** more than 0.3 s slower. Without
|
|
85
|
+
`ref=` it compares against the previous commit, or against the current one
|
|
86
|
+
when `lib/`, `exe/` or `ext/` have uncommitted changes. It takes about a
|
|
87
|
+
minute, needs a display and a git checkout, and is excluded because of how
|
|
88
|
+
long it runs.
|
|
89
|
+
|
|
90
|
+
You can run the same check without the test runner:
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
ruby scripts/perf_compare.rb [--ref REF] [--runs N]
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Tests that skip in the default run
|
|
97
|
+
|
|
98
|
+
These files are part of the default run, but some of their tests skip unless
|
|
99
|
+
an environment variable is set or a tool is present. Skipped tests show up as
|
|
100
|
+
`SKIP:` lines under `Results:`.
|
|
101
|
+
|
|
102
|
+
### Keyboard E2E tests — `test_e2e_cmdline`, `test_e2e_replace_char`
|
|
103
|
+
|
|
104
|
+
These type real key events through a uinput virtual keyboard
|
|
105
|
+
(`tests/support/virtual_keyboard.rb`), so the editor window has to have focus
|
|
106
|
+
on a real Wayland seat. Wayland doesn't let a window launched through
|
|
107
|
+
`guestcontrol` take focus, so in the default VM run they wait 3 s and then skip
|
|
108
|
+
with "editor window is not focused".
|
|
109
|
+
|
|
110
|
+
To run them, use the semi-interactive wrapper:
|
|
111
|
+
|
|
112
|
+
```sh
|
|
113
|
+
./run_e2e_vm.sh # tests/test_e2e_cmdline.rb
|
|
114
|
+
./run_e2e_vm.sh e2e_replace_char
|
|
115
|
+
./run_e2e_vm.sh e2e_cmdline,e2e_replace_char
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
It sets `VMA_E2E_INTERACTIVE=1` and calls `run_tests_vm.rb`. When the prompt
|
|
119
|
+
`[E2E] Click the vimamsa window…` appears, click the editor window on the VM
|
|
120
|
+
desktop once, within 90 s. Every test after that finds the window already
|
|
121
|
+
focused.
|
|
122
|
+
|
|
123
|
+
Other requirements: writable `/dev/uinput` (the guest script sets it up on
|
|
124
|
+
every run), `xmodmap`, and the GTK Wayland backend. `test_e2e_replace_char`
|
|
125
|
+
also needs a keyboard layout with an `ä` key and skips without one. With
|
|
126
|
+
`--headless`, all of these tests always skip.
|
|
127
|
+
|
|
128
|
+
### Dictation E2E — `test_e2e_dictation`
|
|
129
|
+
|
|
130
|
+
```sh
|
|
131
|
+
VMA_E2E_DICTATION=1 ruby exe/run_tests.rb e2e_dictation
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
This one is opt-in. `run_tests_vm.rb` does **not** pass `VMA_E2E_DICTATION`
|
|
135
|
+
to the guest, so for now it runs only locally. The test uses a virtual
|
|
136
|
+
microphone (`tests/support/virtual_mic.rb`): it synthesizes a phrase with
|
|
137
|
+
`espeak-ng`/`espeak`, feeds it through the real GStreamer recorder and the
|
|
138
|
+
Whisper worker, and checks that the text arrives in the buffer. It needs
|
|
139
|
+
espeak and a Python that can `import faster_whisper`. The first run also
|
|
140
|
+
downloads the tiny Whisper model (~75 MB).
|
|
141
|
+
|
|
142
|
+
### Generated-doc check — `test_vim_conflicts`
|
|
143
|
+
|
|
144
|
+
```sh
|
|
145
|
+
VMA_UPDATE_DOC=1 ./run_tests_vm.rb vim_conflicts
|
|
146
|
+
# locally:
|
|
147
|
+
VMA_UPDATE_DOC=1 ruby exe/run_tests.rb --headless vim_conflicts
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
The default run only checks that `doc/vimlike_vim_conflicts.md` matches the
|
|
151
|
+
current bindings, and fails if the file is out of date. `VMA_UPDATE_DOC=1`
|
|
152
|
+
regenerates the file instead. In the VM, `run_tests_vm.rb` copies the
|
|
153
|
+
regenerated file back into the working tree (see `GENERATED_DOCS`). Commit
|
|
154
|
+
the result.
|
|
155
|
+
|
|
156
|
+
### Tool-dependent tests
|
|
157
|
+
|
|
158
|
+
These skip when a tool is missing:
|
|
159
|
+
|
|
160
|
+
| Test | Needs | In the VM |
|
|
161
|
+
|---|---|---|
|
|
162
|
+
| `test_lsp_clangd` | `clangd` or `clangd-N` on `PATH` | **not installed**: skips |
|
|
163
|
+
| `test_ack` | `ack` / `ack-grep` | installed |
|
|
164
|
+
| `test_text_objects`, `test_vim_operators` (real-vim comparison) | `vim` | installed |
|
|
165
|
+
| `test_file_format`, `test_diff_buffer_name` | `git`, `diff` | installed |
|
|
166
|
+
|
|
167
|
+
To run the clangd tests in the VM, install it once in the guest
|
|
168
|
+
(`sudo apt-get install clangd`), then run `./run_tests_vm.rb lsp_clangd`.
|
|
169
|
+
|
|
170
|
+
## Headless runs (local)
|
|
171
|
+
|
|
172
|
+
```sh
|
|
173
|
+
ruby exe/run_tests.rb --headless # full default set
|
|
174
|
+
ruby exe/run_tests.rb --headless undo # one file
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
The editor runs on an invisible display, so the run doesn't interfere with
|
|
178
|
+
your desktop. It uses `xvfb-run` if it's installed (a private X server per
|
|
179
|
+
run) and otherwise GTK's Broadway backend on display `:9`. Expect more skips
|
|
180
|
+
than in the VM:
|
|
181
|
+
|
|
182
|
+
- all keyboard E2E tests (no real seat)
|
|
183
|
+
- window-maximize tests in `test_window_layout` (no window manager)
|
|
184
|
+
- under Broadway only: `test_bracket_match` and `test_keylog_panel`, because
|
|
185
|
+
nothing is drawn or laid out while no browser is connected. Install `xvfb`
|
|
186
|
+
to avoid this.
|
|
187
|
+
|
|
188
|
+
Three `test_autocomplete` tests (tab/enter completion) are skipped on every
|
|
189
|
+
run, the VM included, because they were unreliable under headless GTK.
|
|
190
|
+
|
|
191
|
+
Tests never read or write your real `~/.config/vimamsa`. They use
|
|
192
|
+
`~/.config/vimamsa-test`, which you can override with `VMA_USER_DIR`.
|
|
193
|
+
|
|
194
|
+
## AppImage smoke test
|
|
195
|
+
|
|
196
|
+
This isn't part of any `run_tests` invocation. It builds the AppImage and runs
|
|
197
|
+
a few test files with it in a clean Ubuntu 24.04 Docker container, which has no
|
|
198
|
+
GTK and no Ruby:
|
|
199
|
+
|
|
200
|
+
```sh
|
|
201
|
+
scripts/appimage/build.sh # HEAD; VMA_REF=WORKTREE for uncommitted changes
|
|
202
|
+
scripts/appimage/smoke_test.sh build/appimage/Vimamsa-<version>-x86_64.AppImage
|
|
203
|
+
SMOKE_TESTS="tests/test_undo.rb" scripts/appimage/smoke_test.sh <AppImage>
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
By default it runs `test_basic_editing` and `test_bundling`. The test
|
|
207
|
+
`test_bundling#test_appimage_children_get_host_environment` runs only from
|
|
208
|
+
inside the AppImage, when `APPDIR` is set, and skips everywhere else.
|
|
209
|
+
|
|
210
|
+
## VM runner options
|
|
211
|
+
|
|
212
|
+
| Variable | Effect |
|
|
213
|
+
|---|---|
|
|
214
|
+
| `VM_NAME`, `VM_USER`, `VM_PASS` | required: VM name, guest user, guest password |
|
|
215
|
+
| `VM_DISPLAY` | guest X display (default `:0`) |
|
|
216
|
+
| `FORCE_PROVISION=1` | rerun the apt/gem provisioning in the guest |
|
|
217
|
+
| `VMA_UPDATE_DOC=1` | copy regenerated docs back from the guest |
|
|
218
|
+
| `VMA_E2E_INTERACTIVE=1` | interactive focus wait for E2E tests (set by `run_e2e_vm.sh`) |
|
|
219
|
+
|
|
220
|
+
## Summary: what the default `./run_tests_vm.rb` leaves out
|
|
221
|
+
|
|
222
|
+
| What | Command |
|
|
223
|
+
|---|---|
|
|
224
|
+
| Random edit stress | `./run_tests_vm.rb test_random_edit duration=60` |
|
|
225
|
+
| Vim scheme (+ vim oracle) | `./run_tests_vm.rb vim_bindings` |
|
|
226
|
+
| Notepad scheme | `./run_tests_vm.rb notepad_bindings` |
|
|
227
|
+
| Startup time regression | `./run_tests_vm.rb perf_startup` |
|
|
228
|
+
| Keyboard E2E | `./run_e2e_vm.sh` (click the window once) |
|
|
229
|
+
| Dictation E2E | `VMA_E2E_DICTATION=1 ruby exe/run_tests.rb e2e_dictation` (local) |
|
|
230
|
+
| Regenerate the vim-conflicts doc | `VMA_UPDATE_DOC=1 ./run_tests_vm.rb vim_conflicts` |
|
|
231
|
+
| clangd LSP | install `clangd` in the guest, then `./run_tests_vm.rb lsp_clangd` |
|
|
232
|
+
| AppImage | `scripts/appimage/build.sh` + `scripts/appimage/smoke_test.sh` |
|
|
@@ -8,10 +8,10 @@ Bindings that modules and `custom.rb` add at startup are not included.
|
|
|
8
8
|
|
|
9
9
|
| | Count |
|
|
10
10
|
|---|---|
|
|
11
|
-
| Conflicts (the vim binding can't be used in vimlike) |
|
|
12
|
-
| Added to vimlike from the shared table (`VIM_BINDINGS`,
|
|
11
|
+
| Conflicts (the vim binding can't be used in vimlike) | 41 |
|
|
12
|
+
| Added to vimlike from the shared table (`VIM_BINDINGS`, key_bindings_vim_core.rb) | 461 |
|
|
13
13
|
| Missing from vimlike (no conflict, could be added) | 0 |
|
|
14
|
-
| vim keymap only (left out of vimlike on purpose) |
|
|
14
|
+
| vim keymap only (left out of vimlike on purpose) | 0 |
|
|
15
15
|
| Shared (same keys, same action) | 152 |
|
|
16
16
|
|
|
17
17
|
## Conflicts
|
|
@@ -20,7 +20,6 @@ Bindings that modules and `custom.rb` add at startup are not included.
|
|
|
20
20
|
|---|---|---|---|---|
|
|
21
21
|
| C | <code>$</code> | <code>move.motion(line_end)</code> | <code>move.line.end</code> | same keys, other action |
|
|
22
22
|
| C | <code>@ @</code> | <code>macro.run.last</code> | <code>@ <char></code> <code>macro.run</code> | a vimlike <char> binding takes the key |
|
|
23
|
-
| C | <code>C</code> | <code>edit.change.eol</code> | <code>grep.files</code> | same keys, other action |
|
|
24
23
|
| C | <code>O</code> | <code>edit.line.above</code> | <code>move.line.end</code> | same keys, other action |
|
|
25
24
|
| C | <code>X</code> | <code>edit.delete.char.prev</code> | <code>edit.line.below</code> | same keys, other action |
|
|
26
25
|
| C | <code>^</code> | <code>move.line.first_char</code> | <code>move.line.start</code> | same keys, other action |
|
|
@@ -75,6 +74,7 @@ the number of its combinations that vimlike got.
|
|
|
75
74
|
| C | <code><op> <same> (11 combinations)</code> | <code>op.lines</code> |
|
|
76
75
|
| C | <code><op> <textobj> (32 combinations)</code> | <code>op.textobj</code> |
|
|
77
76
|
| C | <code><motion> (7 combinations)</code> | <code>move.motion</code> |
|
|
77
|
+
| C | <code>C</code> | <code>edit.change.eol</code> |
|
|
78
78
|
| C | <code>D</code> | <code>edit.delete.eol</code> |
|
|
79
79
|
| C | <code>S</code> | <code>edit.change.line</code> |
|
|
80
80
|
| C | <code>Y</code> | <code>edit.line.copy</code> |
|
|
@@ -84,6 +84,7 @@ the number of its combinations that vimlike got.
|
|
|
84
84
|
| C | <code>ctrl-d</code> | <code>move.page.next.cursor</code> |
|
|
85
85
|
| C | <code>ctrl-f</code> | <code>move.page.next</code> |
|
|
86
86
|
| C | <code>ctrl-u</code> | <code>move.page.prev.cursor</code> |
|
|
87
|
+
| I | <code>ctrl-r <char></code> | <code>edit.insert.register</code> |
|
|
87
88
|
| V | <code>" <char></code> | <code>edit.register</code> |
|
|
88
89
|
| V | <code><</code> | <code>sel.indent.less</code> |
|
|
89
90
|
| V | <code>></code> | <code>sel.indent.more</code> |
|
|
@@ -98,11 +99,10 @@ the number of its combinations that vimlike got.
|
|
|
98
99
|
|
|
99
100
|
## vim keymap only
|
|
100
101
|
|
|
101
|
-
Left out of vimlike on purpose (`VIM_KEYMAP_ONLY`,
|
|
102
|
+
Left out of vimlike on purpose (`VIM_KEYMAP_ONLY`, key_bindings_vim_core.rb).
|
|
102
103
|
|
|
103
104
|
| Mode | Vim keys | Vim action | Why |
|
|
104
105
|
|---|---|---|---|
|
|
105
|
-
| I | <code>ctrl-r <char></code> | <code>edit.insert.register</code> | no new ctrl chords in vimlike |
|
|
106
106
|
|
|
107
107
|
## Shared
|
|
108
108
|
|
data/docker_cmd.sh
CHANGED
|
@@ -3,5 +3,5 @@ sudo gem install --local vimamsa-0.1.*.gem
|
|
|
3
3
|
cp /usr/local/bundle/gems/vimamsa-0.1.23/ext/vmaext/vmaext.so .
|
|
4
4
|
cp /usr/local/bundle/gems/vimamsa-0.1.23/ext/vmaext/vmaext.so lib/
|
|
5
5
|
# xvfb-run -a bundle exec ruby exe/run_tests.rb --test tests/test_basic_editing.rb
|
|
6
|
-
xvfb-run -a bundle exec ruby run_tests.rb
|
|
6
|
+
xvfb-run -a bundle exec ruby exe/run_tests.rb
|
|
7
7
|
|
data/exe/run_tests.rb
CHANGED
|
@@ -11,6 +11,41 @@
|
|
|
11
11
|
# # xvfb not installed); does not disturb
|
|
12
12
|
# # normal use; e2e kbd tests skip
|
|
13
13
|
|
|
14
|
+
USAGE = <<~TXT
|
|
15
|
+
Usage: ruby exe/run_tests.rb [--headless] [TESTS...] [CLASSES...] [OPTIONS...]
|
|
16
|
+
|
|
17
|
+
Runs vimamsa's integration tests inside one editor instance.
|
|
18
|
+
|
|
19
|
+
TESTS (any number; none = all tests/test_*.rb except the excluded ones):
|
|
20
|
+
tests/test_foo.rb a test file, by path
|
|
21
|
+
foo or test_foo shorthand for tests/test_foo.rb
|
|
22
|
+
foo,bar several shorthands
|
|
23
|
+
|
|
24
|
+
CLASSES:
|
|
25
|
+
TestFoo only run test classes with this name
|
|
26
|
+
|
|
27
|
+
OPTIONS:
|
|
28
|
+
--headless invisible display (xvfb-run, or GTK Broadway if
|
|
29
|
+
xvfb is not installed); e2e keyboard tests skip
|
|
30
|
+
duration=N test_random_edit: run time in seconds
|
|
31
|
+
ref=REF test_perf_startup: commit to compare with
|
|
32
|
+
runs=N test_perf_startup: startups per version
|
|
33
|
+
-h, --help show this help
|
|
34
|
+
|
|
35
|
+
Excluded from the default set (run them by name, one at a time for the
|
|
36
|
+
binding schemes): test_random_edit, test_notepad_bindings,
|
|
37
|
+
test_vim_bindings, test_perf_startup.
|
|
38
|
+
|
|
39
|
+
Env: VMA_USER_DIR (test config dir, default ~/.config/vimamsa-test),
|
|
40
|
+
VMA_UPDATE_DOC=1 (regenerate generated docs), VMA_E2E_DICTATION=1,
|
|
41
|
+
VMA_E2E_INTERACTIVE=1. More: doc/test_commands.md
|
|
42
|
+
TXT
|
|
43
|
+
|
|
44
|
+
if (ARGV & ["-h", "--help"]).any?
|
|
45
|
+
puts USAGE
|
|
46
|
+
exit 0
|
|
47
|
+
end
|
|
48
|
+
|
|
14
49
|
require "ripl/multi_line"
|
|
15
50
|
require "tempfile"
|
|
16
51
|
require "pathname"
|
|
@@ -94,14 +129,29 @@ end
|
|
|
94
129
|
|
|
95
130
|
# Expand comma-separated shorthand: "foo,bar" -> tests/test_foo.rb, tests/test_bar.rb
|
|
96
131
|
# Accepts both "foo" and "test_foo" as shorthand for tests/test_foo.rb.
|
|
132
|
+
# Anything not recognized stops the run: silently ignoring a mistyped name
|
|
133
|
+
# would fall back to running the whole default set.
|
|
134
|
+
unknown = []
|
|
97
135
|
raw_args.each do |a|
|
|
98
|
-
|
|
136
|
+
if a.end_with?(".rb")
|
|
137
|
+
unknown << a if !File.file?(a)
|
|
138
|
+
next
|
|
139
|
+
end
|
|
140
|
+
next if a.match?(/\A[A-Z]/)
|
|
141
|
+
if a.match?(/\A\w+=/)
|
|
142
|
+
unknown << a if a !~ /\A(duration|runs)=\d+\z|\Aref=\S+\z/
|
|
143
|
+
next
|
|
144
|
+
end
|
|
99
145
|
a.split(",").each do |name|
|
|
100
146
|
name = name.strip.sub(/\Atest_/, "")
|
|
101
147
|
path = File.join(scriptdir, "tests", "test_#{name}.rb")
|
|
102
|
-
test_files << path
|
|
148
|
+
File.file?(path) ? test_files << path : unknown << name
|
|
103
149
|
end
|
|
104
150
|
end
|
|
151
|
+
if unknown.any?
|
|
152
|
+
warn "run_tests.rb: unknown argument or test file: #{unknown.join(", ")} (see --help)"
|
|
153
|
+
exit 2
|
|
154
|
+
end
|
|
105
155
|
|
|
106
156
|
if test_files.empty?
|
|
107
157
|
test_files = Dir[File.join(scriptdir, "tests", "test_*.rb")].sort
|
|
@@ -123,6 +173,31 @@ $vma_test_class_filter = class_filter.empty? ? nil : class_filter
|
|
|
123
173
|
# VMA_USER_DIR). See vma_user_dir/get_dot_path in editor.rb.
|
|
124
174
|
$vma_user_dir = File.expand_path(ENV["VMA_USER_DIR"] || "~/.config/vimamsa-test")
|
|
125
175
|
|
|
176
|
+
# VMA_TEST_APP: run the tests with another build of the editor, e.g. an
|
|
177
|
+
# AppImage's AppRun (run_tests_vm.rb --appimage), instead of loading this
|
|
178
|
+
# checkout's code. The class filter goes along in VMA_TEST_CLASSES (only
|
|
179
|
+
# builds that read it use it; duration=/ref=/runs= don't). exe/vimamsa --test
|
|
180
|
+
# sets no exit code, so pass/fail comes from the last "Results:" line.
|
|
181
|
+
if !ENV["VMA_TEST_APP"].to_s.empty?
|
|
182
|
+
app = ENV["VMA_TEST_APP"]
|
|
183
|
+
# VMA_TEST_APP itself is not passed on: the editor doesn't use it, and in
|
|
184
|
+
# an AppImage it points into the AppImage (test_bundling.rb checks that
|
|
185
|
+
# nothing else does)
|
|
186
|
+
env = { "VMA_TEST_APP" => nil }
|
|
187
|
+
env["VMA_TEST_CLASSES"] = class_filter.join(",") if !class_filter.empty?
|
|
188
|
+
puts ">> Running the tests with #{app}"
|
|
189
|
+
$stdout.flush
|
|
190
|
+
ok = false
|
|
191
|
+
IO.popen(env, [app, "--user-dir", $vma_user_dir, "--test", *test_files], err: [:child, :out]) { |io|
|
|
192
|
+
io.each_line { |l|
|
|
193
|
+
print l
|
|
194
|
+
$stdout.flush
|
|
195
|
+
ok = l.match?(/Results: \d+ passed, 0 failed/) if l.include?("Results:")
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
exit(ok ? 0 : 1)
|
|
199
|
+
end
|
|
200
|
+
|
|
126
201
|
ARGV.replace(["--test"] + test_files)
|
|
127
202
|
|
|
128
203
|
require "vimamsa"
|