Browse Source

Adds readme and license

master
sloum 1 year ago
parent
commit
c2e242c3ba
  1. 9
      LICENSE
  2. 12
      README.md
  3. 8
      indent/nimf.vim

9
LICENSE

@ -0,0 +1,9 @@
Copyright 2020 sloum < sloum@rawtext.club >
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

12
README.md

@ -0,0 +1,12 @@
# Nimf Vim Syntax
A syntax and indentation setup for nimf, an interpreted stack based language (really, a naive attempt at a forth-like language).
## What it does
The syntax highlights many common 'words' and builtins. It also does a reasonably sane autoindent and sets widths for the indent.
## License
BSD 2-clause

8
indent/nimf.vim

@ -18,10 +18,10 @@ function! NimfIndent()
endif
" Add a 'shiftwidth' after lines that start a block:
" 'function', 'if', 'for', 'while', 'repeat', 'else', 'elseif', '{'
" ':', 'if', 'do', 'else'
let ind = indent(prevlnum)
let prevline = getline(prevlnum)
let midx = match(prevline, '^\s*\%(if\>\|do\>\|else\>\)')
let midx = match(prevline, '^\s*\%(\<if\>\|\<do\>\|\<else\>\)')
if midx == -1
let midx = match(prevline, '{\s*$')
if midx == -1
@ -31,13 +31,13 @@ function! NimfIndent()
if midx != -1
" Add 'shiftwidth' if what we found previously is not in a comment and
" an "end" or "until" is not present on the same line.
" an "end" or "loop" is not present on the same line.
if synIDattr(synID(prevlnum, midx + 1, 1), "name") != "nimfComment" && prevline !~ '\<;\>\|\<loop\>\|\<then\>'
let ind = ind + shiftwidth()
endif
endif
" Subtract a 'shiftwidth' on end, else, elseif, until and '}'
" Subtract a 'shiftwidth' on loop, else, ';', then
" This is the part that requires 'indentkeys'.
let midx = match(getline(v:lnum), '^\s*\%(else\>\|loop\>\|;\>\|then\>\|}\)')
if midx != -1 && synIDattr(synID(v:lnum, midx + 1, 1), "name") != "nimfComment"

Loading…
Cancel
Save