test(keymaps): Vim path harness + fix 25 broken one-liner functions
CI / cargo fmt --check (push) Successful in 19s
CI / cargo clippy (push) Successful in 1m10s
CI / cargo test (push) Successful in 1m20s
CI / editor keymaps (push) Has been cancelled

User asked about the Vim path of the keymap suite. Building it
surfaced a real bug: 25 of our autoload functions were written as
`function! foo() abort | call bar() | endfunction` one-liners, which
isn't valid Vim syntax — `function!` requires a multi-line body, and
Vim parses the `|` after `abort` as an unexpected trailing character
(E488). Most invocations of the buggy autoload functions errored
out the moment Vim tried to parse them, which is why the user saw
broken keymaps and confusing diagnostics.

Rewrote all 25 one-liners (`autoload/nuwiki/commands.vim`) into the
standard three-line form. Affected groups: `diary_*`, `toggle_list_item`,
`cycle_list_item`, `reject_list_item`, `heading_add`, `heading_remove`,
`toc_generate`, `links_generate`, `export_current` / `_all` /
`_all_force` / `_rss`, and the §13.1 deferred stubs (`list_change_lvl`,
`list_remove_done`, `table_*`, `colorize`, `paste_link`, `paste_url`).

Added `scripts/test-keymaps-vim.{sh,vim}` — a Vim-side counterpart of
the Neovim harness covering the pure-VimL bindings (header nav,
link nav, `o`/`O` bullet continuation, `<CR>` wrap step). The
LSP-roundtrip bindings (`<C-Space>`, `=`, `-`, …) stay on the Neovim
side because vim-lsp's async layer uses timers that don't fire
inside `vim -e -s` headless mode — their server-side codepath is
already exercised by the Neovim harness and the cargo test suite.

Vim harness covers 12 cases: filetype + 2 command-presence smoke
tests, 4 header-nav (`]]`/`[[`/`]=`/`]u`), `<Tab>` link-nav, `<CR>`
wrap-on-first-press, and 3 bullet-continuation flows.

CI: extended the existing `keymaps` job to install both nvim + vim
and run both harnesses. Verified locally:

  Neovim harness:  19 passed, 0 failed
  Vim harness:     12 passed, 0 failed

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-12 12:41:46 +00:00
parent 3b6693129c
commit 5fdd7a842e
4 changed files with 311 additions and 32 deletions
+6 -3
View File
@@ -71,10 +71,13 @@ jobs:
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-test-
- name: install neovim
- name: install neovim + vim
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends neovim
sudo apt-get install -y --no-install-recommends neovim vim
nvim --version | head -1
- name: run keymap harness
vim --version | head -1
- name: run Neovim keymap harness
run: ./scripts/test-keymaps.sh
- name: run Vim keymap harness
run: ./scripts/test-keymaps-vim.sh