github saberzero1/motions 0.24.0

latest releases: 1.4.0, 1.3.1, 1.3.0...
3 months ago

Changed

  • Formatting mark cursor fix rewritten — replaced RangeSetBuilder.prototype monkey-patching with a CM6 EditorState.transactionFilter that corrects cursor positioning near formatting marks in Live Preview. The new approach walks the Lezer syntax tree to identify formatting mark nodes and snaps cursor endpoints that land inside mark ranges to the nearest boundary. Includes end-of-line boundary handling to prevent cursor oscillation when formatting marks extend to the line end (e.g. **he** with no trailing content). This eliminates conflicts with obsidian-latex-suite (#32) and fixes formatting marks being visible in live preview (#33). The 'always' formatting mark mode has been removed (users are migrated to 'cursor').

Added

  • Block visual insert (I/A), change (c/C) — CTRL-V block visual mode now supports I (insert at left column), A (append at right column), c (change block), and C (change to EOL) with multi-cursor editing on all selected lines. Text appears on all lines in real-time as you type (unlike Neovim, where text only appears on the primary cursor until <Esc>). Short lines that don't reach the block column are skipped, matching Neovim behavior. Dot-repeat (.) works for block insert operations. Block visual delete (d), yank (y), paste (p/P), indent (>/<), replace (r), and case toggle (~) were already working.
    • Fork: enterInsertMode preserves wasInVisualBlock before exitVisualMode clears the flag
    • Fork: selectForInsert skips lines shorter than the block column instead of clipping
    • Fork: operators.change adds a vim.visualBlock path for block change and block change-to-EOL
    • Fork: exitInsertMode positions cursor at the block's left column via blockInsertLeft instead of the standard ch - 1, matching Neovim's cursor placement after block A
    • Fork: makeCmSelection block mode treats fromCh === toCh (zero-width block) the same as fromCh < toCh, fixing C on zero-width blocks
    • Fork: repeatInsertModeChanges uses blockInsertLeft for cursor placement after dot-repeat instead of hardcoded +1
  • Neovim golden comparison tests for block visual: 13 golden test cases in test/specs/vim-builtin/visual-block-golden.e2e.ts covering insert, append, change, change-to-EOL, delete, case toggle, replace, short-line handling, block yank/paste, zero-width block C, zero-width block I, A cursor position, and upward selection
  • Spike test suite test/specs/spikes/spike-block-insert.e2e.ts with 10 tests covering all block visual insert scenarios
  • Command index entries: CTRL-V_I, CTRL-V_A, CTRL-V_c, CTRL-V_C, q, @, @@
  • Neovim golden comparison tests for marks: 5 golden test cases in test/specs/vim-builtin/marks-golden.e2e.ts covering ma/'a, `b, '., '', ``
  • Neovim golden comparison tests for macros: 5 golden test cases in test/specs/vim-builtin/macros-golden.e2e.ts covering qa/@a, 2@a, @@, 3@a, insert replay
  • Expanded register golden tests: 3 new cases ("Ayy append, "0p numbered register, "a/"b independent) in normal-yank-put suite
  • Expanded search/replace golden tests: 2 new cases (:%s global, :2,3s range) in ex-commands-builtin suite
  • Formatting mark cursor golden tests: 3 new cases (w through **, f past **, e through backticks) in normal-motions suite

Fixed

  • Vimrc whichkeygroup/whichkeylabel commands crash on load — defineEx('whichkeygroup', 'wkg', ...) threw Error: (Vim.defineEx) "wkg" is not a prefix of "whichkeygroup" because defineEx requires the short form to be an actual starting substring of the command name, not an arbitrary abbreviation. Same issue for whichkeylabel/wkl. Fixed by changing the prefixes to valid substrings: whichkeyg and whichkeyl. User-facing vimrc syntax (whichkeygroup, whichkeylabel) is unchanged. The set whichkeygrouping/set wkg option alias (handled by a separate KNOWN_SET_OPTIONS path) was already correct and unaffected. (#31)
  • Block visual mode deviations removed — all CTRL-V block visual deviations in test/neovim/deviations.ts have been removed. Block insert/change now matches Neovim output with zero deviations: cursor position after A exit is correct, short lines are skipped, and zero-width blocks work for all operators.
  • Golden recording infrastructure — test/neovim/record-golden.ts now sends <Esc><Esc> before each test case to reset Neovim to normal mode, preventing stale visual/insert mode state from leaking between test cases. This fixed 5 pre-existing incorrect golden values in g-commands.json (3 mode corrections) and visual-mode.json (1 mode correction, 1 cursor + mode correction).
  • Search dispatch in test wrapper — test/neovim/test-wrapper.ts now detects /pattern\n and ?pattern\n search sequences and dispatches the search + post-keys separately with a settle pause, improving reliability for search-dependent golden tests.

Documentation

  • KNOWN_LIMITATIONS.md: added "Block visual mode (CTRL-V) insert not supported (Fixed)" section
  • DIFFERENCES.md (fork): added "Block visual insert (I/A), change (c/C)" section documenting all 6 fork changes
  • README.md: added block visual insert/change to recommended setup section

Full Changelog: 0.23.0...0.24.0

Don't miss a new motions release

NewReleases is sending notifications on new releases.