
A simple site by simple
people.
|
|
|
html functionality in vim
Commands
Macros in Insert mode:
| Alt-, | < (otherwise, it's terminated with a >) |
| F1 | Close the last open tag |
| F2 | Close the last open tag, but three lines down |
| F3 | <a href=""></a> |
| F4 | <a href="mailto:"></a> |
| F5 | <IMG src="" alt=""> |
| Ctrl-F1 | Insert 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 :
- Press <F5> key to display attributes for the tag before/under the cursor
- Press <F6> key to display values for the attribute before/under the cursor
- Press <F7> key to display values for the CSS Property before/under the cursor
In the EasyHtml buffer, use:
- h,j,k,l or <Left>,<Down>,<Up>,<Right> keys to change selected item.
- <PageUp>/<PageDown> or <C-F>,<C-B> keys to scroll list one page downward/forward.
- <Home> or <C-Home> to select the first item.
- <End> or <C-End> to select the last item.
- <ENTER> to add selected item WITHOUT exiting from items list.
- <S-ENTER> to add selected item AND exit from items list.
- q or <ESC> to exit without adding selected item.
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:
- html_macros.vim
- ;u was altered to not add a new line after the <li>
- <M-h> (Alt-h) and <M-i> (Alt-i) were disactivated
because they interfered with é and è
- html_map.vim
- To resolve a conflict with html_macros.vim, which uses a semicolon
to begin most of its macros, all terminating semicolons in html_map.vim
were doubled (; becomes ;;) so that they pass through html_macros
without any problems.
- html_EasyHtml.vim
- Since html_macros.vim already uses F1, F2, and F3, the macros in
Easyhtml were bound to F5, F6, and F7.
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