XML tag completion script

From: Brian Schott <briancsch....at.gmail.com>
Date: Tue, 26 Jan 2010 23:24:01 -0800

I wrote up a small script to auto-complete XML tags. Since the wiki is
down as I type this, I've uploaded it here:
http://www.hackerpilot.org/src/textadept/xmlcomplete.lua

Bind the completeClosingTagBracket function to be triggered by a '>'
character being inserted, and bind completeClosingTag to whatever key
combo you want. Example:

-- xml-specific key commands.
local keys = _G.keys
if type(keys) == 'table' then
    keys.xml = {
        al = {
            m = { textadept.io.open,
                textadept.iconv(_HOME..'/modules/xml/init.lua',
                'UTF-8', _CHARSET) },
        },
        ['c\n'] = {completeClosingTag},
        ['s>'] = {completeClosingTagBracket}, -- s because the shift key
is pressed
    }
end

Happy text editing,
-Brian
Received on Wed 27 Jan 2010 - 02:24:01 EST

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:38:49 EST