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.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
Propagate `Ctrl+[` as `Escape` to enter command mode with vim keybindings (#5635)
Trevor Manz8410fd616db5
diff --git a/frontend/src/core/codemirror/keymaps/vim.ts b/frontend/src/core/codemirror/keymaps/vim.tsindex 8795ce8ea5..52a97e7774 100644--- a/frontend/src/core/codemirror/keymaps/vim.ts+++ b/frontend/src/core/codemirror/keymaps/vim.ts@@ -1,7 +1,7 @@/* Copyright 2024 Marimo. All rights reserved. */import type { Extension } from "@codemirror/state";-import { type EditorView, keymap, ViewPlugin } from "@codemirror/view";+import { EditorView, keymap, ViewPlugin } from "@codemirror/view";import {type CodeMirror,type CodeMirrorV,@@ -84,6 +84,31 @@ export function vimKeymapExtension(): Extension[] {},},]),+ // Propagate Ctrl+[ to Escape for vim mode+ EditorView.domEventHandlers({+ keydown: (event, view) => {+ if (+ event.ctrlKey &&+ event.key === "[" &&+ !event.shiftKey &&+ !event.altKey &&+ !event.metaKey+ ) {+ event.preventDefault();+ // Dispatch a synthetic Escape event to the editor+ view.contentDOM.dispatchEvent(+ new KeyboardEvent("keydown", {+ key: "Escape",+ code: "Escape",+ bubbles: true,+ cancelable: true,+ }),+ );+ return true;+ }+ return false;+ },+ }),ViewPlugin.define((view) => {// Wait for the next animation frame so the CodeMirror instance is readyrequestAnimationFrame(() => {