lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, 2003-12-12 at 09:41, Martin Spernau wrote:

I have done quite a bit of research on the Lua extension and was a
little disappointed at what I found, so I have added my own little
interface. First off, I am using a CVS copy of SciTE and Scintilla. I
have created the Extension interface by updating the old code, but I
have also reworked SciTEBase and SciTEGTK to include a Macros menu much
like the Tools menu. You can define new macros in your User or Global
prefs, something like:

macro.name.0.*=Say Hello
macro.0.*=~/.scite/sayHello.lua

Then, under the Macro menu, you can execute that script. Scripts have
full access to the editor window with handy wrapper routines such as
get_selection, select_all, goto_position, goto_line, get_text, insert,
find, find_and_replace, etc... Their are currently 45 scite: commands as
well as the scite:send_message which can do anything scintilla will
allow. A simple script to convert all C++ comments into C comments

// hello

into

/* hello */

looks like:

local buf,doclen = scite:get_text()
newbuf=string.gsub(buf, "//(.-)\n", "/*%1*/\n")
scite:remove_range(0, doclen)
scite:insert(0, newbuf)

This code is working great an their are quite a bit more features that
what I've said, but I would like to know if anyone is interested?
Currently, it only works on the SciGTK, but will easily be moved to the
SciTE for Windows. The code is also a little dirty right now and if
their is intrest I will clean it up and then speak to the developer team
of SciTE and see if I can get it put into the SciTE distribution...

Oh, it uses Lua 5.0 compiled directly into the SciTE binary.

Please do let me know if you are interested.

----
jeremy <jc@cowgar.com>

Jeremy