# terminal/keys (zidane-ui/terminal)

Import: `import { … } from 'zidane-ui/terminal'`. Source: [ui/src/terminal/keys.ts](https://github.com/Tahul/zidane/blob/main/ui/src/terminal/keys.ts).

## Functions

### `macTerminalKey`

Function.

macOS text-editing keys in a terminal, the way Terminal.app and iTerm2's
"Natural Text Editing" preset send them: the bytes a shell's line editor
(zsh, bash/readline, fish) already understands by default.

⌘⌫ delete to line start (^U)      ⌥⌫ delete word back (ESC DEL)
⌘⌦ delete to line end (^K)        ⌥⌦ delete word forward (ESC d)
⌘← / ⌘→ line start / end (^A / ^E)
⌥← / ⌥→ word back / forward (ESC b / ESC f)

Returns `null` for everything else, which keeps its usual path.

```ts
function macTerminalKey(
  event: Pick<KeyboardEvent, 'key' | 'metaKey' | 'altKey' | 'ctrlKey' | 'shiftKey'>,
): string | null
```

**Parameters**

- `event` (`Pick<KeyboardEvent, 'key' | 'metaKey' | 'altKey' | 'ctrlKey' | 'shiftKey'>`): The key and modifiers of a keydown.

**Returns** `string | null`

Source: [ui/src/terminal/keys.ts:15](https://github.com/Tahul/zidane/blob/main/ui/src/terminal/keys.ts#L15)
