VSCodeVim is a VS Code extension (TypeScript) that emulates Vim modal editing. It targets both desktop and web VS Code environments.
yarn build-dev # Fast dev build
yarn build # Production build
yarn watch # Rebuild on file changes
yarn build-test && yarn test # Run tests locally (close all VS Code instances first)
npx gulp test # Run tests in Docker (preferred)
npx gulp test --grep <REGEX> # Run filtered tests in Docker
yarn lint # Check code style
yarn lint:fix # Auto-fix linting issues
yarn prettier # Format codeEvent flow: Key press → extension.ts → ModeHandler.handleKeyEvent() → action matching → runAction() → updateView()
Key directories:
src/actions/— All command/motion/operator implementations; large consolidated files (e.g.insert.ts,search.ts) are intentionalsrc/actions/plugins/— Emulated Vim plugins (easymotion, surround, sneak, commentary, etc.)src/mode/modeHandler.ts— Central state machine; one instance per open editorsrc/state/vimState.ts— Per-editor state (cursor, registers, mode, history)src/state/recordedState.ts— Transient state for the current operation; resets after each actionsrc/cmd_line/— Ex command (:) parsing and executionsrc/configuration/— Settings loading and validationsrc/neovim/— Optional Neovim process integration for Ex commandssrc/platform/node/andsrc/platform/browser/— Platform-specific abstractionstest/— Mirrorssrc/structure; uses Mocha + Sinon +@vscode/test-electron
Three action base classes:
BaseMovement— Updates cursor only; returnsPositionorIMovement(start+end for text objects)BaseCommand— ModifiesVimStatebeyond cursor movementBaseOperator— Combines with a movement (e.g.d{motion},c{motion})
- TypeScript
strict: true+noImplicitOverride: true— always use theoverridekeyword when overriding parent methods IMovementinterface (not justPosition) is required when a motion needs to return a range (e.g. text objects likeaw,i{)- Platform abstraction via
/src/platform/— never call Node.js APIs directly; use the abstraction layer so web VS Code works - Settings precedence: Ex-commands → user/workspace VS Code settings → defaults
.vimrcsupport is remaps-only — no full Vimscript execution- Actions are registered by decorating classes; see existing action files for the pattern
- CONTRIBUTING.md — Setup, architecture deep-dive, release process
- README.md — All supported settings, emulated plugins, keybindings
gulpfile.js— Build/test/release automation taskspackage.json— Extension manifest, all configuration schema definitions (40+ settings)