vim plugin indev

This commit is contained in:
Productive2 2021-02-26 10:34:15 +01:00
parent b85598dfb6
commit 4199c0dfc0
4 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1 @@
autocmd BufNewFile,BufRead *.jpl setfiletype japl

View File

@ -0,0 +1,8 @@
augroup japl
setlocal commentstring=//\ %s
setlocal tabstop=4
setlocal softtabstop=4
setlocal shiftwidth=4
augroup END

View File

@ -0,0 +1,20 @@
setlocal indentexpr=JaplIndent()
function! JaplIndent()
let line = getline(v:lnum)
let previousNum = prevnonblank(v:lnum-1)
let previous = getline(previousNum)
if previous =~ "{" && previous !~ "}" && line !~ "}"
return indent(previousNum) + &tabstop
endif
if line =~ "}"
return indent(previousNum) - &tabstop
endif
return indent(previousNum)
endfunction

View File

@ -0,0 +1,34 @@
syntax keyword japlTodos TODO XXX FIXME NOTE
syntax keyword japlKeywords
\ if
\ var
\ fun
syntax keyword japlBooleans
\ true
\ false
syntax match japlNumber "\v<\d+>"
syntax match japlNumber "\v<\d+.\d+>"
syntax match japlComment "//.*$"
syntax match japlBlock "{"
syntax match japlBlock "}"
syntax region japlString start=/"/ end=/"/
highlight default link japlTodos Todo
highlight default link japlComment Comment
highlight default link japlString String
highlight default link japlNumber Number
highlight default link japlBoolean Keyword
highlight default link japlKeywords Keyword
highlight default link japlBlock Keyword
" the following exist too:
" Operator
" PreProc (c macros e.g.)
" Delimeter
" Structure
" Type (user defined types)
" Include