" htmledit.vim by ipenburg@xs4all.nl " " This is a Vim file to turn Vim into an HTML editor. " It can be used most convenient with an autocommand for " *.htm and *.html files: " source $HOME/htmledit.vim " " Conventions: " * Comments are proceded by a double quote and a space " * Disabled lines are only proceded by a double quote " * Tags are used in uppercase " * Unique tags like HTML and BODY aren't supported, should be placed in " skeleton file instead " * | (brvbar: broken vertical bar) is escaped with \ (bslash: backslash) " " Todo list: " * ALT-X mappings are hard to get. Why? " ======================================================================= " " Notifier: also comment-out trailing notifier at the and of this file " when you comment-out this notifier. echo "Loading Vim HTML editor by ipenburg@xs4all.nl..." " Avoid wrapping: set tw=0 set nowrap " Mappings in Command mode " Headings: The H1, H2, H3, H4, H5, H6 elements " ALT+N places tags on inserted lines above and under the current line. " It assumes the headings don't wrap. " The closing tag is followed by a paragraph tag of class seq. This can " be used as a CSS class for browsers which don't support sequential " selection. nno x 0i

$a

nno y 0i

$a

nno z 0i

$a

nno { 0i

$a

nno \| 0i

$a

nno } 0i

$a

" Paragraphs: the P element " ALT+0 places a

tag on an inserted line above the current line. nno ΁ 0i

" Classes " ALT+C inserts " class=" before next > and goes into insert mode so the " classname can be entered. nnoremap . />iclass= " Previews and Validation " (Used here in a personal Win9x commandline style with shortcuts in path) " FN saves the current file and spawns a browser or validator which processes " the saved version of the current file. " F1 remains help for Vim itself nnoremap :w:!x % in validate nnoremap :w:!x % in nn nnoremap :w:!x % in ie nnoremap :w:!x % in lynx nnoremap :w:!x % in mosaic nnoremap :w:!x % in opera nnoremap :w:!x % in webtv " Mappings in Visual mode " Haven't figured this out yet. Visual mode should be used for tagging of " inline elements or multi-line elements. " Phrase elements: EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, ABBR, and " ACRONYM " PLACEHOLDER " Preformatted text: The PRE element " PLACEHOLDER " Subscripts and superscripts: the SUB and SUP elements " PLACEHOLDER " Unordered lists (UL), ordered lists (OL), and list items (LI) " PLACEHOLDER " Marking document changes: The INS and DEL elements " PLACEHOLDER " Mappings in Insert mode " Character entities references " Only useful when available on the keyboard: " (You're not going to type ALT+181 to get µ are you?) " (Made with cp850) " Funky characters are replaced by their HTML equivalents " &, <, > and " aren't in this list because they are typed more " frequent as their HTML tag meaning which shouldn't be altered. " There are also some mappings disabled to prevent ambigious- or unwanted " mapping. These are mapping of spacing accents, which are also used to map " accented characters, and slashed characters, which could cause unwanted " mapping in URIs. " The inoremap is used instead of abbreviations because for abbreviations " a space has to follow the abbreviation, which isn't very convenient " when it comes to typing funky characters. " To prevent waiting for another character on regularly used characters " the accents are the first things to type. This is also in correspondence " with regular accent construction on an extended keyboard, but illogical " when pronounced as their character entity reference name (Aring is typed " as ring-A). ino ¢ ino £ ino \| ¦ " ino ? § section sign does something else (21) in Vim on my system? " disabled to prevent ambiguity in mapping characters with a diaeresis: "ino ¨ ino « ino ¬ " disabled to prevent ambiguity in mapping characters with a ring above: "ino ° ino ± ino ² ino ³ " disabled to prevent ambiguity in mapping characters with an acute accent: "ino ' ´ ino µ " ino ? ¶ pilcrow sign does something else (20) in Vim on my system? ino · ino ¸ ino ¹ ino » ino ¼ ino ½ ino ¾ ino `A À ino 'A Á ino ^A  ino à ino Ä ino A Å ino Ç ino `E È ino 'E É ino ^E Ê ino E Ë ino `I Ì ino 'I Í ino ^I Î ino I Ï ino Ñ ino `O Ò ino 'O Ó ino ^O Ô ino ~O Õ ino O Ö " disabled to prevent unwanted mapping in URIs: "ino /O Ø ino `U Ù ino 'U Ú ino ^U Û ino U Ü ino 'Y Ý ino ß ino à ino á ino â ino ã ino ä ino a å ino ç ino è ino é ino ê ino ë ino ì ino í ino î ino ï ino ñ ino ò ino ó ino ô ino ~o õ ino ö " disabled to prevent unwanted mapping in URIs: "ino /o ø ino ù ino ú ino û ino ü ino 'y ý ino ÿ " Abbeviation can be used to generate tags while in insert mode. Because " the abbreviation must be braced by a special characters this method is only " useful when used as a single tag on a line, so only block elements are " supported. (whitespace around tags can cause trouble) Also the abbreviation " shouldn't be frequently used in another context, which is tricky when URIs " contain an abbreviation. " (I don't like this method, I prefer adding tags in an already typed text " in Command- or Visual mode) " Headings: ab h1

ab xh1

ab h2

ab xh2

ab h3

ab xh3

ab h4

ab xh4

ab h5

ab xh5

ab h6

ab xh6

" Rules: the HR element: ab hr


" Paragraph: ab pp

" Preformatted: ab pre

ab xpre 
" Lists ab li
  • " Unordered list: ab ul
      ab xul
    " Ordered list: ab ol
      ab xol
    " Definition list: ab dt
    ab xdt
    ab dd
    ab xdd
    " Table: ab tbl
    " Image: ab img " ======================================================================= " Trailing notifier echon " Done."