Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

feat(hotkeys): add configurable completion selection movement (#3475)

eugene8b6b6d3b41fd
diff --git a/docs/guides/editor_features/hotkeys.md b/docs/guides/editor_features/hotkeys.md
index 9f1799cd25..c29f6da3f1 100644
--- a/docs/guides/editor_features/hotkeys.md
+++ b/docs/guides/editor_features/hotkeys.md
@@ -36,6 +36,8 @@ You can find a list of available hotkeys below:
| `cell.unfold` |
| `cell.unfoldAll` |
| `cell.viewAsMarkdown` |
+| `completion.moveDown` |
+| `completion.moveUp` |
| `global.commandPalette` |
| `global.focusBottom` |
| `global.focusTop` |
diff --git a/frontend/src/core/codemirror/cm.ts b/frontend/src/core/codemirror/cm.ts
index 43a3358fb9..4b044cce82 100644
--- a/frontend/src/core/codemirror/cm.ts
+++ b/frontend/src/core/codemirror/cm.ts
@@ -173,8 +173,7 @@ export const basicBundle = (opts: CodeMirrorSetupOpts): Extension[] => {
preventDefault: true,
},
{
- key: "Alt-j",
- mac: "Ctrl-j",
+ key: hotkeys.getHotkey("completion.moveDown").key,
run: (cm) => {
if (completionStatus(cm.state) !== null) {
moveCompletionSelection(true)(cm);
@@ -185,8 +184,7 @@ export const basicBundle = (opts: CodeMirrorSetupOpts): Extension[] => {
preventDefault: true,
},
{
- key: "Alt-k",
- mac: "Ctrl-k",
+ key: hotkeys.getHotkey("completion.moveUp").key,
run: (cm) => {
if (completionStatus(cm.state) !== null) {
moveCompletionSelection(false)(cm);
diff --git a/frontend/src/core/hotkeys/hotkeys.ts b/frontend/src/core/hotkeys/hotkeys.ts
index aac24ef105..8a06b18f1d 100644
--- a/frontend/src/core/hotkeys/hotkeys.ts
+++ b/frontend/src/core/hotkeys/hotkeys.ts
@@ -344,6 +344,16 @@ const DEFAULT_HOT_KEY = {
group: "Navigation",
key: "F12",
},
+ "completion.moveDown": {
+ name: "Move completion selection down",
+ group: "Editing",
+ key: "Ctrl-j",
+ },
+ "completion.moveUp": {
+ name: "Move completion selection up",
+ group: "Editing",
+ key: "Ctrl-k",
+ },
} satisfies Record<string, Hotkey>;
export type HotkeyAction = keyof typeof DEFAULT_HOT_KEY;