Open-source project
mattn/emmet-vim avatar
mattn/emmet-vim

emmet-vim: HTML abbreviation expansion inside Vim and Neovim

emmet for vim: http://emmet.io/

6,466 stars414 forksVim ScriptMIT

At a glance

What is it?
emmet-vim is a Vim plugin that expands Emmet-style abbreviations such as html:5 into full markup. It suits Vim users writing HTML and CSS by hand, and it stops being the right tool once you want a language server.
Who is it for?
Adopt emmet-vim if you already edit HTML or CSS in Vim or Neovim and want abbreviation expansion without leaving the editor. Skip it if you want a language server that also serves other editors.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Activity is slowing. The repository last received commits 7 months ago.
What is it written in?
Mainly Vim Script, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • mattn/emmet-vim6,466 ★ · +2
Star history
Repository2026-09-232026-11-15
mattn/emmet-vim6.5k6.5k

2 Stars in the last 53 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

The problem emmet-vim solves for Vim users

Writing HTML by hand means typing the same structural boilerplate repeatedly: doctype, html, head, meta charset, title, body. emmet-vim is a Vim plug-in that "provides support for expanding abbreviations similar to emmet", per the README. You type a short abbreviation, press a trigger key, and the plugin replaces it with the expanded markup.

The intended user is someone who already lives in Vim and writes front-end markup there. The plugin does not try to be an editor, a formatter or a validator. It sits in the expansion step of the editing loop. If your workflow is a full IDE with a language server, this is a narrower tool than what you already have; if your workflow is a terminal and a .vimrc, it removes a specific kind of typing.

How expansion works and where the code lives

The repository layout shows the mechanism. plugin/ holds the Vim script that registers mappings and commands. autoload/ holds the lazily loaded implementation, and autoload/emmet is a directory, which the manual install instructions copy as a whole with cp -a. There is also a lua/ directory in the repository root, though the README's installation and configuration sections describe the Vim script path only.

The flow is straightforward: the plugin maps a trigger key, reads the abbreviation text before the cursor, looks up a matching snippet definition, and writes the expansion back into the buffer. Snippet definitions are configurable through g:user_emmet_settings, which the README shows as a Vim dictionary with variables, default_attributes and snippets keys. The README also documents an alternative path: with webapi-vim installed, g:user_emmet_settings can be built by decoding a JSON file, so definitions can live outside .vimrc. The README does not describe how conflicts between the two configuration routes are resolved, and it does not document rollback of an expansion beyond Vim's own undo.

Installing emmet-vim and expanding your first abbreviation

The README lists several install routes. With vim-plug, add one line to your .vimrc and run the plugin manager's install command:

vim
Plug 'mattn/emmet-vim'

Vundle uses the same shape with the Plugin keyword. Pathogen users clone into the bundle directory instead:

sh
cd ~/.vim/bundle
git clone https://github.com/mattn/emmet-vim.git

The README also documents a manual copy for people who do not use a manager:

sh
git clone https://github.com/mattn/emmet-vim.git
cd emmet-vim
cp plugin/emmet.vim ~/.vim/plugin/
cp autoload/emmet.vim ~/.vim/autoload/
cp -a autoload/emmet ~/.vim/autoload/

For a first real use, open an HTML file and type an abbreviation, then press the trigger. The README's quick tutorial uses html:5:

sh
vim index.html

With the cursor after html:5, press Ctrl-y then comma. The README states you should see a full HTML5 document: doctype, html with lang="en", head with meta charset UTF-8 and an empty title, and a body containing the cursor. If nothing happens, the README's FAQ points at timeoutlen=0 as the likely cause, since key-mapping plugins do not work with that setting.

Scoping the plugin to html and css only

By default the plugin is global. Two settings change that. g:user_emmet_mode accepts 'n' for normal mode only, 'inv' for all functions, and 'a' for all functions in all modes. The README's comment says 'inv' enables all functions and is equal to the 'a' setting that follows it, which is worth reading twice: if you set the mode expecting a restriction and pick 'inv', you get the unrestricted behavior back.

The second setting is file-type scoping. Setting g:user_emmet_install_global to 0 and adding an autocmd for html and css file types means the mappings appear only in those buffers:

vim
let g:user_emmet_install_global = 0
autocmd FileType html,css EmmetInstall

That is the configuration I would expect most people to want, because a bare Ctrl-y mapping in every buffer competes with other plugins. The README does not list which other plugins are known to conflict, so the practical check is your own mapping list. The trigger itself is remappable: g:user_emmet_leader_key changes the leader, and the README notes the trailing comma still has to be typed, so setting it to '<C-Z>' gives you Ctrl-Z then comma.

Custom snippets, and the webapi-vim dependency they pull in

Custom snippets are where the configuration gets less tidy. The README offers two mechanisms. The first is a plain Vim dictionary assigned to g:user_emmet_settings, which can override variables, default attributes per element, and snippet bodies. The README's example rewrites html:5 to add a viewport meta tag and to set lang from a variable, and shows default_attributes being used to blank out value on option and id and name on textarea while setting cols and rows to 10.

The second mechanism reads a JSON file at startup, but only if webapi-vim is installed:

vim
let g:user_emmet_settings = webapi#json#decode(join(readfile(expand('~/.snippets_custom.json')), "\n"))

That is an extra dependency most users will not already have. It also means the JSON path and the dictionary path both write the same variable, so you pick one. The README links to the Emmet documentation for the JSON schema rather than reproducing it, and it does not say what happens when the file is missing or malformed at startup. If your snippet set is small, the dictionary form keeps everything in one file you already version.

Where emmet-vim is the wrong choice, and what to use instead

The clearest boundary is editor scope. emmet-vim only helps inside Vim and Neovim. If you split time between Vim and a browser-based editor or another IDE, you maintain two snippet configurations and they will drift. Emmet-language-server is the alternative for that situation: it implements Emmet as a language server, so any editor with LSP support can consume it, and Neovim can attach it through its built-in client rather than through Vim script mappings. The trade-off is real in both directions. A language server gives you one implementation across editors and a protocol boundary that other tooling can reuse, but it adds a server process and an LSP configuration step. emmet-vim gives you a plugin that loads with the editor and needs no server, but its reach stops at Vim.

A second boundary is maintenance expectations. The repository is not archived and the last push was on 2026-03-24, so it is not abandoned, but the README's install instructions still lead with the vim.org zip download and reference Travis CI for build status. Read that as a project whose documentation has aged rather than as a statement about the code. If you need a guarantee of ongoing feature work, the README offers none, and the repository has no published releases to point at.

Licence and the cost of keeping it installed

emmet-vim is MIT licensed. That is permissive: you can use it, modify it and redistribute it, including in commercial settings, provided the licence and copyright notice travel with copies. This is a general description of the MIT terms, not legal advice; read the LICENSE file in the repository for the actual text.

Upgrade cost is low by construction. There is no server to restart, no database, no runtime to pin. Updating means pulling the repository through your plugin manager or re-copying the files if you installed manually, then restarting Vim. The risk sits in your own configuration: if you installed by copying files rather than by manager, you have no record of which revision you are on. The Makefile shows how the project builds its own zip and runs its tests through vim-themis, which tells you tests exist, not what they cover.

Editorial conclusion

Adopt emmet-vim if you already edit HTML or CSS in Vim or Neovim and want abbreviation expansion without leaving the editor. Skip it if you want a language server that also serves other editors. Before committing, verify that your timeoutlen is not 0, confirm the trigger key you actually want (the default is Ctrl-y followed by a comma), and decide whether you need g:user_emmet_install_global set to 0 so the plugin loads only for html and css file types.

Frequently asked questions

What is emmet-vim used for?

It expands Emmet-style abbreviations into full HTML and CSS markup from inside Vim. The README describes it as a Vim plug-in providing support for expanding abbreviations similar to Emmet.

How do I install emmet-vim?

The README documents several routes: a zip download unzipped into ~/.vim, cloning into ~/.vim/bundle for pathogen, a Plugin line for Vundle, or a Plug line for vim-plug. It also gives a manual copy of plugin/emmet.vim and the autoload files.

Why does Ctrl-y followed by comma do nothing in emmet-vim?

The README's FAQ says you probably set timeoutlen=0, and that most Vim plugins using key mappings do not work with that setting.

Can I limit emmet-vim to html and css buffers?

Yes. Set g:user_emmet_install_global to 0 and add an autocmd FileType html,css EmmetInstall line, as the README shows.

Does emmet-vim work in Neovim?

The README documents installation and configuration as a Vim plugin and does not describe a separate Neovim setup. The repository does contain a lua/ directory, but the README's install and configuration instructions do not reference it.

Official sources

  1. Issues
  2. License: MIT
  3. mattn/emmet-vim on GitHub
  4. Project website
  5. README
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/mattn-emmet-vim.svg)](https://hysenlabs.com/projects/mattn-emmet-vim)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/mattn-emmet-vim.svg)](https://hysenlabs.com/projects/mattn-emmet-vim)

Was this useful?