Difference between revisions of "SciTE"

From ArchWiki
Jump to: navigation, search
m (typos)
Line 4: Line 4:
 
This is a short introduction, might help at start:
 
This is a short introduction, might help at start:
  
Start with some generel settings, please note that I just add these
+
Start with some general settings, please note that I just add these
 
settings to the files in /usr/share/scite, most of the stuff can also be set in
 
settings to the files in /usr/share/scite, most of the stuff can also be set in
 
files in your ~. Refer to scite docs for filenames on that.
 
files in your ~. Refer to scite docs for filenames on that.
Line 85: Line 85:
 
<pre>
 
<pre>
 
# load the .api file which I downloaded from the web; it contains, per line,
 
# load the .api file which I downloaded from the web; it contains, per line,
# a short explaination of each command
+
# a short explanation of each command
 
# $file.patterns.php is defined for *.php and friends by file extensions
 
# $file.patterns.php is defined for *.php and friends by file extensions
 
api.$(file.patterns.php)=$(SciteDefaultHome)/php.api
 
api.$(file.patterns.php)=$(SciteDefaultHome)/php.api
Line 95: Line 95:
 
calltip.hypertext.parameters.end=)
 
calltip.hypertext.parameters.end=)
 
calltip.hypertext.parameters.separators=,
 
calltip.hypertext.parameters.separators=,
# some calltips have an additionally explaination after the final ")"
+
# some calltips have an additionally explanation after the final ")"
 
#  -this makes display them in a second line
 
#  -this makes display them in a second line
 
calltip.hypertext.end.definition=)
 
calltip.hypertext.end.definition=)
Line 109: Line 109:
  
 
There can be defined 10 commands file.pattern, these are some for html and one for
 
There can be defined 10 commands file.pattern, these are some for html and one for
php files. Actually Scite is capable of parsing the output of commands for line and column like it does for the php -l command further down or the already defined perl checker. Unfortunately it doesn't work for tidy, it alwas open a blank new tab on clicking instead of placing the cursor at the correct position :/
+
php files. Actually Scite is capable of parsing the output of commands for line and column like it does for the php -l command further down or the already defined perl checker. Unfortunately it doesn't work for tidy, it always open a blank new tab on clicking instead of placing the cursor at the correct position :/
  
 
Show error messages of tidy, doesn't change the file
 
Show error messages of tidy, doesn't change the file
Line 126: Line 126:
 
- re-read in the file and show in editor
 
- re-read in the file and show in editor
 
-> consequence: <b>!!! THERE IS NO UNDO ON THIS COMMAND !!!</b>
 
-> consequence: <b>!!! THERE IS NO UNDO ON THIS COMMAND !!!</b>
Since we set 'activate are.you.sure.on.reload=1' a warnig will popup, if we really
+
Since we set 'activate are.you.sure.on.reload=1' a warning will popup, if we really
 
wanna reload it. So you can decide based on the output in message pane.
 
wanna reload it. So you can decide based on the output in message pane.
  

Revision as of 05:14, 6 March 2007

This is a short introduction, might help at start:

Start with some general settings, please note that I just add these settings to the files in /usr/share/scite, most of the stuff can also be set in files in your ~. Refer to scite docs for filenames on that.

SciTEGlobal.properties: general settings which are mostly scattered over the file. Find the lines and tweak them. Code:

# I like my Scite with tabs and a statusbar, displaying line and column
tabbar.visible=1
tabbar.hide.one=1
tabbar.multiline=1
statusbar.visible=1

#comment out this line or set it to 0 to have the message pane displayed
#under the editor's textfield not besides
split.vertical=0

#display line numbers (create enough space for 4 digits)
line.margin.visible=1
line.margin.width=4

# ask b4 automatically reload an altered file on disk
are.you.sure.on.reload=1
# show  name and number of my tab in titlebar
title.full.path=1
title.show.buffers=1
# save the buffer state in a file and reload on startup
save.recent=1
save.session=1
load.on.activate=1

# allows 25 tabs
buffers=25

# I plain hate indents with tabulators and using 8 spaces is waste of place
# converts tabulator hits to spaces
tabsize=2
indent.size=2
use.tabs=0

# some sane fontsettings: - the ! activates pango -> AA fonts
# sets them all to similar sizes and monospace font
# after the if PLAT_GTK these must be tabublators in intendation like in a Makefile!
if PLAT_GTK
	font.base=font:!bitstream vera sans mono,size:9
	font.small=font:!bitstream vera sans mono,size:8
	font.comment=font:!bitstream vera sans mono,italics,size:9
	font.code.comment.box=$(font.comment)
	font.code.comment.line=$(font.comment)
	font.code.comment.doc=$(font.comment)
	font.text=font:!bitstream vera sans mono,size:9
	font.text.comment=font:!bitstream vera sans mono,size:8
	font.embedded.base=font:!bitstream vera sans mono,size:9
	font.embedded.comment=font:!bitstream vera sans mono,size:9
	font.monospace=font:!bitstream vera sans mono,size:9
	font.vbs=font:!bitstream vera sans mono,italics,size:9

# uuh, netscape - long time not seen, replace with firefox
if PLAT_GTK
	command.print.*=a2ps "$(FileNameExt)"
	command.scite.help=mozilla-firefox"file:///$(SciteDefaultHome)/SciTEDoc.html"

# add a vertical line at column 80
edge.column=80
edge.mode=1
edge.colour=#E0E0E0

go on to html.properties file; to get the advantages you need the php.api and the phpfunctions.properties from HERE. You also find api files for ASP.

#replace netscape with mozilla-firefox again
if PLAT_GTK
	command.go.$(file.patterns.web)=mozilla-firefox "file:///$(FilePath)"
# load the .api file which I downloaded from the web; it contains, per line,
# a short explanation of each command
# $file.patterns.php is defined for *.php and friends by file extensions
api.$(file.patterns.php)=$(SciteDefaultHome)/php.api
# the calltips for the hypertext lexer shall not be case sensitive
calltip.hypertext.ignorecase=1
# define how the calltipps should be parsed, the following is the same as
# the standard anyway, but might be overwritten by some people in SciTEGlobal
calltip.hypertext.parameters.start=(
calltip.hypertext.parameters.end=)
calltip.hypertext.parameters.separators=,
# some calltips have an additionally explanation after the final ")"
#   -this makes display them in a second line
calltip.hypertext.end.definition=)
# autocopleter stuff
# defines which type of characters let the autocompletion pop up
autocomplete.hypertext.start.characters=_$(chars.alpha)
# also the autocompletion should not be case sensitive since, grrr php and html
autocomplete.html.ignorecase=1

There can be defined 10 commands file.pattern, these are some for html and one for php files. Actually Scite is capable of parsing the output of commands for line and column like it does for the php -l command further down or the already defined perl checker. Unfortunately it doesn't work for tidy, it always open a blank new tab on clicking instead of placing the cursor at the correct position :/

Show error messages of tidy, doesn't change the file

# extend the "Extras" menu with some commands
# Tidy Checking
command.name.1.$(file.patterns.web)=HTML Tidy Validate
command.1.$(file.patterns.web)=tidy -quiet -errors $(FilePath)
error.select.line=1

Use Tidy to format(indent and wrap at line 80) and clean your code. This command is defined this way: - save file to disk - have tidy parsing it and rewrite the output directly back to the file - re-read in the file and show in editor -> consequence: !!! THERE IS NO UNDO ON THIS COMMAND !!! Since we set 'activate are.you.sure.on.reload=1' a warning will popup, if we really wanna reload it. So you can decide based on the output in message pane.

# Tidy Cleanup and indent
command.name.2.$(file.patterns.web)=HTML Tidy Cleanup
command.2.$(file.patterns.web)=tidy -i -wrap 80 -m $(FilePath)
command.save.before.1.$(file.patterns.web)=1
command.is.filter.2.$(file.patterns.web)=1

This activates the php linter which finds parsing errors like missing line ends or braces. A click on the error message highlights the error in editor and places the cursor there.

# activate a lint checker for php files
command.name.1.$(file.patterns.php)=Check PHP syntax
command.1.$(file.patterns.php)=php -l $(FilePath)