Autoclose braces/brackets

View: New views
2 Messages — Rating Filter:   Alert me  

Autoclose braces/brackets

by Veix :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello

I have search through the Internet and probably found a solution for autoclose brases - when I tyme "[" <scite adds after cursor> "]"

Solution is:
You can add this to your SciTEStartup.lua file, if you have the latest version of SciTE (with Lua enabled):

local toClose = { ['('] = ')', ['{'] = '}', ['['] = ']', ['"'] = '"', ["'"] = "'" }

function OnChar(charAdded)
--      trace(charAdded)

        if toClose[charAdded] ~= nil then
                local pos = editor.CurrentPos
                editor:ReplaceSel(toClose[charAdded])
                editor:SetSel(pos, pos)
        end
        return false    -- Let next handler to process event
--      return true     -- Don't let next handler to process event
end
http://osdir.com/ml/lib.scintilla.devel/2005-01/msg00046.html

I have created SciTEStartup.lua into Scite directory and inserted code, but no help...
Does anybody have any idea how to implement this or u have some better solution?

Re: Autoclose braces/brackets

by Veix :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In case somebody with same problem finds this dead list, the answere is:

ext.lua.startup.script=$(SciteDefaultHome)/SciTEStartup.lua line to user or global options file