@replit/codemirror-vscode-keymap
TypeScript icon, indicating that this package has built-in type declarations

6.0.2 • Public • Published

CodeMirror VSCode Keymap

Run on Replit badge NPM version badge

Ports VSCode's keyboard shortcuts to CodeMirror 6.

This keymap includes shortcuts for all the official extension and replaces codemirror default keymaps:

  • autocomplete (make sure to set defaultKeymap: false when enabling this plugin)
  • closebrackets
  • commands
  • comment
  • fold
  • history
  • lint
  • search

The keymap is based on the following:

Usage

import { EditorView, keymap } from '@codemirror/view';
import { EditorState } from '@codemirror/state';
import { javascript } from '@codemirror/lang-javascript';
import { vscodeKeymap } from "@replit/codemirror-vscode-keymap";

const doc = `
function wow() {
  function hello() {
    console.log({
      lol: 1
    })
  }
}
`

new EditorView({
  state: EditorState.create({
    doc,
    extensions: [keymap.of(vscodeKeymap), javascript()],
  }),
  parent: document.querySelector('#editor'),
});

Missing features

  • Scroll Line Down Ctrl+Down
  • Scroll Line Up Ctrl+Up
  • Scroll Page Down Alt+PageDown
  • Scroll Page Up Alt+PageUp

Readme

Keywords

none

Package Sidebar

Install

npm i @replit/codemirror-vscode-keymap

Weekly Downloads

2,190

Version

6.0.2

License

MIT

Unpacked Size

31.6 kB

Total Files

14

Last publish

Collaborators

  • jonesit-replit
  • ltazmin_replit
  • stkenned
  • moudy
  • lhchavez
  • masad-frost
  • ryantm
  • tobyho
  • cbrewster
  • theflowingsky
  • brianpool
  • brenoafb
  • ink404
  • alexisreplit
  • replitdstewart
  • ryanweingast
  • mikewesthad
  • jackyzha0
  • szymon_k
  • lopezhoracio
  • jamesaustinreplit
  • talorreplit