1
0
Fork 0
VIm syntax/plugin for the slope programming language
Go to file
sloum a6e7a1c834 Adds support for raw strings 2022-10-17 15:16:44 -07:00
ftdetect Initial commit 2021-09-15 22:57:00 -07:00
ftplugin Refactors run code 2022-05-29 03:23:39 +00:00
syntax Adds support for raw strings 2022-10-17 15:16:44 -07:00
Makefile Initial commit 2021-09-15 22:57:00 -07:00
README.md Updates logic for running file in normal mode and adds a variable for remapping the plugin's leder key 2022-05-26 21:22:44 +00:00

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
  • 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)

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!)