Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Version

### Added

- `:q`, `:quit`, and `:wq` quit OpenCode from the command palette ([#19](https://github.com/oribarilan/vimcode/issues/19)). Since `:` already opens the palette, typing `:q` and pressing Enter exits the app.
- `Ctrl+O` in insert mode — run one normal-mode command, then return to insert. Motions, operators, counts, and `r{char}` all work.
- `leader` plugin option — lets you use space (or any key) as leader without breaking insert mode. Spaces type normally while editing, and leader sequences like `space l` still work in normal mode ([#21](https://github.com/oribarilan/vimcode/issues/21)).

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ All normal-mode motions work for extending the selection: `h` `j` `k` `l` `w` `b
| `Ctrl+r` | Redo |
| `p` | Paste from yank register |
| `:` | Command palette |
| `:q` `:quit` `:wq` | Quit OpenCode (via command palette) |
| `/` | Jump to message (session timeline) |
| `[` `]` | Scroll conversation half-page up/down |
| `{` `}` | Jump to previous/next message |
Expand Down
13 changes: 13 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,19 @@ const plugin: TuiPluginModule = {
checkForUpdate((opts) => api.ui?.toast?.(opts), api.kv);
}

// Register vim ex-commands in the command palette so that
// :q, :quit, and :wq work as expected.
const quit = {
category: "Vim",
description: "Exit OpenCode",
onSelect: () => setTimeout(() => api.keymap.dispatchCommand("app.exit"), 0),
};
api.command?.register?.(() => [
{ ...quit, title: "q", value: "vimcode.q" },
{ ...quit, title: "quit", value: "vimcode.quit" },
{ ...quit, title: "wq", value: "vimcode.wq" },
]);

api.keymap.intercept(
"key",
(ctx) => {
Expand Down
Loading