Re: XML tag completion script

From: phayz <russelldicken....at.gmail.com>
Date: Mon, 15 Mar 2010 20:00:51 -0700 (PDT)

On Mar 16, 8:23 am, <brian-sch....at.cox.net> wrote:
> The following is my commands.lua for xml (placed in ~/.textadept/modules/xml/commands.lua)
>
> =============================================================
> -- Copyright 2007-2009 Mitchell Foral mitchell<att>caladbolg.net. See LICENSE.
>
> ---
> -- Commands for the xml module.
> module('_m.xml.commands', package.seeall)
>
> require 'common.xmlcomplete'
>
> -- 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},
>                 ['>'] = {completeClosingTagBracket},
>                 ['<'] = {autoTag},
>                 ['/'] = {singleTag},
>                 [' '] = {
>                         function ()
>                                 local pos = buffer.current_pos
>                                 buffer:clear_selections()
>                                 buffer:set_sel(pos, pos)
>                                 buffer:add_text(" ")
>                         end
>                 }
>         }
> end

I am still unsure of how I enable this script but I need to RTFM a
little more, also peek and poke around Textadept's directories.

As I understand I have a Lua script, which needs to be run when
certain key sequences are pressed, and the latter is where the
"commands.lua for xml (placed in ~/.textadept/modules/xml/
commands.lua)" comes into play). What I am still struggling with is
knowing how these two are linked.

Regards,

Russell Dickenson (AKA phayz)
Received on Mon 15 Mar 2010 - 23:00:51 EDT

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