Browse Source

Adds plugin and indent files

master
Brian Evans 1 year ago
parent
commit
ef9076c94c
  1. 8
      Makefile
  2. 11
      ftplugin/nimf.vim
  3. 21
      indent/nimf.vim
  4. 2
      syntax/nimf.vim

8
Makefile

@ -3,6 +3,8 @@ LANGNAME := nimf
SYN := /syntax
FT := /ftdetect
PLUG := /ftplugin
INDENT := /indent
ifeq ($(OS), Windows_NT)
ROOT := $(HOME)/vimfiles
@ -18,10 +20,16 @@ endif
install: ./syntax/${LANGNAME}.vim ./ftdetect/${LANGNAME}.vim
install -d ${ROOT}${SYN}
install -d ${ROOT}${FT}
install -d ${ROOT}${PLUG}
install -d ${ROOT}${INDENT}
install -m 0644 .${SYN}/${LANGNAME}.vim ${ROOT}${SYN}
install -m 0644 .${FT}/${LANGNAME}.vim ${ROOT}${FT}
install -m 0644 .${PLUG}/${LANGNAME}.vim ${ROOT}${PLUG}
install -m 0644 .${INDENT}/${LANGNAME}.vim ${ROOT}${INDENT}
.PHONY: remove
remove:
rm -rf ${ROOT}${SYN}/${LANGNAME}.vim
rm -rf ${ROOT}${FT}/${LANGNAME}.vim
rm -rf ${ROOT}${PLUG}/${LANGNAME}.vim
rm -rf ${ROOT}${INDENT}/${LANGNAME}.vim

11
ftplugin/nimf.vim

@ -0,0 +1,11 @@
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
setlocal tabstop=3
setlocal softtabstop=3
setlocal shiftwidth=3
setlocal comments& comments^=sbO:(,mbO:\ `,ebxO:\ )
setlocal commentstring=(\ %s\ )

21
indent/nimf.vim

@ -0,0 +1,21 @@
setlocal indentexpr=NimfIndent()
function! NimfIndent()
let line = getline(v:lnum)
let previousNum = prevnonblank(v:lnum - 1)
let previous = getline(previousNum)
if previous =~ ":"
return indent(previousNum) + &tabstop
endif
if previous =~ 'if$' || previous =~ 'else$' || previous =~ 'do$'
return indent(previousNum) + &tabstop
endif
if line =~ 'else$' || line =~ 'then$' || line =~ 'loop$' || line =~ ';$'
return indent(previousNum) + &tabstop
endif
return indent(previousNum)
endfunction

2
syntax/nimf.vim

@ -12,6 +12,8 @@ elseif exists("b:current_syntax")
finish
endif
syn sync maxlines=200
" Characters allowed in keywords
if version >= 600
setlocal iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255

Loading…
Cancel
Save