• This repository has been archived on 22/Aug/2019
  • Stars
    star
    160
  • Rank 234,703 (Top 5 %)
  • Language
    JavaScript
  • Created almost 12 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Emmet plugin for CodeMirror online editor

Deprecated: use codemirror-plugin instead with upcoming Emmet 2.0


Emmet plugin for CodeMirror 4.x+

To add Emmet support for CodeMirror editor, simply add dist/emmet.js as a <script> tag into your HTML page right after CodeMirror script. This script creates global emmetCodeMirror function but also can be loaded as Require.JS module. You should pass CodeMirror editor instance to emmetCodeMirror() to add Emmet support.

var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
	mode : 'text/html',
	
	// define Emmet output profile
	profile: 'xhtml'
});
emmetCodeMirror(editor);

Available profiles are: html, xhtml, xml, but you can create your own output profile with emmetCodeMirror.emmet.loadProfiles({name: options}).

See profile.js for a list of available options.

Default keybindings

  • Cmd-E or Tab: Expand abbreviation
  • Cmd-D: Balance Tag (matches opening and closing tag pair)
  • Shift-Cmd-D: Balance Tag Inward
  • Shift-Cmd-A: Wrap With Abbreviation
  • Ctrl-Alt-Right: Next Edit Point
  • Ctrl-Alt-Left: Previous Edit Point
  • Cmd-L: Select line
  • Cmd-Shift-M: Merge Lines
  • Cmd-/: Toggle Comment
  • Cmd-J: Split/Join Tag
  • Cmd-K: Remove Tag
  • Shift-Cmd-Y: Evaluate Math Expression
  • Ctrl-Up: Increment Number by 1
  • Ctrl-Down: Decrement Number by 1
  • Ctrl-Alt-Up: Increment Number by 0.1
  • Ctrl-Alt-Down: Decrement Number by 0.1
  • Shift-Ctrl-Up: Increment Number by 10
  • Shift-Ctrl-Down: Decrement Number by 10
  • Shift-Cmd-.: Select Next Item
  • Shift-Cmd-,: Select Previous Item
  • Cmd-B: Reflect CSS Value

Overriding keybindings

The emmetCodeMirror() function simply adds default Emmet action keybindings to editor instance. If you want your own keybindings or disable some of them, simply pass keymap (object) as second argument to emmetCodeMirror() method:

emmetCodeMirror(editor, {
    'Tab': 'emmet.expand_abbreviation_with_tab',
    'Cmd-Alt-B': 'emmet.balance_outward'
});

See defaultKeymap for available actions. The default keymap is exposed as emmetCodeMirror.defaultKeymap property.

NB: The Cmd key will be automatically replaced with Ctrl on non-OSX platforms.

Building from source

This plugin uses gulp.js as build tool:

  1. Install Node.JS and NPM.
  2. Install Gulp.js: npm install -g gulp
  3. Clone this repo and cd to cloned dir:
  4. In cloned repo run npm install and gulp to build project. The build tool will create dist/emmet.js file.

More Repositories

1

emmet

The essential toolkit for web-developers
TypeScript
4,431
star
2

emmet-atom

Emmet support for Atom
CoffeeScript
767
star
3

pyv8-binaries

Archive of pre-compiled PyV8 binaries
710
star
4

brackets-emmet

Emmet plugin for Brackets editor
JavaScript
485
star
5

emmet-eclipse

Emmet for Eclipse
JavaScript
343
star
6

emmet-docs

Emmet Docs & Tutorials
JavaScript
270
star
7

livestyle-sublime-old

Live bi-directional CSS edit of new generation
Python
260
star
8

sublime-text-plugin

The essential toolkit for web-developers
Python
253
star
9

sublime-tern

TernJS plugin for Sublime Text
JavaScript
222
star
10

Emmet.codaplugin

Emmet plugin for Coda
JavaScript
206
star
11

re-view

A Google Chrome extension for displaying responsive breakpoints view
JavaScript
204
star
12

livestyle-web

Emmet LiveStyle web-site
CSS
120
star
13

textarea

Emmet plugin for <textarea>
JavaScript
119
star
14

Emmet.tmplugin

Emmet plugin for TextMate
JavaScript
97
star
15

dreamweaver

Emmet for Dreamweaver
JavaScript
85
star
16

snippets

Emmet HTML snippets
JavaScript
71
star
17

codemirror-plugin

Emmet plugin for CodeMirror web editor
TypeScript
69
star
18

Emmet.sugar

Emmet plugin for Espresso editor
JavaScript
58
star
19

atom-plugin

Experimental Atom plugin for new Emmet
JavaScript
48
star
20

emmet-objc

Objective-C to JavaScript binding of Emmet
JavaScript
48
star
21

py-emmet

Emmet abbreviation parser and expander, implemented in Python
Python
39
star
22

expand-abbreviation

Reference implementation of Emmet abbreviation expander
JavaScript
35
star
23

codemirror6-plugin

WIP Plugin for CodeMirror 6
TypeScript
34
star
24

nova-plugin

Emmet plugin for Panicโ€™s Nova editor
TypeScript
26
star
25

web

Project web-site
JavaScript
19
star
26

pspad

Emmet plugin for PSPad
JavaScript
16
star
27

re-view-chrome

Emmet Re:view 2 extension for Google Chrome
JavaScript
15
star
28

textmate2

Emmet plugin for TextMate 2
8
star
29

math-expression

Parse & evaluate simple math expressions
TypeScript
8
star
30

abbreviation

Emmet standalone abbreviation parser (WIP)
JavaScript
8
star
31

monaco-plugin

Emmet for Monaco editor
TypeScript
5
star
32

html-transform

Prepares given Emmet abbreviation for HTML output
JavaScript
4
star
33

extract-abbreviation

Extracts Emmet abbreviation from string
JavaScript
4
star
34

html-matcher

Matches HTML/XML tag pairs in source code
TypeScript
4
star
35

markup-formatters

Outputs parsed Emmet abbreviation as markup (HTML, HAML, Slim, Pug etc.)
JavaScript
4
star
36

css-parser

CSS/LESS/SCSS fast and minimalistic parser
JavaScript
4
star
37

Emmetoss

Extended snippets for Emmet toolkit
3
star
38

lorem

Transforms parsed Emmet abbreviation node into Lorem Ipsum stub text
JavaScript
2
star
39

xml-diff

Diff and patch contents of XML documents
TypeScript
2
star
40

string-stream

String stream reader, used in many Emmet projects to parse strings
JavaScript
2
star
41

snippets-registry

JavaScript module for storing and retrieving Emmet snippets
JavaScript
2
star
42

stream-reader

Reads text as stream
JavaScript
2
star
43

action-utils

Utilities for Emmet actions
TypeScript
1
star
44

css-snippets-resolver

Resolves CSS snippets for parsed Emmet abbreviation
JavaScript
1
star
45

re-view-web

Emmet Re:view web-site
CSS
1
star
46

css-abbreviation

Emmet CSS abbreviation parser
JavaScript
1
star
47

css-matcher

Fast and small CSS/LESS/SCSS matcher
TypeScript
1
star
48

stylesheet-analyzer

Implementation of LESS and SCSS preprocessors, used for in-editor code analysis
JavaScript
1
star
49

lodash

A private copy of Lo-Dash lib, without template() method
JavaScript
1
star
50

field-parser

Fields (tab-stops) parser
JavaScript
1
star
51

stream-reader-utils

Common utility methods for stream reader
JavaScript
1
star
52

implicit-tag

Resolves best matching child tag name for given parent name
JavaScript
1
star