Adds more plugin features
This commit is contained in:
parent
e3efeeb43c
commit
39deadd03f
26
README.md
26
README.md
@ -1,3 +1,27 @@
|
||||
# slope vim syntax
|
||||
# slope vim syntax and language plugin
|
||||
|
||||
Vim syntax highlighting for the [slope language](https://git.rawtext.club/slope-lang).
|
||||
|
||||
## Syntax
|
||||
|
||||
The syntax is mostly what you'd expect and borrows a good bit from various scheme/lisp syntax files.
|
||||
|
||||
## 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
|
||||
- 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 `.vim` file
|
||||
- Typing `sn` while in normal or visual mode will move the cursor to the next opening parenthesis; `(`
|
||||
- Typing `sN` 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)
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
make # from the root of the repo
|
||||
```
|
||||
|
||||
|
@ -11,4 +11,34 @@ setlocal commentstring=;%s
|
||||
setlocal nocindent
|
||||
setlocal expandtab
|
||||
|
||||
" Sets the local leader to 's' for use in
|
||||
" mappings within the plugin/buffer
|
||||
let maplocalleader="s"
|
||||
|
||||
if !exists("g:slope_command")
|
||||
let g:slope_command = "slope"
|
||||
endif
|
||||
|
||||
" Function to run the current slope file with the slope interpreter
|
||||
" the interpreter can be overridden in .vim by setting g:slope_command
|
||||
" to something else
|
||||
function! RunSlopeFile()
|
||||
silent !clear
|
||||
execute "!" . g:slope_command . " " . bufname("%")
|
||||
endfunction
|
||||
|
||||
" map sn and sN to find the next or prev '(' across lines
|
||||
" in normal and visual mode
|
||||
nnoremap <buffer> <localleader>n :call search('\V(')<cr>
|
||||
nnoremap <buffer> <localleader>N :call search('\V(', 'b')<cr>
|
||||
vnoremap <buffer> <localleader>n :call search('\V(')<cr>
|
||||
vnoremap <buffer> <localleader>N :call search('\V(', 'b')<cr>
|
||||
|
||||
" map sr to run the file
|
||||
nnoremap <buffer> <localleader>r :call RunSlopeFile()<cr>
|
||||
|
||||
" map sp to switch to the opposite paren
|
||||
nnoremap <buffer> <localleader>p %
|
||||
vnoremap <buffer> <localleader>p %
|
||||
|
||||
let b:did_ftplugin = 1
|
||||
|
Loading…
Reference in New Issue
Block a user