mirror of https://github.com/japl-lang/japl.git
vim plugin indev
This commit is contained in:
parent
b85598dfb6
commit
4199c0dfc0
|
@ -0,0 +1 @@
|
||||||
|
autocmd BufNewFile,BufRead *.jpl setfiletype japl
|
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
augroup japl
|
||||||
|
setlocal commentstring=//\ %s
|
||||||
|
setlocal tabstop=4
|
||||||
|
setlocal softtabstop=4
|
||||||
|
setlocal shiftwidth=4
|
||||||
|
augroup END
|
||||||
|
|
|
@ -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
|
|
@ -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
|
Loading…
Reference in New Issue