sponsor Vim development Vim logo Vim Book Ad

make-element : generic imap to make an xml element of any word you type

 script karma  Rating 93/27, Downloaded by 1685  Comments, bugs, improvements  Vim wiki

created by
Bart van Deenen
 
script type
utility
 
description
In insert mode, typing anyword,,, gets translated to an xml element named 'anyword'

Example 1:
      anyword,,,<cr><tab>xsl:if,,, ==>
      <anyword>
            <xsl:if>
            </xsl:if>
      </anyword>
with the cursor after the element open tag.

If anyword is not on a line by itself, no newline is added.

Example 2:
This is a bold,,, statement ==> This is a <bold>statement</bold>

Use it all the time myself, in docbook and with some custom dtd's.

See vimtip #465
 
install details
just source it from ftplugin/xml.vim or ~/.vimrc or _vimrc
 

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
make-element.vim 1.1 2005-02-06 5.7 Bart van Deenen This version also works with single character xml elements
make-element.vim 1.0 2003-05-01 5.7 Bart van Deenen Initial upload
ip used for rating: 3.239.214.173

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