Here is my actual .vimrc code: {{{ colorscheme evening " Normally we use vim-extensions. If you want true vi-compatibility " remove change the following statements set nocompatible " Use Vim defaults (much better!) set backspace=2 " allow backspacing over everything in insert mode " Now we set some defaults for the editor "set autoindent " always set autoindenting on "set nobackup " Don't keep a backup file set viminfo='20,\"50 " read/write a .viminfo file, don't store more than " 50 lines of registers set history=50 " keep 50 lines of command line history set ruler " show the cursor position all the time " Suffixes that get lower priority when doing tab completion for filenames. " These are files we are not likely to want to edit or read. set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc set ruler syntax on set ai set incsearch " incremental search set showmatch set showcmd " interpret tab as an `indent' command instead of an insert-a-tab command set softtabstop=4 "indent with two spaces when hitting tab set shiftwidth=4 "expand all tabs to spaces according to shiftwidth parameter set expandtab nnoremap \hc :call InsertCloseTag() imap \hca " With the above mapping and the following function, while typing in insert mode, you can simply press to have any close tag typed tag for you. (If function keys don.t work in your terminal, then use \hc in normal mode instead.) function! InsertCloseTag() " inserts the appropriate closing HTML tag; used for the \hc operation defined " above; " requires ignorecase to be set, or to type HTML tags in exactly the same case " that I do; " doesn't treat

as something that needs closing; " clobbers register z and mark z " " by Smylers http://www.stripey.com/vim/ " 2000 May 3 if &filetype == 'html' " list of tags which shouldn't be closed: let UnaryTags = ' Area Base Br DD DT HR Img Input LI Link Meta P Param ' " remember current position: normal mz " loop backwards looking for tags: let Found = 0 while Found == 0 " find the previous <, then go forwards one character and grab the first " character plus the entire word: execute "normal ?\\l" normal "zyl let Tag = expand('') " if this is a closing tag, skip back to its matching opening tag: if @z == '/' execute "normal ?\" . Tag . "\" " if this is a unary tag, then position the cursor for the next " iteration: elseif match(UnaryTags, ' ' . Tag . ' ') > 0 normal h " otherwise this is the tag that needs closing: else let Found = 1 endif endwhile " not yet found match " create the closing tag and insert it: let @z = '' normal `z"zp else " filetype is not HTML echohl ErrorMsg echo 'The InsertCloseTag() function is only intended to be used in HTML ' . \ 'files.' sleep echohl None endif " check on filetype endfunction " InsertCloseTag() }}}