github saberzero1/motions 0.40.0

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

Added

  • vim.keymap.set leader bindings appear in which-key — leader-prefixed keymaps registered via vim.keymap.set with a desc option now automatically appear in the which-key overlay, matching vim.obsidian.leader.add behavior. Group labels from vim.obsidian.whichkey.add() work with both vim.keymap.set and vim.obsidian.leader.add bindings. Buffer-local keymaps (buffer = 0) are excluded from global which-key. (#27)
    • Plugin: src/lua/api.ts (leader prefix auto-detection in vim.keymap.set), src/main.ts (consume luaResult.leaderBindings in LeaderRegistry)
  • Synthetic BufEnter for initial file — BufEnter autocmds now fire for the file already open when the plugin loads, matching Neovim behavior. Previously, BufEnter only fired on subsequent file opens.
    • Plugin: src/lua/autocmd.ts (activate() accepts initialFilePath), src/lua/loader.ts (passes current file path)

Fixed

  • vim.cmd() broken at runtime — vim.cmd() called from function-mapped keymaps, autocmd callbacks, timer callbacks, and user commands silently failed because commands were queued but never executed after initial load. Fixed with a runtimeExHandler that executes commands immediately via vim.handleEx(). Cleanup on plugin unload prevents stale callbacks. (#49, #27)
    • Plugin: src/lua/loader.ts (runtimeExHandler, activateRuntimeExHandler, deactivateRuntimeExHandler), src/main.ts (wire runtime handler, cleanup in onunload)
  • Function-callback keymaps lost after feature reload — vim.keymap.set with function callbacks registered keymaps that were silently destroyed when reloadFeatures() called vim.resetKeymap(). String-RHS keymaps survived but function callbacks did not. Fixed by moving applyLuaMaps() to run after reloadFeatures() and clearing luaActionNames in loadLuaConfigForTest().
    • Plugin: src/main.ts (applyLuaMaps ordering, loadLuaConfigForTest cleanup)
  • Space as leader key breaks which-key — vim.g.mapleader = " " with which-key in "all" mode now works correctly: space doesn't move the cursor, bindings execute, and grouped which-key displays. The "leader-only" mode still has a known limitation (see KNOWN_LIMITATIONS.md). (#49)
  • Surround nvim-surround parity (19 golden test fixes) — comprehensive alignment with nvim-surround semantics. Golden comparison tests passing: 54 → 73 out of 74. (#41)
    • ds} / ds] / ds) / ds> now preserve inner spaces (only opening bracket forms ds{ / ds[ / ds( / ds< strip spaces)
    • csbBysaBb chain — _surroundType gating prevents stale replacement leaking across different surround operation types
    • csba.. dot-repeat — search position offset by replacement delimiter width for correct nested pair iteration
    • dsb on multiline content — cursor clamped to valid line length after bracket deletion
    • Count-prefixed ds/cs (2dsb, 3dsb, 2csbB, 3csbr) — changed from "find Nth pair" to "apply N times" semantics, matching nvim-surround
    • ys with line-crossing motions (ysjb, ys2jB) — linewise motions now expand range to full lines
    • ySS/VSB/cS/yS/gS newline indentation — single-line content no longer gets extra 2-space indent, matching nvim-surround
    • VS (linewise visual surround) — selection expanded to full lines, uses newline wrapping mode
    • Visual block Ctrl-V $ S} — each line wrapped individually instead of entire block
    • dsf — new operator: delete surrounding function call (some_func(args) → args), with nested call support
    • Fork: src/vim.js — deleteSurroundPair space/cursor, findSurroundingFunction, count loops, linewise/block visual handling, _surroundType dot-repeat isolation
    • Fork: src/types.ts — _surroundType field on InputStateInterface

Documentation

  • docs/configuration/lua-config.md: added leader key subsection with vim.g.mapleader examples and ordering warning; added tip callout comparing vim.cmd() vs vim.obsidian.leader.add() for leader bindings
  • docs/configuration/which-key.md: added "Automatic labels from vim.keymap.set" section documenting desc option integration with which-key and group label composition with wk.add()
  • KNOWN_LIMITATIONS.md: added 7 Lua runtime entries (4 fixed, 3 open); updated test coverage (9 → 43 e2e tests); updated surround parity section
  • 34 new e2e tests across 4 suites — lua-runtime.e2e.ts (8 tests: runtime vim.cmd execution from all callback contexts), lua-leader-whichkey.e2e.ts (9 tests: leader binding registration and which-key integration), lua-space-leader.e2e.ts (7 tests: space as leader key with regression coverage), lua-doc-examples.e2e.ts (10 tests: every documented Lua runtime callback example)
  • Shared test helpers extracted — loadLuaConfig, focusEditor, setWhichKeyMode, hasWhichKeyOverlay, waitForWhichKey, getWhichKeyKeys, getWhichKeyDescriptions, getWhichKeyGroups, getLeaderBindings, getLeaderKey, getPluginSetting moved to test/helpers.ts from local definitions

Full Changelog: 0.39.0...0.40.0

Don't miss a new motions release

NewReleases is sending notifications on new releases.