@knightcodeai/cli-linux-arm64 0.9.1 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/CHANGELOG.md +50 -0
- package/bin/README.md +52 -19
- package/bin/docs/cli-integration.md +106 -0
- package/bin/docs/cli.md +270 -0
- package/bin/docs/compaction.md +56 -37
- package/bin/docs/configuration.md +46 -0
- package/bin/docs/containerization.md +86 -54
- package/bin/docs/custom-provider.md +132 -785
- package/bin/docs/docs.json +143 -103
- package/bin/docs/environment-variables.md +5 -4
- package/bin/docs/extensions.md +134 -2956
- package/bin/docs/how-knightcode-works.md +49 -0
- package/bin/docs/index.md +24 -69
- package/bin/docs/json.md +193 -65
- package/bin/docs/keybindings.md +56 -101
- package/bin/docs/llama-cpp.md +3 -3
- package/bin/docs/message-types.md +261 -0
- package/bin/docs/models.md +64 -547
- package/bin/docs/packages.md +66 -167
- package/bin/docs/prompt-templates.md +31 -68
- package/bin/docs/providers.md +103 -241
- package/bin/docs/quickstart.md +61 -106
- package/bin/docs/rpc-commands.md +854 -0
- package/bin/docs/rpc-extension-ui.md +200 -0
- package/bin/docs/rpc.md +129 -1556
- package/bin/docs/sdk.md +76 -1160
- package/bin/docs/security.md +70 -32
- package/bin/docs/session-format.md +25 -216
- package/bin/docs/sessions.md +38 -143
- package/bin/docs/settings.md +111 -389
- package/bin/docs/shell-aliases.md +85 -5
- package/bin/docs/skills.md +51 -189
- package/bin/docs/slash-commands.md +63 -0
- package/bin/docs/terminal-setup.md +107 -79
- package/bin/docs/termux.md +74 -83
- package/bin/docs/themes.md +68 -280
- package/bin/docs/tmux.md +31 -39
- package/bin/docs/tui.md +69 -923
- package/bin/docs/usage.md +79 -286
- package/bin/docs/windows.md +43 -17
- package/bin/export-html/template.js +6 -1
- package/bin/knightcode +2 -2
- package/bin/package.json +6 -6
- package/package.json +1 -1
- package/bin/docs/development.md +0 -71
package/bin/docs/themes.md
CHANGED
|
@@ -1,322 +1,110 @@
|
|
|
1
|
-
|
|
1
|
+
# Customize KnightCode with themes
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Themes control the colors KnightCode uses in interactive mode and HTML exports. KnightCode includes `dark` and `light` themes. You can select one theme, follow your terminal's light or dark appearance, or create your own palette.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<a id="selecting-a-theme"></a>
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Choose a theme
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
- [Selecting a Theme](#selecting-a-theme)
|
|
11
|
-
- [Creating a Custom Theme](#creating-a-custom-theme)
|
|
12
|
-
- [Theme Format](#theme-format)
|
|
13
|
-
- [Color Tokens](#color-tokens)
|
|
14
|
-
- [Color Values](#color-values)
|
|
15
|
-
- [Tips](#tips)
|
|
9
|
+
Open `/settings` and select **Theme**. You can use one theme for every terminal appearance or choose separate themes for light and dark terminals.
|
|
16
10
|
|
|
17
|
-
|
|
11
|
+
The selection is saved as the `theme` [setting](settings.md#terminal-and-display):
|
|
18
12
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
- Packages: `themes/` directories or `knightcode.themes` entries in `package.json`
|
|
25
|
-
- Settings: `themes` array with files or directories
|
|
26
|
-
- CLI: `--theme <path>` (repeatable)
|
|
27
|
-
|
|
28
|
-
Disable discovery with `--no-themes`.
|
|
29
|
-
|
|
30
|
-
## Selecting a Theme
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"theme": "dark"
|
|
16
|
+
}
|
|
17
|
+
```
|
|
31
18
|
|
|
32
|
-
|
|
19
|
+
Automatic mode stores the light theme first and the dark theme second:
|
|
33
20
|
|
|
34
21
|
```json
|
|
35
22
|
{
|
|
36
|
-
"theme": "
|
|
23
|
+
"theme": "light/dark"
|
|
37
24
|
}
|
|
38
25
|
```
|
|
39
26
|
|
|
40
|
-
|
|
27
|
+
When automatic mode is active, KnightCode changes themes when the terminal reports an appearance change. Theme names cannot contain `/` because KnightCode reserves it for this setting format.
|
|
41
28
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
Start an interactive run with a theme without changing the saved setting:
|
|
29
|
+
Use `--use-theme` to choose the initial theme for one invocation without changing the saved setting:
|
|
45
30
|
|
|
46
31
|
```bash
|
|
47
32
|
knightcode --use-theme light
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
To follow terminal appearance, use `lightTheme/darkTheme` syntax:
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
33
|
knightcode --use-theme light/dark
|
|
54
34
|
```
|
|
55
35
|
|
|
56
|
-
|
|
57
|
-
and saves it normally.
|
|
58
|
-
|
|
59
|
-
## Creating a Custom Theme
|
|
60
|
-
|
|
61
|
-
1. Create a theme file:
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
mkdir -p ~/.knightcode/agent/themes
|
|
65
|
-
vim ~/.knightcode/agent/themes/my-theme.json
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
2. Define the theme with all required colors (see [Color Tokens](#color-tokens)):
|
|
36
|
+
See [CLI resources](cli.md#resources) for the command-line option.
|
|
69
37
|
|
|
70
|
-
|
|
71
|
-
{
|
|
72
|
-
"$schema": "https://raw.githubusercontent.com/KnightCodeAI/knightcode/main/packages/cli/src/modes/interactive/theme/theme-schema.json",
|
|
73
|
-
"name": "my-theme",
|
|
74
|
-
"vars": {
|
|
75
|
-
"primary": "#00aaff",
|
|
76
|
-
"secondary": 242
|
|
77
|
-
},
|
|
78
|
-
"colors": {
|
|
79
|
-
"accent": "primary",
|
|
80
|
-
"border": "primary",
|
|
81
|
-
"borderAccent": "#00ffff",
|
|
82
|
-
"borderMuted": "secondary",
|
|
83
|
-
"success": "#00ff00",
|
|
84
|
-
"error": "#ff0000",
|
|
85
|
-
"warning": "#ffff00",
|
|
86
|
-
"muted": "secondary",
|
|
87
|
-
"dim": 240,
|
|
88
|
-
"text": "",
|
|
89
|
-
"thinkingText": "secondary",
|
|
90
|
-
"selectedBg": "#2d2d30",
|
|
91
|
-
"scrollbarTrack": "secondary",
|
|
92
|
-
"scrollbarThumb": "",
|
|
93
|
-
"searchMatchBg": "#2d2d30",
|
|
94
|
-
"searchMatchText": "",
|
|
95
|
-
"userMessageBg": "#2d2d30",
|
|
96
|
-
"userMessageText": "",
|
|
97
|
-
"customMessageBg": "#2d2d30",
|
|
98
|
-
"customMessageText": "",
|
|
99
|
-
"customMessageLabel": "primary",
|
|
100
|
-
"toolPendingBg": "#1e1e2e",
|
|
101
|
-
"toolSuccessBg": "#1e2e1e",
|
|
102
|
-
"toolErrorBg": "#2e1e1e",
|
|
103
|
-
"toolTitle": "primary",
|
|
104
|
-
"toolOutput": "",
|
|
105
|
-
"mdHeading": "#ffaa00",
|
|
106
|
-
"mdLink": "primary",
|
|
107
|
-
"mdLinkUrl": "secondary",
|
|
108
|
-
"mdCode": "#00ffff",
|
|
109
|
-
"mdCodeBlock": "",
|
|
110
|
-
"mdCodeBlockBorder": "secondary",
|
|
111
|
-
"mdQuote": "secondary",
|
|
112
|
-
"mdQuoteBorder": "secondary",
|
|
113
|
-
"mdHr": "secondary",
|
|
114
|
-
"mdListBullet": "#00ffff",
|
|
115
|
-
"toolDiffAdded": "#00ff00",
|
|
116
|
-
"toolDiffRemoved": "#ff0000",
|
|
117
|
-
"toolDiffContext": "secondary",
|
|
118
|
-
"syntaxComment": "secondary",
|
|
119
|
-
"syntaxKeyword": "primary",
|
|
120
|
-
"syntaxFunction": "#00aaff",
|
|
121
|
-
"syntaxVariable": "#ffaa00",
|
|
122
|
-
"syntaxString": "#00ff00",
|
|
123
|
-
"syntaxNumber": "#ff00ff",
|
|
124
|
-
"syntaxType": "#00aaff",
|
|
125
|
-
"syntaxOperator": "primary",
|
|
126
|
-
"syntaxPunctuation": "secondary",
|
|
127
|
-
"thinkingOff": "secondary",
|
|
128
|
-
"thinkingMinimal": "primary",
|
|
129
|
-
"thinkingLow": "#00aaff",
|
|
130
|
-
"thinkingMedium": "#00ffff",
|
|
131
|
-
"thinkingHigh": "#ff00ff",
|
|
132
|
-
"thinkingXhigh": "#ff0000",
|
|
133
|
-
"thinkingMax": "#ff0088",
|
|
134
|
-
"bashMode": "#ffaa00"
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
```
|
|
38
|
+
## Create a custom theme
|
|
138
39
|
|
|
139
|
-
|
|
40
|
+
Copy one of the [built-in themes](https://github.com/KnightCodeAI/knightcode/tree/main/packages/cli/src/modes/interactive/theme) or create a new JSON file conforming to the [schema](https://github.com/KnightCodeAI/knightcode/blob/main/packages/cli/src/modes/interactive/theme/theme-schema.json).
|
|
140
41
|
|
|
141
|
-
|
|
42
|
+
1. Save the file as `<agent-dir>/themes/my-theme.json`. The agent directory defaults to `~/.knightcode/agent`.
|
|
43
|
+
2. Set its `name` to `my-theme`.
|
|
44
|
+
3. Change values in `vars` and `colors`.
|
|
45
|
+
4. Select `my-theme` through `/settings`.
|
|
142
46
|
|
|
143
|
-
|
|
47
|
+
Use the theme name as the filename. KnightCode hot-reloads the active user theme only from `<agent-dir>/themes/<name>.json`. Run `/reload` after adding or changing a theme from any other source.
|
|
144
48
|
|
|
145
|
-
|
|
146
|
-
{
|
|
147
|
-
"$schema": "https://raw.githubusercontent.com/KnightCodeAI/knightcode/main/packages/cli/src/modes/interactive/theme/theme-schema.json",
|
|
148
|
-
"name": "my-theme",
|
|
149
|
-
"vars": {
|
|
150
|
-
"blue": "#0066cc",
|
|
151
|
-
"gray": 242
|
|
152
|
-
},
|
|
153
|
-
"colors": {
|
|
154
|
-
"accent": "blue",
|
|
155
|
-
"muted": "gray",
|
|
156
|
-
"text": "",
|
|
157
|
-
...
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
```
|
|
49
|
+
## Understand the theme file
|
|
161
50
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
Every theme must define all 53 required color tokens. The optional tokens preserve compatibility with existing themes: `thinkingMax` falls back to `thinkingXhigh`, `searchMatchBg` falls back to `selectedBg`, and `searchMatchText` falls back to `text`. Other search matches use `searchMatchText` on `searchMatchBg` with an underline; the current match reverses that foreground/background pair and uses bold text.
|
|
171
|
-
|
|
172
|
-
### Core UI (13 colors)
|
|
173
|
-
|
|
174
|
-
| Token | Purpose |
|
|
175
|
-
|-------|---------|
|
|
176
|
-
| `accent` | Primary accent (logo, selected items, cursor) |
|
|
177
|
-
| `border` | Normal borders |
|
|
178
|
-
| `borderAccent` | Highlighted borders |
|
|
179
|
-
| `borderMuted` | Subtle borders (editor) |
|
|
180
|
-
| `success` | Success states |
|
|
181
|
-
| `error` | Error states |
|
|
182
|
-
| `warning` | Warning states |
|
|
183
|
-
| `muted` | Secondary text |
|
|
184
|
-
| `dim` | Tertiary text |
|
|
185
|
-
| `text` | Default text (usually `""`) |
|
|
186
|
-
| `thinkingText` | Thinking block text |
|
|
187
|
-
| `scrollbarTrack` | Fullscreen scrollbar track foreground |
|
|
188
|
-
| `scrollbarThumb` | Fullscreen scrollbar thumb foreground, shared by normal and expanded states |
|
|
189
|
-
|
|
190
|
-
### Backgrounds & Content (11 required, 2 optional)
|
|
191
|
-
|
|
192
|
-
| Token | Purpose |
|
|
193
|
-
|-------|---------|
|
|
194
|
-
| `selectedBg` | Selected line background |
|
|
195
|
-
| `searchMatchBg` | Transcript search match background and current-match text; optional, falls back to `selectedBg` |
|
|
196
|
-
| `searchMatchText` | Transcript search match text and current-match background; optional, falls back to `text` |
|
|
197
|
-
| `userMessageBg` | User message background |
|
|
198
|
-
| `userMessageText` | User message text |
|
|
199
|
-
| `customMessageBg` | Extension message background |
|
|
200
|
-
| `customMessageText` | Extension message text |
|
|
201
|
-
| `customMessageLabel` | Extension message label |
|
|
202
|
-
| `toolPendingBg` | Tool box (pending) |
|
|
203
|
-
| `toolSuccessBg` | Tool box (success) |
|
|
204
|
-
| `toolErrorBg` | Tool box (error) |
|
|
205
|
-
| `toolTitle` | Tool title |
|
|
206
|
-
| `toolOutput` | Tool output text |
|
|
207
|
-
|
|
208
|
-
### Markdown (10 colors)
|
|
209
|
-
|
|
210
|
-
| Token | Purpose |
|
|
211
|
-
|-------|---------|
|
|
212
|
-
| `mdHeading` | Headings |
|
|
213
|
-
| `mdLink` | Link text |
|
|
214
|
-
| `mdLinkUrl` | Link URL |
|
|
215
|
-
| `mdCode` | Inline code |
|
|
216
|
-
| `mdCodeBlock` | Code block content |
|
|
217
|
-
| `mdCodeBlockBorder` | Code block fences |
|
|
218
|
-
| `mdQuote` | Blockquote text |
|
|
219
|
-
| `mdQuoteBorder` | Blockquote border |
|
|
220
|
-
| `mdHr` | Horizontal rule |
|
|
221
|
-
| `mdListBullet` | List bullets |
|
|
222
|
-
|
|
223
|
-
### Tool Diffs (3 colors)
|
|
224
|
-
|
|
225
|
-
| Token | Purpose |
|
|
226
|
-
|-------|---------|
|
|
227
|
-
| `toolDiffAdded` | Added lines |
|
|
228
|
-
| `toolDiffRemoved` | Removed lines |
|
|
229
|
-
| `toolDiffContext` | Context lines |
|
|
230
|
-
|
|
231
|
-
### Syntax Highlighting (9 colors)
|
|
232
|
-
|
|
233
|
-
| Token | Purpose |
|
|
234
|
-
|-------|---------|
|
|
235
|
-
| `syntaxComment` | Comments |
|
|
236
|
-
| `syntaxKeyword` | Keywords |
|
|
237
|
-
| `syntaxFunction` | Function names |
|
|
238
|
-
| `syntaxVariable` | Variables |
|
|
239
|
-
| `syntaxString` | Strings |
|
|
240
|
-
| `syntaxNumber` | Numbers |
|
|
241
|
-
| `syntaxType` | Types |
|
|
242
|
-
| `syntaxOperator` | Operators |
|
|
243
|
-
| `syntaxPunctuation` | Punctuation |
|
|
244
|
-
|
|
245
|
-
### Thinking Level Borders (6 required, 1 optional)
|
|
246
|
-
|
|
247
|
-
Editor border colors indicating thinking level (visual hierarchy from subtle to prominent):
|
|
248
|
-
|
|
249
|
-
| Token | Purpose |
|
|
250
|
-
|-------|---------|
|
|
251
|
-
| `thinkingOff` | Thinking off |
|
|
252
|
-
| `thinkingMinimal` | Minimal thinking |
|
|
253
|
-
| `thinkingLow` | Low thinking |
|
|
254
|
-
| `thinkingMedium` | Medium thinking |
|
|
255
|
-
| `thinkingHigh` | High thinking |
|
|
256
|
-
| `thinkingXhigh` | Extra high thinking |
|
|
257
|
-
| `thinkingMax` | Maximum thinking; optional, falls back to `thinkingXhigh` |
|
|
258
|
-
|
|
259
|
-
### Bash Mode (1 color)
|
|
260
|
-
|
|
261
|
-
| Token | Purpose |
|
|
262
|
-
|-------|---------|
|
|
263
|
-
| `bashMode` | Editor border in bash mode (`!` prefix) |
|
|
264
|
-
|
|
265
|
-
### HTML Export (optional)
|
|
266
|
-
|
|
267
|
-
The `export` section controls colors for `/export` HTML output. If omitted, colors are derived from `userMessageBg`.
|
|
51
|
+
| Property | Required | Responsibility |
|
|
52
|
+
|---|---|---|
|
|
53
|
+
| `$schema` | No | Enables editor validation and completion against KnightCode's published schema. |
|
|
54
|
+
| `name` | Yes | Identifies the theme in selectors and settings. It must be unique and cannot contain `/`. |
|
|
55
|
+
| `vars` | No | Defines reusable color values. Variables can reference other variables. |
|
|
56
|
+
| `colors` | Yes | Assigns colors to terminal UI roles. The schema identifies required and optional roles. |
|
|
57
|
+
| `export` | No | Overrides page and panel backgrounds in HTML exports. |
|
|
268
58
|
|
|
269
|
-
|
|
270
|
-
{
|
|
271
|
-
"export": {
|
|
272
|
-
"pageBg": "#18181e",
|
|
273
|
-
"cardBg": "#1e1e24",
|
|
274
|
-
"infoBg": "#3c3728"
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
```
|
|
59
|
+
A color can be written in four forms:
|
|
278
60
|
|
|
279
|
-
|
|
61
|
+
| Form | Example | Meaning |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| RGB hexadecimal | `"#00aaff"` | A six-digit RGB color. |
|
|
64
|
+
| 256-color index | `39` | An ANSI palette index from `0` through `255`. |
|
|
65
|
+
| Variable reference | `"primary"` | The value of an entry in `vars`. |
|
|
66
|
+
| Terminal default | `""` | The terminal's default foreground or background color. |
|
|
280
67
|
|
|
281
|
-
|
|
68
|
+
KnightCode resolves chained variable references. A missing variable or circular reference makes the theme invalid. Hexadecimal colors use truecolor when supported and are approximated in terminals limited to 256 colors. If colors differ from their hexadecimal values, check your terminal's truecolor detection and contrast settings. See [Configure Your Terminal](terminal-setup.md#override-detected-capabilities).
|
|
282
69
|
|
|
283
|
-
|
|
284
|
-
|--------|---------|-------------|
|
|
285
|
-
| Hex | `"#ff0000"` | 6-digit hex RGB |
|
|
286
|
-
| 256-color | `39` | xterm 256-color palette index (0-255) |
|
|
287
|
-
| Variable | `"primary"` | Reference to a `vars` entry |
|
|
288
|
-
| Default | `""` | Terminal's default color |
|
|
70
|
+
Use the [theme JSON schema](https://github.com/KnightCodeAI/knightcode/blob/main/packages/cli/src/modes/interactive/theme/theme-schema.json) for the exact properties, required colors, and accepted value types.
|
|
289
71
|
|
|
290
|
-
|
|
72
|
+
KnightCode reports invalid theme files during startup and `/reload`.
|
|
291
73
|
|
|
292
|
-
|
|
293
|
-
- `16-231`: 6×6×6 RGB cube (`16 + 36×R + 6×G + B` where R,G,B are 0-5)
|
|
294
|
-
- `232-255`: Grayscale ramp
|
|
74
|
+
## Find the color to change
|
|
295
75
|
|
|
296
|
-
|
|
76
|
+
Theme colors describe interface roles rather than individual components. Use these groups to find the relevant part of the schema:
|
|
297
77
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
78
|
+
| Area | Color names |
|
|
79
|
+
|---|---|
|
|
80
|
+
| General interface | `accent`, `border*`, `text`, `muted`, `dim`, `success`, `error`, `warning` |
|
|
81
|
+
| Selection and fullscreen | `selectedBg`, `searchMatch*`, `scrollbar*` |
|
|
82
|
+
| Messages | `userMessage*`, `customMessage*`, `thinkingText` |
|
|
83
|
+
| Tool execution | `toolPendingBg`, `toolSuccessBg`, `toolErrorBg`, `toolTitle`, `toolOutput` |
|
|
84
|
+
| Markdown | `md*` |
|
|
85
|
+
| Tool diffs | `toolDiff*` |
|
|
86
|
+
| Syntax highlighting | `syntax*` |
|
|
87
|
+
| Editor modes | `thinking*`, `bashMode` |
|
|
88
|
+
| HTML export | `export.pageBg`, `export.cardBg`, `export.infoBg` |
|
|
305
89
|
|
|
306
|
-
|
|
90
|
+
The schema is the format reference. The built-in themes provide complete values that you can copy and adjust.
|
|
307
91
|
|
|
308
|
-
|
|
92
|
+
Five colors are optional and inherit another color when omitted:
|
|
309
93
|
|
|
310
|
-
|
|
94
|
+
| Optional color | Fallback |
|
|
95
|
+
|---|---|
|
|
96
|
+
| `scrollbarTrack` | `muted` |
|
|
97
|
+
| `scrollbarThumb` | `text` |
|
|
98
|
+
| `searchMatchBg` | `selectedBg` |
|
|
99
|
+
| `searchMatchText` | `text` |
|
|
100
|
+
| `thinkingMax` | `thinkingXhigh` |
|
|
311
101
|
|
|
312
|
-
|
|
102
|
+
If `export` colors are omitted, KnightCode derives HTML page and panel backgrounds from `userMessageBg`.
|
|
313
103
|
|
|
314
|
-
|
|
104
|
+
## Load a theme from a project or package
|
|
315
105
|
|
|
316
|
-
|
|
106
|
+
Place a project theme in `.knightcode/themes/`. Project themes load only after [project trust](security.md#understand-project-trust) is granted.
|
|
317
107
|
|
|
318
|
-
|
|
108
|
+
You can also load theme files and directories through the `themes` setting or distribute them in a KnightCode package. See [Configuration](configuration.md), [Settings](settings.md#resources), and [KnightCode Packages](packages.md).
|
|
319
109
|
|
|
320
|
-
|
|
321
|
-
- [dark.json](../src/modes/interactive/theme/dark.json)
|
|
322
|
-
- [light.json](../src/modes/interactive/theme/light.json)
|
|
110
|
+
Each loaded theme must have a unique name. KnightCode reports duplicate names as resource collisions.
|
package/bin/docs/tmux.md
CHANGED
|
@@ -1,63 +1,55 @@
|
|
|
1
|
-
# tmux
|
|
1
|
+
# Run KnightCode in tmux
|
|
2
2
|
|
|
3
|
-
KnightCode works inside tmux, but tmux
|
|
3
|
+
KnightCode works inside tmux, but tmux can report `Shift+Enter`, `Ctrl+Enter`, and plain `Enter` as the same key. Enable extended keys so KnightCode can distinguish them.
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
Add to `~/.tmux.conf`:
|
|
8
|
-
|
|
9
|
-
```tmux
|
|
10
|
-
set -g extended-keys on
|
|
11
|
-
set -g extended-keys-format csi-u
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
Then restart tmux fully:
|
|
5
|
+
## Check your tmux version
|
|
15
6
|
|
|
16
7
|
```bash
|
|
17
|
-
tmux
|
|
18
|
-
tmux
|
|
8
|
+
tmux -V
|
|
19
9
|
```
|
|
20
10
|
|
|
21
|
-
|
|
11
|
+
For tmux 3.5 or newer, use the recommended CSI-u configuration below. For tmux 3.2 through 3.4, use the older-version configuration.
|
|
22
12
|
|
|
23
|
-
##
|
|
13
|
+
## Enable extended keys in tmux 3.5 or newer
|
|
24
14
|
|
|
25
|
-
|
|
15
|
+
Add these lines to `~/.tmux.conf`:
|
|
26
16
|
|
|
27
17
|
```tmux
|
|
28
18
|
set -g extended-keys on
|
|
19
|
+
set -g extended-keys-format csi-u
|
|
29
20
|
```
|
|
30
21
|
|
|
31
|
-
|
|
22
|
+
KnightCode requests extended-key reporting when the terminal does not provide the Kitty keyboard protocol directly. CSI-u is the most reliable format for forwarding modified keys through tmux.
|
|
32
23
|
|
|
33
|
-
|
|
34
|
-
- `Ctrl+D` → `\x1b[27;5;100~`
|
|
35
|
-
- `Ctrl+Enter` → `\x1b[27;5;13~`
|
|
24
|
+
## Restart tmux
|
|
36
25
|
|
|
37
|
-
|
|
26
|
+
The configuration applies to the tmux server. To guarantee that it is active, close your tmux sessions and start a new server.
|
|
38
27
|
|
|
39
|
-
|
|
40
|
-
- `Ctrl+D` → `\x1b[100;5u`
|
|
41
|
-
- `Ctrl+Enter` → `\x1b[13;5u`
|
|
28
|
+
If you choose to stop the server from the command line, save your work first. This command terminates every session managed by that server:
|
|
42
29
|
|
|
43
|
-
|
|
30
|
+
```bash
|
|
31
|
+
tmux kill-server
|
|
32
|
+
tmux
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Verify modified keys
|
|
44
36
|
|
|
45
|
-
|
|
37
|
+
Start KnightCode inside the new tmux session and check that:
|
|
46
38
|
|
|
47
|
-
|
|
39
|
+
1. `Shift+Enter` inserts a new line in the editor.
|
|
40
|
+
2. `Enter` submits the prompt.
|
|
41
|
+
3. `Alt+Enter` queues a follow-up on macOS and Linux. Windows and WSL use `Ctrl+Q` by default.
|
|
48
42
|
|
|
49
|
-
|
|
50
|
-
|-----|-----------------|--------------|
|
|
51
|
-
| Enter | `\r` | `\r` |
|
|
52
|
-
| Shift+Enter | `\r` | `\x1b[13;2u` |
|
|
53
|
-
| Ctrl+Enter | `\r` | `\x1b[13;5u` |
|
|
54
|
-
| Alt/Option+Enter | `\x1b\r` | `\x1b[13;3u` |
|
|
43
|
+
If these keys still behave like plain `Enter`, verify that the terminal outside tmux can report modified keys. See [Configure your terminal](terminal-setup.md).
|
|
55
44
|
|
|
56
|
-
|
|
45
|
+
## Use tmux 3.2 through 3.4
|
|
57
46
|
|
|
58
|
-
|
|
47
|
+
These versions support extended keys but not `extended-keys-format csi-u`. Add only:
|
|
48
|
+
|
|
49
|
+
```tmux
|
|
50
|
+
set -g extended-keys on
|
|
51
|
+
```
|
|
59
52
|
|
|
60
|
-
|
|
61
|
-
- A terminal emulator that supports extended keys (Ghostty, Kitty, iTerm2, WezTerm, Windows Terminal)
|
|
53
|
+
KnightCode supports the xterm `modifyOtherKeys` format used by these versions. Restart tmux and repeat the verification steps.
|
|
62
54
|
|
|
63
|
-
|
|
55
|
+
For older versions, upgrade tmux or use KnightCode outside tmux rather than relying on modified Enter shortcuts.
|