Commit Graph

4 Commits

  • 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"
    }
  • Add Kitty keyboard protocol support for Shift+Enter and other modifier keys
    Enable the Kitty keyboard protocol on terminal start to receive enhanced
    key sequences that include modifier information. This fixes Shift+Enter
    not working in Ghostty, Kitty, WezTerm, and other modern terminals.
    
    Changes:
    - Enable Kitty protocol on start (\x1b[>1u), disable on stop (\x1b[<u)
    - Add centralized key definitions in packages/tui/src/keys.ts
    - Support both legacy and Kitty sequences for all modifier+key combos:
      - Shift+Enter, Alt+Enter for newlines
      - Shift+Tab for thinking level cycling
      - Ctrl+C, Ctrl+A, Ctrl+E, Ctrl+K, Ctrl+U, Ctrl+W, Ctrl+O, Ctrl+P, Ctrl+T
      - Alt+Backspace for word deletion
    - Export Keys constants and helper functions from @mariozechner/pi-tui
  • feat(tui): improve editor Ctrl/Alt word and line deletion shortcuts
    - Add Ctrl+W for word deletion (stops at whitespace/punctuation)
    - Add Ctrl+U for delete to start of line (merges with previous line at col 0)
    - Change Ctrl+K from delete entire line to delete to end of line (merges with next line at EOL)
    - Add Option+Backspace support in Ghostty (maps to Ctrl+W via ESC+DEL sequence)
    - Cmd+Backspace in Ghostty works as Ctrl+U (terminal sends same control code)
    - Update README and CHANGELOG with new keyboard shortcuts
    
    Fixes #2, Fixes #3