Scite Favs

lua-users home
wiki

Purpose

One functionality I always missed in SciTE is a favourites manager. I also had some requirements that a possible solution should match. First of all, it should work both on Windows and Unix (tested on Linux). Second, the favourites list should be easily customizable. Third, nonexistent files should be ignored. As I found out, all this could be done with Lua. Here I present my solution. Enjoy! :-)

Installation

To install, put Files:wiki_insecure/editors/SciTE/favs.lua in your SciTE directory (or wherever you store Lua scripts for SciTE). Then, ensure the file is loaded during SciTE startup. One way to do that is create a file called SciTEStartup.lua in your SciTE directory and put the following line in it:
require(props["SciteDefaultHome"].."/favs.lua")

If you have not already done it, you will have to tell SciTE which file to load as the Lua startup script: Add the following to your User or Global Options File:

ext.lua.startup.script=$(SciteDefaultHome)/SciTEStartup.lua

Finally, the new favourites feature needs a trigger. I used Ctrl+- since this is pretty well accessible on a German keyboard. YMMV. Add the following to your User or Global Options File:

command.name.20.*=Favourites
command.20.*=SelectFavourite
command.subsystem.20.*=3
command.mode.20.*=savebefore:no
command.shortcut.20.*=Ctrl+-

After a restart, the favourites feature should be ready for use. All you need now are valid entries in your favourites file (see below).

Favourites

The actual favourites are stored in an extra file so that you can have different ones for different operating systems and users. Depending on your platform, the favourites file needs to be located at %USERPROFILE%\SciTE.favs (Windows) or $HOME/.SciTE.favs (Unix, e.g. Linux). The contents of the file are simply your favourite files, one per line, with complete paths. No need to escape anything.

Example SciTE.favs for Windows:

C:\path\to\some file.txt
C:\some.html

Example .SciTE.favs for Linux:

/path/to/some file.txt
/some.html

JensHatlak

changed original script to close file-handles

Frank Wunderlich


RecentChanges · preferences
edit · history
Last edited February 7, 2007 9:11 pm GMT (diff)