sponsor Vim development Vim logo Vim Book Ad

EasyHtml.vim : Allows to add attributs/values/CSSProperties to HTML tags/attributs very easily.

 script karma  Rating 135/50, Downloaded by 7310  Comments, bugs, improvements  Vim wiki

created by
Gontran BAERTS
 
script type
utility
 
description
With EasyHtml, you no longer need to look for tags attributes, attributes values or CSS properties values while editing HTML files. EasyHtml let you select the right attribute or value by showing you an attributes/values list for the tag/attribute/CSS property under the cursor.

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

- Press <F2> key to display attributes for the tag before/under the cursor
- Press <F3> key to display values for the attribute before/under the cursor
- Press <F4> ket to display values for the CSS Property befor/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', '<Left>', '<Down>', '<Up>' and '<Right>' 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.

+ Useful mappings :
  . d<F2> : delete tag before/under cursor
  . d<F3> : delete attribute before/under cursor
 
install details
Put this file in your plugin directory.
Requires liblist.vim and genutils.vim scripts.
Download them at
  http://vim.sourceforge.net/scripts/script.php?script_id=166
and
  http://vim.sourceforge.net/scripts/script.php?script_id=197
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
EasyHtml.vim 0.5.1 2002-03-22 6.0 Gontran BAERTS - No longer use of the modifiable option.
EasyHtml.vim 0.5 2002-03-18 6.0 Gontran BAERTS - Now use liblist.vim script to handle lists and genutils.vim script to handle windows (Thanks to Hari Krishna Dara for this script).
Download them at
  http://vim.sourceforge.net/scripts/script.php?script_id=166
and
  http://vim.sourceforge.net/scripts/script.php?script_id=197
Make script smaller.
- Mapping changed !
  <F2> displays tag attributes
  <F3> displays attributes values
  <F4> displays CSS Properties values
  <ENTER> no longer close list after item addition. Use <S-ENTER> to add and exit from list.
- More user friendly : you no longer need to move cursor exactly on the keyword. Cursor may stay on '=', ':' or '"' signs just after keyword while hitting <F2>, <F3> or <F4> keys.
For example,
. Tags : <img
  Hitting <F2> key works while cursor is at '<' sign.
. Attributes : style=""
  Hitting <F3> key works while cursor is at '=' or '"' signs.
. CSS properties : background-color:;
  Hitting <F4> key works while cursor is at ':' or ';' signs.
- New g:eh_atfirstplace variable. See Usage section above.
- Fix modifiable setting again
- Fix syntax error for the "frame" attribute of <table> tag which causes "border" attribute to not been seen in attributes list.
EasyHtml.vim 0.4.1 2001-12-05 6.0 Gontran BAERTS - Fix infinite loop to find window when easyhtml buffer is hidden. Thanks to Jonathon Merz who pointed out the bug and send me the patch.
'The drawback to this fix is that it will reinitialize all the buffer
mappings and such for the EasyHtml buffer every time the buffer is opened but
is not in a window already', he says. Hari Krishna Dara has made a great script named bufNwinUtils.vim which contains useful functions to handle buffers and windows. It will allow me to avoid the drawback. I'm interesting to use his script with mine, but it requires to load entire bufNwinUtils.vim for only  two or three functions used. What do you think about that ? give me feedback, thanks.
EasyHtml.vim 0.4 2001-12-03 6.0 Gontran BAERTS - Added values for the "style" attribute (CSS2 properties)
- Added values for CSS2 properties
- <PageUp> and <PageDown> are now usable to move highlight through the list
- When adding a value for an attribute, current attribute value (if exists) is replaced by the selected one, except for "style" attribute for which values are append
- Set g:eh_singlequote variable to 0 or 1 to use double or single quote when adding attributes (For example id="" or id='')
EasyHtml.vim 0.3 2001-11-28 6.0 Gontran BAERTS - Attributes list updated
- Don't display attributes list for closing tags
- Now, display values list when hitting <F3> with cursor on attribute word (for some attributes only).
EasyHtml.vim 0.2.1 2001-11-27 6.0 Gontran BAERTS - Fix global modifiable setting instead of local
EasyHtml.vim 0.2 2001-11-26 6.0 Gontran BAERTS - Attributs list is now alphabetically sorted
- Hitting <F3> allows to display attributs list in Insert mode too
- Allows to select an attribut by incremental search :-)
For example, with <body> tag, typing "onk" (normal mode) in the attributs list buffer automatically select "onkeydown" attribut. Use backspace (<BS>) to remove characters. This behavior is enable by setting g:eh_incsearch variable to 1. Warning : when incremental attribut search is on, 'q', 'h', 'j', 'k' and 'l' keys aren't used to exit from list and to move highlighting. Use 'Q', '<Left>', '<Down>', '<Up>' and '<Right>' instead.
- Check for attributs list already opened, and reuse it
EasyHtml.vim 0.1 2001-11-21 6.0 Gontran BAERTS Initial upload
ip used for rating: 18.190.217.134

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github