VIm syntax/plugin for the slope programming language
ftdetect | ||
ftplugin | ||
syntax | ||
Makefile | ||
README.md |
slope vim syntax and language plugin
Vim syntax highlighting for the slope language.
Syntax
The syntax is mostly what you'd expect and borrows a good bit from various scheme/lisp syntax files. It includes a simplified version of "rainbow parens" to try and help make sense of what can, admittedly, be a lot of parens. The rainbow effect is done in the syntax rather than as a plugin.
Plugin
The plugin adds a few niceties (defines comments, sets lisp
for the buffer to avoid C style settings, and sets tabs to 2 spaces).
The plugin also adds a few functions/mappings:
- Typing
sr
while in normal mode will attempt to run the current buffer with the slope interpreter, it will be based on the last save point in the buffer so remember to:w
- If
slope
is not on your path you can add:let g:slope_command = '~/somewhere/slope'
(replacing the path with an actual path to a slope interpreter) to your.vimrc
file
- If
- Typing
sr
while in visual mode will attempt to run the currently selected code - Typing
sj
while in normal or visual mode will move the cursor to the next opening parenthesis;(
- Typing
sk
while in normal or visual mode will move the cursor to the previous opening parenthesis;(
- Typing
sp
while in normal or visual mode will move the cursor to a matching parenthesis (if you are on a parenthesis)- This is just a remap of
%
, but makes it so you don't have to use the shift key (a presonal preference)
- This is just a remap of
In the above mappings s
is used as a leader key, which is the default set by the plugin. If you would like to override this you can add something like the following to your .vimrc
:
" Map the slope leader to `L`
" Then run the file by typing `Lr`
" in normal mode, for example
let g:slope_leader="L"
Installation
make # from the root of the repo
Credits
Written by sloum with help from samhunter (thanks!)