HTML/XHTML Editing in Vim
Name
HTML/XHTML Editing Macros (🕑) — Vim mappings and menus to make editing HTML/XHTML files quick and easy.
Description
This is a set of HTML/XHTML mappings (macros) and menus for Vim 9 or later. The mappings will be local to the buffer so they will not interfere if you edit other files in the same Vim session.
Installation
Warning: If you have an old pre 1.0.0 version of this plugin, you need to remove its files first or they may prevent the newer packed version from loading.
Put "filetype plugin on" in your vimrc.
To install from the zip archive
Extract the HTML.zip archive in your runtime directory (~/.vim for Unix, %USERPROFILE%\vimfiles for Windows; see ":help 'runtimepath'").
This archive includes ftplugin/html/HTML.vim (the main plugin), doc/HTML.txt, autoload/HTML.vim (support functions), commands/HTML.vim (support commands), import/HTML.vim (plugin variables), json/htmlentities.vim (entity mappings and menus), json/htmltags.vim (tag mappings and menus), autoload/BrowserLauncher.vim (functions for remote controlling browsers), autoload/MangleImageTag.vim (functions that allow automatic updating of <IMG> tags), and the toolbar bitmaps.
To install using git
Unix/MacOS
Type the following in a terminal:
mkdir -p ~/.vim/pack/cjr/start
cd ~/.vim/pack/cjr/start
git clone https://github.com/Heptite/HTML.git
Windows
Press Windows+R and type in cmd, then type the
following into the command window:
mkdir %USERPROFILE%\vimfiles\pack\cjr\start
cd %USERPROFILE%\vimfiles\pack\cjr\start
git clone https://github.com/Heptite/HTML.git
After installing using git you can always update by entering the pack/cjr/start/HTML directory and typing: git pull
See the plugin's Github page for more information.
Manual installation
Manual installation is no longer supported. Install from the zip archive or use the git instructions, which will place the plugin and its associated files in a self-contained "pack" directory. See ":help packages" for more information.
The files below are only provided for historical reasons.
To install for old versions of Vim
The last version that supported Vim 5 is 0.10, the last version that supported Vim 6 is 0.33.1, and the last version that supported Vim 7 is 0.42.6. There wasn't a Vim 8 version and support for Vim 8.2 was unintentionally broken.
Other old versions can be found on the plugin's Vim.org page.
Files
These files—except wikipedia.vim—are included in the HTML.zip and git archives (see "installation" above).
- doc/HTML.txt (You may view the documentation as HTML here.)
- vim-html-pixmaps.zip (You may view a montage of the pixmaps here.)
- autoload/HTML/functions.vim
- commands/HTML/commands.vim
- import/HTML/variables.vim
- autoload/HTML/BrowserLauncher.vim
- autoload/HTML/MangleImageTag.vim
- json/HTML/entities.json
- json/HTML/tags.json
- To use these macros for editing MediaWiki/Wikipedia text, put wikipedia.vim in <runtimepath>/ftplugin/. You will also need to read Wikipedia's text editor support page; use this file in place of the filetype plugin suggested there.
Support
If you have questions, first read the Frequently Asked Questions (text version). This covers the most frequent support requests I get.
If you still have a question or a problem with the plugin, email me, or submit a bug report on the plugin's Github issues page.
The curious can read the ChangeLog (text version), which includes revision notes for all the files listed above.
See also
Some other Vim features and plugins that may be useful for editing (X)HTML:
- closetag.vim
This plugin provides functions and mappings to close open HTML/XML tags. - :help ft-html-omni
How to auto-complete tags, attributes, CSS, JavaScript, etc. in Vim 7 or later. - html.vim
For Vim 7.3 or later. Syntax additions for HTML files that enables concealing of some items. This file should be placed in your <runtimepath>/after/syntax/ directory. See my main Vim page for more information.