Tuesday, April 10, 2007

Scite Tips on Windows

When I program in a Windows machine my favorite editor is VIM and my second favorite editor is SciTE. For anyone that finds VIM complicated then SciTE is by far the best editor I have ever used.

SciTE is small and fast, can be used in multiple platforms, and supports folds, tabs, auto completion and a large number of language highlights.

If you have read my previous posts you will notice that I am a console guy, that is, I do most of my computer interaction using commands on a console (Linux) or command prompt (Windows).

One of the problems I found with SciTE is that it could not open files as tabs when invoked from the command prompt. Instead SciTE would create a new editor window for each invocation to the command "scite program.cpp". This can quickly clutter the desktop when working with programming projects that involve large number of files (i.e source, header, make files).

Fortunately there is a little application that allows us to open files as tabs rather than opening new editor windows.

Open files as Tabs on existing SciTE window

Download the scitecmd and copy it in any place in your PATH. For some reason this file has not .exe extension so rename the file to add the extension (i.e. scitecmd.exe). Once this application is in your PATH you can open new files as tabs on current SciTE windows (if one is available) with the following call.

scitecmd program.cpp

If no SciTE window is open then scitecmd will open a new one and all subsequent call to scitecmd will open the files as tabs on that window.

Create aliases (Optional)

As a Vim fan on Linux I like to create two shortcuts to the scite and scitecmd commands that resemble the commands used in Vim to open files:

doskey vi=scite $*
doskey split=scitecmd $*

The first alias will allow me to open new files in their own windows by calling "vi program.cpp" as I would in Linux and the second alias "split program.cpp" will open it as a tab in any current scite window. This is my own preference and you can use any aliases you see fit.

SJIS Support in SciTE (optional)

The computer I use at work has a Japanese version of Windows XP that uses a very strange character encoding. This is no problem as I write my program comments in English but when I get some files with Japanese text form my co-workers SciTE displays them as garbage.

To make SciTE display the Japanese text correctly I must add the corresponding char encodings in the configuration files. I learned how to do this reading this post.

1. Open SciTE
2. From the menu select Options -> Open User Options file -> SciTEUser.properties
3. Write the following text

code.page=932
character.set=128

4. Save the file from the menu with File -> Save
5. Restart SciTE

3 comments:

  1. Anonymous1:45 AM

    Hi, to open with tabs you can also open the SciTEGlobal.properties file in the SciTE folder and uncomment this:

    check.if.already.open=1

    Now all new files will open in the same instance

    ReplyDelete
  2. Nice indeed... is there any official documentation where I can refer this tip??

    ReplyDelete
  3. Anonymous8:15 PM

    what i do is this :

    Sc176.exe -open:playercounter.c -open:makefile

    ReplyDelete