mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-17 04:02:21 +00:00
feat: configurable keybindings for all editor and app actions
All keybindings configurable via ~/.pi/agent/keybindings.json
Editor actions:
- cursorUp, cursorDown, cursorLeft, cursorRight
- cursorWordLeft, cursorWordRight, cursorLineStart, cursorLineEnd
- deleteCharBackward, deleteCharForward, deleteWordBackward
- deleteToLineStart, deleteToLineEnd
- newLine, submit, tab
- selectUp, selectDown, selectConfirm, selectCancel
App actions:
- interrupt, clear, exit, suspend
- cycleThinkingLevel, cycleModelForward, cycleModelBackward
- selectModel, expandTools, toggleThinking, externalEditor
Also adds support for numpad Enter key (Kitty protocol codepoint 57414
and SS3 M sequence)
Example emacs-style keybindings.json:
{
"cursorUp": ["up", "ctrl+p"],
"cursorDown": ["down", "ctrl+n"],
"cursorLeft": ["left", "ctrl+b"],
"cursorRight": ["right", "ctrl+f"],
"deleteCharForward": ["delete", "ctrl+d"],
"cycleModelForward": "ctrl+o"
}
This commit is contained in:
parent
5f91baa29e
commit
8f2682578b
23 changed files with 949 additions and 1048 deletions
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env node
|
||||
import { isCtrlC } from "../src/keys.js";
|
||||
import { matchesKey } from "../src/keys.js";
|
||||
import { ProcessTerminal } from "../src/terminal.js";
|
||||
import { type Component, TUI } from "../src/tui.js";
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ class KeyLogger implements Component {
|
|||
|
||||
handleInput(data: string): void {
|
||||
// Handle Ctrl+C (raw or Kitty protocol) for exit
|
||||
if (isCtrlC(data)) {
|
||||
if (matchesKey(data, "ctrl+c")) {
|
||||
this.tui.stop();
|
||||
console.log("\nExiting...");
|
||||
process.exit(0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue