Scite Quick Start Xhtml

lua-users home
wiki

Well, this is not the quintessential Lua script to SciTE, but shows a specific Lua characteristic: It's possible to use [[ ]] to enclosure strings and get rid of all '. ", \' ...

This isn't funny ?

function quickstartxhtml()
	editor:AddText([[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
</head>
<body>

</body>
</html>]])
end
        

WalterCruz


Add a (very) basic command and you have a simple in-line macro (almost, but not quite, a "snippet"):

command.name.14.*=Snippet
command.14.*=Snippet
command.subsystem.14.*=3
command.mode.14.*=savebefore:no
command.shortcut.14.*=Ctrl+.


function snippet()
	editor:WordLeftEndExtend()
	local sel = editor:GetSelText()
	editor:ReplaceSel('')
	dostring(sel .. '()')
end
        

So to use the example above, you would type 'quickstartxhtml' (or probably something shorter) and then hit Control + . (period) and the text in that particular function would appear.

Russell Beattie


RecentChanges · preferences
edit · history
Last edited February 8, 2007 11:25 pm GMT (diff)