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.

fix: remove Alt-` for completions (#5609)

Myles Scolnick7c5cd6fc2701
diff --git a/frontend/src/core/codemirror/completion/keymap.ts b/frontend/src/core/codemirror/completion/keymap.ts
index 1d5f2ad364..492b7606e9 100644
--- a/frontend/src/core/codemirror/completion/keymap.ts
+++ b/frontend/src/core/codemirror/completion/keymap.ts
@@ -11,9 +11,22 @@ import type { EditorView } from "@codemirror/view";
import { keymap } from "@codemirror/view";
import { isInVimMode } from "../utils";
+const KEYS_TO_REMOVE = new Set<string | undefined>([
+ // Remove Escape since it affects exiting insert mode in Vim
+ // Issue: https://github.com/marimo-team/marimo/issues/4351
+ "Escape",
+
+ // Remove Alt-` since this affects Italian keyboards from using backticks.
+ // Issue: https://github.com/marimo-team/marimo/issues/5606
+ // Alt-` is set to startCompletion on macOS which is likely not used,
+ // Completions is still done via Ctrl-Space and Alt-i.
+ // See https://github.com/codemirror/autocomplete/blob/ab0a89942b237bbc13735604b018d10c0101b5ea/src/index.ts#L40-L42
+ "Alt-`",
+]);
+
export function completionKeymap(): Extension {
- const withoutEscape = defaultCompletionKeymap.filter(
- (binding) => binding.key !== "Escape",
+ const withoutKeysToRemove = defaultCompletionKeymap.filter(
+ (binding) => !KEYS_TO_REMOVE.has(binding.key),
);
const closeCompletionAndPropagate = (view: EditorView) => {
@@ -27,7 +40,7 @@ export function completionKeymap(): Extension {
return Prec.highest(
keymap.of([
- ...withoutEscape,
+ ...withoutKeysToRemove,
// We add our own Escape binding to accept the completion
// The default codemirror behavior is to close the completion
// when Escape is pressed and the completion is Pending or Active.