Vim Agent Skills & AI Rules

GitHub

The official Vim repository

40,737 stars Vim Script 1 file ยท ~15,022 tokens #c#cross-platform#text-editor#vim
RAW Rules
1 Discovered Rules โ€ข ~723 Estimated Tokens
Quick:
Loading skill content...

AI Agent Protocol & Instructions

AGENTS.md root-instruction ~723 tokens
Raw
# VSCodeVim โ€” Agent Instructions

VSCodeVim is a VS Code extension (TypeScript) that emulates Vim modal editing. It targets both desktop and web VS Code environments.

## Build & Test

```bash
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 code
```

## Architecture

**Event 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 intentional
- `src/actions/plugins/` โ€” Emulated Vim plugins (easymotion, surround, sneak, commentary, etc.)
- `src/mode/modeHandler.ts` โ€” Central state machine; one instance per open editor
- `src/state/vimState.ts` โ€” Per-editor state (cursor, registers, mode, history)
- `src/state/recordedState.ts` โ€” Transient state for the current operation; resets after each action
- `src/cmd_line/` โ€” Ex command (`:`) parsing and execution
- `src/configuration/` โ€” Settings loading and validation
- `src/neovim/` โ€” Optional Neovim process integration for Ex commands
- `src/platform/node/` and `src/platform/browser/` โ€” Platform-specific abstractions
- `test/` โ€” Mirrors `src/` structure; uses Mocha + Sinon + `@vscode/test-electron`

**Three action base classes:**

- `BaseMovement` โ€” Updates cursor only; returns `Position` or `IMovement` (start+end for text objects)
- `BaseCommand` โ€” Modifies `VimState` beyond cursor movement
- `BaseOperator` โ€” Combines with a movement (e.g. `d{motion}`, `c{motion}`)

## Conventions

- TypeScript `strict: true` + `noImplicitOverride: true` โ€” always use the `override` keyword when overriding parent methods
- `IMovement` interface (not just `Position`) is required when a motion needs to return a range (e.g. text objects like `aw`, `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
- `.vimrc` support is remaps-only โ€” no full Vimscript execution
- Actions are registered by decorating classes; see existing action files for the pattern

## References

- [CONTRIBUTING.md](.github/CONTRIBUTING.md) โ€” Setup, architecture deep-dive, release process
- [README.md](README.md) โ€” All supported settings, emulated plugins, keybindings
- `gulpfile.js` โ€” Build/test/release automation tasks
- `package.json` โ€” Extension manifest, all configuration schema definitions (40+ settings)