Skip to main content

Vim Keybindings for CodeMirror 6

Bring the power and efficiency of Vim to your CodeMirror 6 editor with full support for normal, visual, and insert modes.

Quick Start

Get up and running with Vim keybindings in minutes.

Installation

Install the package and add it to your CodeMirror setup

Quickstart

Build your first Vim-enabled editor

Key Features

Complete Vim Experience

Full support for normal, visual, and insert modes with authentic Vim behavior

Custom Key Mappings

Map custom keys and define your own Vim commands

Ex Commands

Support for Vim ex commands with extensibility

Visual Mode

Visual block and line selection with all standard Vim operations

Status Bar

Optional status bar showing current mode and command state

CM5 Compatible

Drop-in compatibility layer for CodeMirror 5 Vim API

Explore the Documentation

Key Mappings

Learn how to customize key mappings

Custom Operators

Define custom operators, actions, and motions

API Reference

Explore the complete API documentation

Migration Guide

Migrate from CodeMirror 5 Vim

Example

import { basicSetup, EditorView } from 'codemirror';
import { vim } from "@replit/codemirror-vim"

let view = new EditorView({
  doc: "",
  extensions: [
    // Make sure vim is included before other keymaps
    vim(), 
    // Include the default keymap and all other keymaps you want to use in insert mode
    basicSetup, 
  ],
  parent: document.querySelector('#editor'),
})
Make sure to include the vim extension before other keymaps to ensure proper key handling priority.

Open Source

CodeMirror Vim is open source and maintained by Replit. Contributions are welcome!

View on GitHub

Star the repository, report issues, or contribute to the project

Build docs developers (and LLMs) love