|
| |
SL Editor Tutorial: Editing SIMION Text Files--Instructions on configuring and using the VIM and Emacs text editors to effectively edit SIMION SL, PRG, and GEM files (e.g. syntax highlighting). IntroductionThis document describes how to configure the VIM and Emacs (XEmacs and GNU) text editors to syntax highlight and perform other functions on SIMION-related files. Attention SL Toolkit Users: The copy of VIM included in the SL Toolkit 1.2 and above is preconfigured with the plugins. You may skip or skip the installation sections of this document. To use the SL Editor, just right click on a SIMION file (PRG, SL, GEM, or PATXT) in Windows Explorer and select "SIMION: Edit". Below is an example of VIM editing a SIMION "GEM" geometry file: |
|

Although you could edit files in Windows Notepad or use the antiquated SIMION "EDY" editor, an alternate text editor offers the following benefits:
We'll first describe how to configure VIM and then do the same for Emacs.
The "Editor Files for SIMION" contain customization files for the VIM and Emacs text editors. The files may be downloaded here: simion-editor.zip. They are also also bundled with the SIMION SL Toolkit v. 1.2 and above.
The steps for setting up VIM to work with SIMION files are provided below:
Here some optional customizations you might want to make.
The first thing you should know about VIM is that VIM is what is called a "modal" editor (in contrast to "modeless" editors like Notepad, MS Word, and Emacs). Read the VIM documentation. If you don't, you will be confused.
If you don't want to read the manual, or if you prefer the "normal" way to edit text, there is an easy fix. Just add the line "source $VIMRUNTIME/evim.vim" to your ".vimrc" file. VIM will then start up in "Easy Mode," which behaves quite normally.
GUI_EDITOR=c:\vim\vim62\gvim.exe
GUI_FILENAMES=LONG_FILENAMES
Under modern versions of Windows, environment variables can be set from the "Windows Control Panel | System | Advanced | Environment Variables." Alternately, if you are starting SIMION from simion.bat, you can add the following lines to the top of the simion.bat file:
set GUI_EDITOR=c:\vim\vim62\gvim.exe
set GUI_FILENAMES=LONG_FILENAMES
setlocal makeprg=c:\\sim7\\sl\\bin\\sl.bat\ %
to match the location where the SL compiler is installed.
Now to compile an SL file, first open the SL file. Then execute the command ":make" (or press the hammer tool button). If there is an error, the message will display. After pressing enter, the cursor will move to the line of the error.
Now, we'll look at how to configure Emacs. Below is a screenshot of XEmacs editing an SL program:

The steps for setting up Emacs to work with SIMION files are provided below:
Under XEmacs, copy the files contained in the "emacs" directory into some place where XEmacs can find them (e.g. "c:\Documents and Settings\me\.xemacs"). Then add the following lines to your "c:\Documents and Settings\me\.xemacs\init.el" file:
(add-to-list 'load-path (expand-file-name "~/.xemacs"))
(require 'simsl-mode)
(require 'simprg-mode)
(require 'simgem-mode)
Under GNU Emacs, copy the files contained in the "emacs" directory into some directory where Emacs can find them--for example, any directory reported when you run the command M-":" load-path (i.e. ESC key, followed by ":" key, followed by "load-path"). The "c:\", Emacs "site-lib" subdirectory, or a directory named in a HOME environment variable will often do. Then add the following lines to your ".emacs" or "_emacs" file:
(require 'simsl-mode)
(require 'simprg-mode)
(require 'simgem-mode)
(global-font-lock-mode t)
The .emacs or _emacs file should be located wherever your HOME directory is (or "c:\" if the HOME environment variable is not set).
Here some optional customizations you might want to make.
GUI_EDITOR=c:\Program Files\xemacs\i586-pc-win32\xemacs.exe
GUI_FILENAMES=LONG_FILENAMES
Under modern versions of Windows, environment variables can be set from the "Windows Control Panel, System | Advanced | Environment Variables." Alternately, if you are starting SIMION from simion.bat, you can add the following lines to the top of the simion.bat file:
set GUI_EDITOR=c:\Program Files\xemacs\i586-pc-win32\xemacs.exe
set GUI_FILENAMES=LONG_FILENAMES
The manner to configure the VIM and Emacs text editors to syntax highlight and edit SIMION-related text files has been discussed. Similar methods could be used when setting up other text editors.
--David Manura, Scientific Instrument Services, Inc. 2004-04.