In this tutorial we will be looking at how to bind functions to keyboard shortcuts and the tools menu. The following code is used to bind the word count function to Ctrl+W. If these lines are put in the global properties file the word count function will be accessible anywhere. They could be placed in a language specific properties file such as html.properties in which case the function would only be accessible in HTML mode.
command.name.11.*=Word Count This line is compulsory and provides the text that will be displayed in the tools menu. The number 11 can be any number (1-99) however must not conflict with any other predefined functions.
command.11.=WordCount This defines the name of the function. Scite will search the standard files for a function called WordCount(). Alternatily you can use command.1.=dofile $(SciteDefaultHome)\wordcount.lua. This will execute the code in the file wordcount.lua. Note that for this to work you should remove the function line: function WordCount() and the last end or alternatively call the function on the first line with WordCount(). This line is also compulsory.
command.subsystem.11.=3 This line defines the subsystem use, in this case Lua. An alternative way to write this is command.mode.11.=subsystem:lua. One of the versions is compulsary.
command.mode.11.*=savebefore:no This line is optional and defines whether Scite should save before executing the command. Can be set to either yes, no or prompt.
command.shortcut.11.*=Ctrl+W This line is also optional and defines the keyboard shortcut to be used when invoking the command. The modifier keys are Shift, Ctrl and Alt with a + between each key. So to string three keys together goes like this: Alt+Shift+I. If you choose not to use this line then the command can still be called from within the tools menu.
command.mode.11.*=groupundo:yes This optional line controls whether the function is treated as a single undoable process or possibly several undoable process's. If it is set to no you may have to hit undo several times to undo this action.
If you have any questions in regard to this tutorial email me at email@example.com.