дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-08 19:02:17 +02:00
Built-in Vim emulation on @replit/codemirror-vim (approved dependency), modelled on IdeaVim: `vim.toggle` (Tools › Vim, status widget, Settings › Editor › Vim), mode widget (NORMAL / INSERT / VISUAL / V-LINE / V-BLOCK / REPLACE), IdeaVim-style shortcut conflict handlers (Vim / IDE per key) through a generic `registerKeyClaim()` in the keymap dispatcher, Escape closing popups first, a safe subset of ~/.openideavimrc / ~/.ideavimrc (set, map variants, mapleader, :action / <Action>()), Ex commands :w :wa :q :qa :wq :x :action. Covers file editors, diff editable side and merge result via a new `embeddedEditorExtensions` extension point. Verified in the app on macOS: motions/operators, i/Esc/V mode widget, :w saves, Ctrl+R redoes in Vim without running Run, toggling off restores plain editing. Not verified on Windows/Linux. Fixes #27 https://claude.ai/code/session_01VUYsdXA2nkF5v6zsC93dpn
18 рядки
703 B
TypeScript
18 рядки
703 B
TypeScript
/** The Vim mode of the focused (or last focused) Vim editor, for the status bar widget. */
|
|
import { create } from "zustand";
|
|
|
|
export interface VimModeState {
|
|
/** codemirror-vim's mode: `normal`, `insert`, `visual`, `replace`. */
|
|
mode: string;
|
|
/** Visual sub-mode. */
|
|
sub: "linewise" | "blockwise" | null;
|
|
}
|
|
|
|
export const useVimMode = create<VimModeState>(() => ({ mode: "normal", sub: null }));
|
|
|
|
/** IdeaVim's widget text: NORMAL, INSERT, VISUAL, V-LINE, V-BLOCK, REPLACE. */
|
|
export function modeLabel({ mode, sub }: VimModeState): string {
|
|
if (mode === "visual") return sub === "linewise" ? "V-LINE" : sub === "blockwise" ? "V-BLOCK" : "VISUAL";
|
|
return (mode || "normal").toUpperCase();
|
|
}
|