Paul Dunne GMIT SCITE

Overview

There are two panes in SciTE, the editing pane and the output pane. Initially the output pane is of zero size, but it can be made larger by dragging the divider between it and the editing pane. If the Output pane is not visible press F8 (or View | Output). The Options | Vertical Split command can be used to move the output pane to the side of the editing pane. SciTE can perform commands (Tools | Build etc) that compile or run source files. The output/feedback from these commands is shown in the output pane. SciTE defaults to executing commands as command line programs.[1]

SciTE can hold multiple files in memory at one time but only one file will be visible. SciTE's initial configuration only allows one file to be in memory at once but this can be modified by changing the value of the buffers property.

Scite Look and Feel; The Properties file

Much of SciTE's behaviour can be changed by editing the properties files.

There are three properties files used:

·  A user defined local properties file called "SciTE.properties" which may be present in the same directory as the file being edited.

·  User properties file called "SciTEUser.properties" on Windows and "SciTEUser.properties" on GTK+

·  Global properties file called "SciTEGlobal.properties"

Use the Options menu for opening/modifying each of the properties files. Settings in the local properties file override those in the user properties file which override those in the global properties files. Environment variables are also available as properties and these are overridden by an explicit setting in one of the properties files.

The user properties file is intended for customization by the user, leaving the global properties file to contain the default options distributed with SciTE. The main use of the local properties files is to change the effects of the Compile, Build and Go commands for the files in a directory. Avoid using the SciTEGlobal.properties file since it may be overwritten in an upgrade.

The files are in approximately the same format as Java properties files which have a simple text format. Lines that start with '#' or that is completely blank are comments. Other lines are of the form

variable=value

For long values, a '\' character at the end of the line continues that value on the next line. Space characters are significant so x=1 defines a variable called "x". Values may include the values of other variables by using $(variablename).

You may find it useful to use some of the Scite environment variables. These are useful when you are adding your own customizations to the properties file. For example:

cc=g++ -pedantic -Os -fno-exceptions -c $(FileNameExt) -o $(FileName).o

Here is a list of the environment variables. There are used in this fashion:

$(EnviroVarName)

Name / Meaning /
FilePath / full path of the current file
FileDir / directory of the current file without a trailing slash
FileName / base name of the current file
FileExt / extension of the current file
FileNameExt / $(FileName).$(FileExt)
SessionPath / full path of the current session
CurrentSelection / value of the currently selected text
CurrentWord / value of word which the caret is within or near
Replacements / number of replacements made by last Replace command
SelectionStartColumn / column where selection starts
SelectionStartLine / line where selection starts
SelectionEndColumn / column where selection ends
SelectionEndLine / line where selection ends
CurrentMessage / most recently selected output pane message
SciteDefaultHome / directory in which the Global Options file is found
SciteUserHome / directory in which the User Options file is found

Keyboard Shortcuts

Magnify text size. / Ctrl+Keypad+
Reduce text size. / Ctrl+Keypad-
Restore text size to normal. / Ctrl+Keypad/
Cycle through recent files. / Ctrl+Tab
Indent block. / Tab
Dedent block. / Shift+Tab
Delete to start of word. / Ctrl+BackSpace
Delete to end of word. / Ctrl+Delete
Delete to start of line. / Ctrl+Shift+BackSpace
Delete to end of line. / Ctrl+Shift+Delete
Go to start of document. / Ctrl+Home
Extend selection to start of document. / Ctrl+Shift+Home
Go to start of display line. / Alt+Home
Extend selection to start of display line. / Alt+Shift+Home
Go to end of document. / Ctrl+End
Extend selection to end of document. / Ctrl+Shift+End
Go to end of display line. / Alt+End
Extend selection to end of display line. / Alt+Shift+End
Expand or contract a fold point. / Ctrl+Keypad*
Create or delete a bookmark. / Ctrl+F2
Go to next bookmark. / F2
Select to next bookmark. / Alt+F2
Find selection. / Ctrl+F3
Find selection backwards. / Ctrl+Shift+F3
Scroll up. / Ctrl+Up
Scroll down. / Ctrl+Down
Line cut. / Ctrl+L
Line copy. / Ctrl+Shift+T
Line delete. / Ctrl+Shift+L
Line transpose with previous. / Ctrl+T
Line duplicate. / Ctrl+D
Find matching preprocessor conditional, skipping nested ones. / Ctrl+K
Select to matching preprocessor conditional. / Ctrl+Shift+K
Find matching preprocessor conditional backwards, skipping nested ones. / Ctrl+J
Select to matching preprocessor conditional backwards. / Ctrl+Shift+J
Previous paragraph. Shift extends selection. / Ctrl+[
Next paragraph. Shift extends selection. / Ctrl+]
Previous word. Shift extends selection. / Ctrl+Left
Next word. Shift extends selection. / Ctrl+Right
Previous word part. Shift extends selection / Ctrl+/
Next word part. Shift extends selection. / Ctrl+\

Writing your Code with help from Scite

API files

Consider including some ‘api’ files to assist you in writing C/C++/etc code. The api file provides auto-completion and call-tips for some of the C, C++ or other language functions.

Auto-completion:

Ø  The Edit | Complete Symbol (Ctrl + I) command looks at the characters before the caret and displays the subset of the API file that starts with that string.

Ø 

Call-tip:

Ø  When an opening brace is typed, the file is searched for the text preceding the caret and if a function prototype is found then it is displayed as a call-tip

The api files contain a sorted list of identifiers and function prototypes, one per line.

I have downloaded two from the Scite web site and included them in the C:\Program Files\Scintilla Text Editor folder. They are: c.api (4K) and cpp.api (512K). To get them to work I had to include the following lines in the SciteUser.properties file to tell Scite about the api files.

#00000000000000000000000000000000000000000000000000000000000000000000000

#------Writing C/C++/Java

#00000000000000000000000000000000000000000000000000000000000000000000000

api.*.c=C:\Program Files\Scintilla Text Editor\c.api

api.*.cpp=C:\Program Files\Scintilla Text Editor\cpp.api

See the Creating API files section of the Scite help for more information.

Abbreviations

User defined abbreviations are stored in the abbreviations file. You can open the Abbreviations file with Options | Open Abbreviations File.

To use an abbreviation, type it and use the Edit | Expand Abbreviation command or the Ctrl+B key. The abbreviation is replaced by an expansion defined in the Abbreviations file.

Each line in the Abbreviations file looks like "abbreviation=expansion". The abbreviations names can have most any character but they cannot start with sharp (#) or space or tab (but can have spaces inside); and they cannot have '=' character inside.

Abbreviations names are limited to 32 characters. An expansion may contain new line characters indicated by '\n' and a caret position indicated by the '|' character. To include a literal '|' character, use '||'.

Here are some sample abbreviations

include=#include <iostream>\n#include<iomanip>\nusing namespace std;
main=int main(void)\n{\n\t|\n\n\treturn(0);\n}\n

In the I type include and then CTRL+ b to expand the abbreviation to;

#include <iostream>

#include<iomanip>

using namespace std;

Compiling With Scite

SciTE can perform commands to compile or run source files with the output from these commands directed into the output pane. Here we see it compile a C++ program.

The way in which the compilation of C++ files (and C, Java etc) happens is defined in the relevant properties file (C/C++/Java are defined in one file cpp.properties !!).

Here I’m looking at the cpp.properties file.

If I want to customize it then you’ll need to do something like the following.

I took some lines from cpp.properties and added it SciteUser.properties. Then I modifed these lines to do what I wanted for C/C++/Java compilation

Adding my Own Toolbar Commands

I can also add my own commands to the Tools menu item. Here you see I’ve added three ‘tools’: Compile Link this file, Open CMD Shell here and Open Windows Explorer Here.

On Windows, SciTE defaults to executing these tools as command line programs. Executing a GUI program in this mode results in that program being run without displaying a window. The command.subsystem property option can be used to tell Scite that the command should run in GUI mode. The default subsystem, 0, is for command line programs, 1 is for programs which create their own windows, and 2 is for using the ShellExecute call. ShellExecute is a good way to open HTML files and similar as it handles this similarly to a user opening the file from the shell. I use this;

command.subsystem=2

Then 3 is for calling an internal extension or director extension, 4 is for calling the Windows specific HtmlHelp program and 5 is for calling the Windows specific WinHelp function.


My own SciteUser.properties file

#000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

#------General Look and Feel

#000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

#------Editor location

# Where the Scite editor windows appears on desktop

#Here its roughly in the middle

position.left=150

position.top=90

#------Editor width and height

position.width=576

position.height=740

#------Editor look

position.width=576

view.whitespace=0

view.indentation.whitespace=0

view.indentation.guides=0

highlight.indentation.guides=1

#000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

#------Overview: Howto define your own menu items

#000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

# The following new command will appear under Tools menu

# with a short-cut of Ctrl+2

#______

# command.name.2.+=Command Prompt Here

#______

# The second line is the command string, similar to those of

# the compile, build, and go commands. The /K switch is a Windows

# cmd switch which causes the shell window to stay open after

# the command is issued. The environment variable $(FileDir)

# is provided by Scite

#______

# command.2.+=cmd /K CD $(FileDir)

#______

# The next line with the keywordd 'subsystem' specifies

# how the command is executed on Windows. We specify that the

# command specified by Ctrl+2 is is executed as a command line program

#______

# command.subsystem.2.+=0

#______

# ------Compile and Link this file Ctrl+1

command.name.1.*.cpp=Compile & Link this file

command.1.*.cpp=g++ $(FileNameExt) -o $(FileName).exe

# ------Open CMD Shell in this directory Ctrl+2

# Open command prompt in this directory

# Works for all (*) file types

command.name.2.*=Open CMD-Shell here

command.2.*=cmd /K CD $(FileDir)

command.subsystem.2.*=2

# ------Graphically Explore This Directory Ctrl+3

#Open directory of current file in Windows Explorer

command.name.3.*=Open Windows Explorer Here

command.3.*=c:\windows\explorer.exe "$(FileDir)"

command.subsystem.3.*=2

#000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

#------Compile C/C++/Java

#000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

# Define a variable 'cc' to let us produce object files

cc=g++ -pedantic -Os -fno-exceptions -c $(FileNameExt) -o $(FileName).o

#And a variable lk that will link all obje files

exe=g++ $(FileName).o -o $(FileName).exe

#Need a make file

make.command=make

#----- C ------

command.compile.*.c=$(cc)

command.build.*.c=$(make.command)

command.go.*.c=$(FileName).exe

# To make the Go command both compile (if needed) and execute, use this setting:

#command.go.needs.*.c=g++ $(FileNameExt) -o $(FileName)

#-----C++ ------

command.compile.*.cpp=$(cc)

command.build.*.cpp=$(make.command)

command.go.*.cpp=$(FileName).exe

#-----Java ------

command.compile.*.java=javac $(FileNameExt)

command.build.*.java=javac *.java

command.go.*.java=java $(FileName)

Page 9 of 10

[1] If you try to run GUI based programs in this fashion (i.e. Tools | My Command) no GUI will be displayed by default. The command.subsystem property option can be used to flag tools that need to run in GUI mode