- Syntax highlighting
- Auto-indenting
- Moving around by productions
- Toggling comment/uncomment productions
- Code folding (You can fold a production into a single line)
- Taglist support
Download the archive and expand it into $HOME/.vim (C:\Documents and Settings\user\vimfiles in Windows). You should have the following files:
ftplugin/soar.vim | main configuration file |
ftdetect/soar.vim | makes vim recognize .soar files as filetype "soar" |
indent/soar.vim | auto-indentation configuration |
syntax/soar.vim | syntax highlighting configuration |
Code:
filetype on " enable filetype detection filetype plugin on " run ftplugin/soar.vim for .soar files filetype indent on " enable custom indentation syntax on " enable syntax highlighting
Code:
set t_Co=256
In normal mode
Alt-k | Move to the previous production |
Alt-j | Move to the next production |
Alt-c | Toggle commenting out the production |
Alt-a | Create an application rule for the proposal rule the cursor is in |
Code:
sp {test (state <s> ^superstate <ss>)X
Code:
sp {test (state <s> ^superstate <ss>) (<ss> ^X
Tag Lists
The taglist plugin for vim allows you to open a window that lists all the tags generated by the ctags program for files you're editing. With very little work it can be made to list productions in agent files. You can then jump to any production, even across different files, by navigating this list. This is quite useful when your productions are distributed across many files, for example if you created them with Visual Soar.
- Install Exuberant ctags from http://ctags.sourceforge.net or your Linux package manager.
- Install the taglist plugin from here.
- To get ctags to recognize Soar source code, add these lines into your $HOME/.ctags file (or C:\Documents and Settings\user\ctags.cnf in Windows):
Code:
--langdef=soar --langmap=soar:.soar --regex-soar=/^[ \t]*[gs]p[ \t]*\{[ \t]*([-a-zA-Z0-9_\*\|]*)/\1/p,production/
Note: Depending on your version of ctags, you may have to replace the escaped brace \{ with a regular brace. ctags should complain loudly about an unmatched brace if the syntax is wrong.
Now when you're editing a .soar file, you should be able to run the command :TlistOpen and get a list of all the productions in the current file. You can also use :TlistAddFiles *.soar to add all files in the directory.Developer
Joseph Xu