DeskTux

Linux on Desktops

User Tools

Site Tools


apps:scite

SciTE

The SciTE main window with the configuration applied SciTE is a really great and versatile source editor. Fast, knows lots of languages (syntax highlighting), fully customizable, platform independent and so on. As with everything, it is a matter of taste what you use. SciTE just became my favourite when it comes to editing in a graphical environment. On the console or in a terminal the one and only editor of course is vi or vim.

You can use Scite for scripting, programming, webdesign, Lua-scripts (for itself or e.g. imapfilter), LaTeX files…

Configuration

However, the default settings are not as nice as they could be. Use the settings below to paste them in the .SciTEUser.properties (in the menu go to “Options → Open User Options File”). Then your working experience with SciTE should be way better!

Of course you can modify these settings according to your own needs and preferences; with a few adjustments these settings also work with the Windows version of SciTE.

.SciTEUser.properties
position.width=1024
position.height=768
position.left=0
position.top=0
 
toolbar.visible=1
toolbar.usestockicons=1
tabbar.visible=1
tabbar.multiline=1
statusbar.visible=1
 
split.vertical=0
edge.mode=1
save.recent=1
save.session=0
open.dialog.in.file.directory=1
wrap=1
buffers=32
autocompleteword.automatic=1
check.if.already.open=1
strip.trailing.spaces=1
xml.auto.close.tags=1
 
eol.auto=1
ensure.final.line.end=1
ensure.consistent.line.ends=1
 
line.margin.visible=1
line.margin.width=4+
 
fold=1
fold.on.open=0
fold.symbols=3
 
caret.fore=#ff0000
caret.width=3
 
source.files=*.asm;*.c;*.cc;*.cpp;*.cxx;*.cs;*.h;*.hh;*.hxx;*.hpp;\
*.idl;*.odl;*.rc;*.rc2;*.dlg;*.def;*.vb;*.vbs;*.bas;*.frm;*.cls;*.ctl;\
*.java;*.js;*.py;*.pl;*.rb;*.cgi;*.lua;*.conf;*.sh;make*;*.mak;\
*.properties;*.html;*.xml;*.iface;*.bat;*.e;*.css;*.tex;*.php
 
font.base=$(font.monospace)
font.small=font:!Mono,size:7
font.comment=$(font.monospace)
font.code.comment.box=$(font.comment)
font.code.comment.line=$(font.comment)
font.code.comment.doc=$(font.comment)
font.text=$(font.base)
font.text.comment=$(font.comment)
font.embedded.base=$(font.monospace)
font.embedded.comment=$(font.comment)
font.monospace=font:!Mono,size:8
font.vbs=$(font.embedded.base)
font.js=$(font.embedded.base)
 
command.build.$(file.patterns.latex)=pdflatex $(FileNameExt)
command.go.$(file.patterns.latex)=acroread $(FileName).pdf
command.go.$(file.patterns.web)=firefox "file://$(FilePath)"
command.print.*=a2ps "$(FileNameExt)"

Sorting

SciTE doesn't allow for sorting by default. By adding a simple Lua script and assigning a keyboard shortcut to it SciTE can learn it though.

Just add these lines to your user configuration:

ext.lua.startup.script=$(SciteUserHome)/.scitesort.lua
 
command.name.11.*=Sort Selection
command.11.*=sort_text
command.subsystem.11.*=3
command.mode.11.*=savebefore:no
command.shortcut.11.*=Shift+Ctrl+S

And save the following script as ~/.scitesort.lua.

Actually, this is not from me but taken from the Lua Users Wiki, I am not a programmer and definitely don't speak Lua ;-) Thanks a million for this script, Lua Users!

scitesort.lua
function lines(str)
  local t = {}
  local i, lstr = 1, #str
  while i <= lstr do
    local x, y = string.find(str, "\r?\n", i)
    if x then t[#t + 1] = string.sub(str, i, x - 1)
    else break
    end
    i = y + 1
  end
  if i <= lstr then t[#t + 1] = string.sub(str, i) end
  return t
end
 
function sort_text()
  local sel = editor:GetSelText()
  if #sel == 0 then return end
  local eol = string.match(sel, "\n$")
  local buf = lines(sel)
  table.sort(buf)
  local out = table.concat(buf, "\n")
  if eol then out = out.."\n" end
  editor:ReplaceSel(out)
end

Done! From now on you will find the sorting function (for all selected lines) in the “Tools” menu or as keyboard shortcut <Shift> + <Control> + <S>.

Discussion

Enter your comment:
U A Y U G
 
apps/scite.txt · Last modified: 2024-05-20 09:58 by jens