fix(tui): reserve control on macOS

This commit is contained in:
kshitijk4poor 2026-04-19 12:48:02 +05:30 committed by kshitij
parent 88396698ea
commit 1d0b94a1b9
6 changed files with 63 additions and 66 deletions

View file

@ -1,21 +1,28 @@
import { isMac } from '../lib/platform.js'
const mod = isMac ? 'Cmd' : 'Ctrl'
const pasteMod = isMac ? 'Cmd' : 'Alt'
const action = isMac ? 'Cmd' : 'Ctrl'
const paste = isMac ? 'Cmd' : 'Alt'
export const HOTKEYS: [string, string][] = [
[mod + '+C / ' + mod + '+Shift+C', 'copy selection'],
[mod + '+D', 'exit'],
[mod + '+G', 'open $EDITOR for prompt'],
[mod + '+L', 'new session (clear)'],
[pasteMod + '+V / /paste', 'paste clipboard image'],
...(
isMac
? ([
['Cmd+C', 'copy selection'],
['Ctrl+C', 'interrupt / clear draft / exit']
] as [string, string][])
: ([['Ctrl+C', 'copy selection / interrupt / clear draft / exit']] as [string, string][])
),
[action + '+D', 'exit'],
[action + '+G', 'open $EDITOR for prompt'],
[action + '+L', 'new session (clear)'],
[paste + '+V / /paste', 'paste clipboard image'],
['Tab', 'apply completion'],
['↑/↓', 'completions / queue edit / history'],
[mod + '+A/E', 'home / end of line'],
[mod + '+Z / ' + mod + '+Y', 'undo / redo input edits'],
[mod + '+W', 'delete word'],
[mod + '+U/K', 'delete to start / end'],
[mod + '+←/→', 'jump word'],
[action + '+A/E', 'home / end of line'],
[action + '+Z / ' + action + '+Y', 'undo / redo input edits'],
[action + '+W', 'delete word'],
[action + '+U/K', 'delete to start / end'],
[action + '+←/→', 'jump word'],
['Home/End', 'start / end of line'],
['Shift+Enter / Alt+Enter', 'insert newline'],
['\\+Enter', 'multi-line continuation (fallback)'],