SciTE-st Manual

Written by Mitchell Foral. (mitchell{att}caladbolg.net)

Introduction

SciTE-st is a fork of Scintilla/SciTE that has dynamic lexing capabilities. The stock Scintilla lexers are character iterators. Scintilla-st lexers are written using the Lua "LPeg"(http://www.inf.puc-rio.br/~roberto/lpeg.html) library and are generally more intuitive and easier to write.

Overview of Changes to Scintilla (Scintilla-st)

  • Dynamic lexer that replaces Scintilla's standard ones.

    • Supported lexers: Actionscript, Ada, ANTLR, APDL, Applescript, ASP, AWK, Batch, Boo, C/C++, C#, CSS, D, Diff, Django, Eiffel, Erlang, Forth, Fortran, Gap, Gettext, GNUPlot, Groovy, Haskell, HTML, IDL, ini, Io, Java, Javascript, Latex, Lisp, Lua, Makefile, MySQL, Objective C, OCAML, Pascal, Perl, PHP, Pike, Postscript, Properties, Python, R, Ragel, Rebol, Rexx, RHTML, Ruby, Scheme, Shellscript, Smalltalk, Tcl, Vala, Verilog, VHDL, Visual Basic, XML
  • AutoCSeparator is | (pipe), not ?.

  • Added new messages:

    • SCI_GETLEXERLANGUAGE([unused], const char* languageName)

      Returns the name of the lexer currently loaded.

    • SCI_GETSTYLENAME([unused], const char* styleName)

      Returns the name of the style under the caret.

  • Removed some default key commands:

    Ctrl+L, Ctrl+Shift+L, Ctrl+T, Ctrl+Shift+T, Ctrl+D, Ctrl+U, Ctrl+Shift+U

Overview of Changes to SciTE (SciTE-st)

  • Added new Project Manager pane to the GUI (Linux only).

  • Added new Lua Extension function:

    • scite.GetClipboardText()

      Returns the contents of the clipboard.

  • Maximum of 100 commands in the Tools menu (instead of 50).

  • Literal newlines ('\n') can be used in API files (and are not escapable).

  • Added new messages and menu items for them:

    • IDM_TOGGLEPM (417) [View Menu]

      Toggles the project manager's visibility.

    • IDM_SWITCHPANEPM (422) [Tools Menu]

      Switches focus between the editor/output pane and the project manager.

  • Added new properties:

    • lexer.lua.script

      The path to lexers/lexer.lua, the script that loads and runs dynamic language lexers.

    • lexer.lua.home

      The path to lexers/, the director that contains dynamic language lexers.

    • lexer.lua.color.theme

      The name of a Lua file in the `lexers/themes/` directory. The scite theme
      is used by default.
      
    • decoder.lua.script

      The path to scripts/scite/decoder.lua, the script that returns a filename, line, and column parsed from a double-clicked line in the output pane.

    • fold.by.indentation

      If true and no folder exists for the current lexer, the document is folded by indentation level.

    • projectmanager.lua.script

      The path to scripts/pm/pm.lua, the script that runs the project manager.

    • projectmanager.hidden

      If true, the project manager is hidden on startup.

    • projectmanager.width

      The initial width of the project manager (when visible).

  • caret.fore property also applies to the output pane.

  • Auto-XML completion has been disabled. Use the key command for the modules.scite.editing.enclose('tag') function.

  • Output pane double-clicking is handled by scripts/scite/decoder.lua.

Requirements

For a Linux system, Lua 5.1 is required. It is probably available through your distribution's package manager. For Debian-based systems, make sure you install the 'dev' version of Lua too because you will need the header and shared object files.

Some of my Lua scripts (in particular Textmate-like snippets in scripts/scite/snippets.lua) use the Ruby programming language. You can get it from http://ruby-lang.org.

For a Windows system, everything comes in the SciTE-st package.

Install

SciTE-st comes in an all-in-one package (minus Lua for Linux systems). Download it here.

For a Linux system, SciTE-st usually goes in /usr/share/scite-st (you may need root privilages to install there). If you install it anywhere else, you will have to change SYSCONF_PATH in src/scite/gtk/makefile and recompile SciTE-st.

For a Windows system, SciTE-st usually goes in C:\Program Files\SciTE-st\, but you can pretty much place it anywhere you would like.

Setting up dynamic lexing:

  1. Set the location of lexers/ and lexers/lexer.lua in SciTEGlobal.properties via the lexer.lua.home and lexer.lua.script properties respectively. Optionally you can set a color scheme via the lexer.lua.color.theme property. Schemes are in lexers/themes/. The scite theme is used by default.

  2. Set the PLATFORM variable in lexers/lexer.lua depending on your operating system, 'linux' or 'windows'.

  3. Double-check and make sure the Lua package paths are set properly in lexers/lexer.lua according to where you installed SciTE-st.

  4. If highlighting is not being detected automatically, take a look at the appropriate language's properties file and make sure the lexer being used exists in the lexers/ directory. If it does not, it is possible you just need to rename the lexer in the properties file. For example, the original Scintilla 'hypertext' lexer contains PHP, but a 'php' lexer is used in Scintilla-st. If, however, the lexer simply does not exist in any form, feel free to write one and submit it or request it.

Setting up the project manager (Linux only):

  1. Set the location of scripts/pm/pm.lua in SciTEGlobal.properties via the projectmanager.lua.script property.

  2. Double-check and make sure the Lua package paths are set properly in scripts/pm/pm.lua according to where you installed SciTE-st.

Using SciTE-st

You cannot mix SciTE-tool's Lua scripts with SciTE-st's scripts.

Remember that the LuaDoc is a valuable resource for all Lua aspects of SciTE-st. Not only does it contain SciTE-st's Lua API, it also contains textual documentation for the more complicated parts of the scripts. This manual is only aimed to answer the most frequent questions. Most everything else is covered in the LuaDoc. Anything that is not is most probably covered in the SciTE documentation.

Also, a decent knowledge of Lua is assumed.

If you plan on using extension.lua as your Lua startup script in order to load and use my Lua modules, change its PLATFORM variable appropriately as well. If you do not plan on using extension.lua, but still want to use my Lua modules, you will need to define a global PLATFORM variable and set it to be 'linux' or 'windows' because the modules need it.

If key commands are not working as expected, check the scripts/scite/key_commands.lua file to make sure that ALTERNATIVE_KEYS is set to false because occasionally I forget to reset the flag when commit.

Key Commands

SciTE-st can be very keyboard-driven. Learn or create your own key commands in scripts/scite/key_commands.lua. The keys LuaDoc page will be useful.

Colors, Fonts, etc.

Style properties are NOT contained in SciTE properties files. Any style properties are simply ignored.

Scintilla's default styles (32-39) can be changed through color theme Lua files in lexers/themes/. You can load a theme by setting the lexer.lua.color.theme property to be the name of a Lua theme file. Most lexers use these same colors and styles, so instead of having to change each individual lexer style, most styles can be changed in the same place.

Changing the style of the project manager is different. Consult the LuaDoc for how to do this.

Lexers

Consult the in-depth documentation on lexers in in the LuaDoc.

Modules

Modules are basically Lua packages of functionality. They can be generic or language-specific. See the LuaDoc for modules for more information.

Project Manager (Linux only)

The side pane can function as pretty much any treeview-based data structure, not just a project manager. See the layout and take a look at the existing browsers in scripts/pm/*_browser.lua.

Valid XHTML 1.0!