Skip to content

feat: support command: prefix in keymap actions#15

Open
WayneKent wants to merge 1 commit into
Tarquinen:mainfrom
WayneKent:feat/command-prefix-clean
Open

feat: support command: prefix in keymap actions#15
WayneKent wants to merge 1 commit into
Tarquinen:mainfrom
WayneKent:feat/command-prefix-clean

Conversation

@WayneKent

Copy link
Copy Markdown

Summary

Add command: prefix support to keymap actions. Users can now bind arbitrary opencode commands via the vim plugin keymaps.

Usage

"keymaps": {
  "normal": {
    "<C-k>": "command:prompt.history.previous",
    "<C-j>": "command:prompt.history.next"
  },
  "insert": {
    "<C-k>": "command:prompt.history.previous",
    "<C-j>": "command:prompt.history.next"
  }
}

Available commands can be found in opencode source: packages/tui/src/component/prompt/index.tsx and packages/tui/src/config/keybind.ts.

Notes

  • For prompt.history.previous and prompt.history.next, the vim plugin automatically moves the cursor to the start/end before dispatching. If you prefer the default opencode behavior (cursor must already be at the start/end, otherwise first press only moves cursor), configure these keybinds in opencode's own keybinds config instead of the vim plugin's keymaps.
  • English configuration.md and Chinese documentation will be updated once PR feat: <CR> respects mode-specific keymaps #14 (feat/cr-mode-aware) is merged. This PR contains only the implementation.

Allow users to bind arbitrary opencode commands via the `command:` prefix
in keymap values, e.g. `"<C-k>": "command:prompt.history.previous"`.
Supported in both normal and insert mode.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant