github saberzero1/motions 0.54.0

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

Added

  • Which-key auto-resolves Obsidian command names for :obcommand mappings — when a key is mapped to :obcommand <id><CR> or :ob <id><CR> without an explicit desc, the which-key popup now displays Obsidian's native command name instead of the raw ex command string. For example, :ob app:go-back<CR> displays as "Navigate back". Explicit desc options still take priority. Unknown command IDs fall back to the raw string. Descriptions are automatically localized — Obsidian's built-in commands already have localized names, so descriptions match the user's Obsidian language setting. Works in both editor which-key (leader bindings, vim.keymap.set) and global which-key (:gmap, vim.obsidian.keymap.set). (#62)
    • Plugin: src/ui/which-key.ts (lookupObsidianCommandName(), resolveObCommandDescription(), OB_COMMAND_RHS_RE regex matching both literal spaces and <Space> notation), src/ui/global-which-key.ts (describeAction() obcommand resolution)

Changed

  • Consolidated Obsidian internal API access into src/util/ utilities — extracted typed accessor functions for 6 internal Obsidian APIs, replacing ~40 inline (x as unknown as { ... }) casts across 16 files. Each utility centralizes the unsafe cast in one location and exposes a clean typed function:
    • src/util/commands.ts: executeCommand(app, id), getCommandRegistry(app) — 20 casts across 11 files
    • src/util/editor.ts: getEditorView(view) — extracts CM6 EditorView from MarkdownView, replacing 6 inline casts across 5 files
    • src/util/leaf.ts: getLeafId(leaf), isLeafPinned(leaf), getViewFilePath(view), getViewFileBasename(view) — 12 casts across 3 files
    • src/util/metadata.ts: getResolvedLinks(app) — 2 casts across 2 files
    • src/util/vault.ts: getVaultConfig(app, key), isBuiltinVimEnabled(app) — 4 casts across 4 files
    • src/util/keymap.ts: pushKeymapScope(app, scope), popKeymapScope(app, scope) — 3 casts in 1 file

Tests

  • 22 unit tests in test/unit/which-key.test.ts: lookupObsidianCommandName() (4 tests), describeKeymapEntry() without app (6 tests), describeKeymapEntry() with app and obcommand auto-resolution (12 tests covering :ob/:obcommand short/long form, <CR> variants, <Space> separator, unknown commands, label priority, edge cases)
  • 6 e2e tests in test/specs/which-key-obcommand.e2e.ts: editor which-key auto-resolution for :ob and :obcommand (2 tests), explicit desc priority (1 test), unknown command fallback (1 test), global which-key auto-resolution via registry API (1 test), global unknown command fallback (1 test)

Full Changelog: 0.53.0...0.54.0

Don't miss a new motions release

NewReleases is sending notifications on new releases.