A simple site by simple people.

html functionality in vim

Commands

Macros in Insert mode:

Alt-,< (otherwise, it's terminated with a >)
F1Close the last open tag
F2Close the last open tag, but three lines down
F3<a href=""></a>
F4<a href="mailto:"></a>
F5<IMG src="" alt="">
Ctrl-F1Insert a given tag (open and close)
;;;
;1<h1></h1>
;2<h2></h2>
;3<h3></h3>
;4<h4></h4>
;5<h5></h5>
;ad<address></address>
;ah<a href=""></a>
;am<a href="mailto:"></a>
;an<a name=""></a>
;b<br>
;c<center></center>
;dd<dd>
;dl<dl>
;dt<dt>
;e<em></em>
;f<font></font>
;h<hr>
;i<IMG src="" alt="">
;l<li>
;o<ol>
;p<p>
;s<strong></strong>
;ta<table>
;td<td></td>
;th<th></th>
;tr<tr>
;u<ul>
;C<!-- -->
;R<!== ==>
;H<a href=""></a>
;I<IMG src="" alt="">
;M<a href="mailto:"></a>

Macros in Edit mode:
Ctrl-Del - Delete the tag (and its partner) under the cursor

Macros in Visual mode:
Just about anything in Insert mode works on visually selected text.

EasyHtml

Move the text cursor on the tag, attribute, or CSS property word then :

In the EasyHtml buffer, use:

Deprecated attributes as declared by W3C are red highlighted, while right attributes are blue highlighted.

Set g:easyHtmlSplitRight variable to 0 or 1 to open items list at left or right of current window. By default, use splitright setting.

Set g:eh_singlequote variable to 0 (default) or 1 to use double or single quote when adding attributes (For example id="" or id='')

Set g:eh_incsearch variable to 0 (default) or 1 to dis- or en-able incremental list search. This feature allows to select an item by typing its beginning. When this is enable, 'q', 'h', 'j', 'k' and 'l' keys aren't used to exit from list and to move highlighting. Use 'Q', '', '', '' and '' instead.

Set g:eh_atfirstplace to 0 (default) or 1 to indicate if attributes must be added at the end or at the beginning of the tag.


Installation: The Necessary Files

The following files should be in $vimruntime\ftplugin: html_EasyHtml.vim requires the following two scripts to be installed in $VIMRUNTIME\plugin: And, finally, you should install the following file in $VIMRUNTIME\scripts (to make life easier for html_macros.vim):

It's highly recommended to use the versions from here, because the following mods were made:

Finally, for those interested, here are my vimrc files for vim and gvim * (the big difference being, for the moment, that I like having four essential Windows-type shortcuts--Alt-Space, Ctrl-F4, Ctrl-S, and Ctrl-Tab--in gvim, and that I haven't yet posted the vim file. Soon, I promise.)

    * If you use the gvim file, you'll need to add closetag.vim to your /scripts directory.

jkc 03.10.02