Browse Source

Initial version.

master
Thomas Kerber 2 years ago
commit
7a2cdb1e60
Signed by: Thomas Kerber <tk@drwx.org> GPG Key ID: 8489B911F9ED617B
2 changed files with 47 additions and 0 deletions
  1. +1
    -0
      ftdetect/nyx.vim
  2. +46
    -0
      syntax/nyx.vim

+ 1
- 0
ftdetect/nyx.vim View File

@@ -0,0 +1 @@
au BufRead,BufNewFile *.nyx set filetype=nyx

+ 46
- 0
syntax/nyx.vim View File

@@ -0,0 +1,46 @@
" Vim syntax file
" Language: Nyx
" Maintainer: Thomas Kerber (tk@drwx.org)
" URL: https://git.drwx.org/phd/vim-nyx.git
" Based on vim-solidity

if exists("b:current_syntax")
finish
endif

syn keyword nyxKeyword while public private state if else offline return
syn keyword nyxConstant true false
syn keyword nyxBuiltinType int bool array string hash set merkletree public_key keypair
syn keyword nyxBuiltinFunction log assert

hi def link nyxKeyword Keyword
hi def link nyxConstant Constant
hi def link nyxBuiltinType Type
hi def link nyxBuiltinFunction Function

syn match nyxOperator /\(!\||\|&\|+\|-\|<\|>\|=\|%\|\/\|*\|\~\|\^\)/
syn match nyxNumber /\<-\=\d\+L\=\>\|\<0[xX]\x\+\>/
syn region nyxString start=+"+ skip=+\\\\\|\\$"+ end=+"+

hi def link nyxOperator Operator
hi def link nyxNumber Number
hi def link nyxString String

" Function
syn match nyxFunction /\<fn\>/ nextgroup=nyxFuncName skipwhite
syn match nyxFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*/ skipwhite
syn match nyxFuncCall /\<[a-zA-Z_$][0-9a-zA-Z_$]*(\@=/ skipwhite

hi def link nyxFunction Keyword
hi def link nyxFuncName Function
hi def link nyxFuncCall Function

" Comment
syn keyword nyxCommentTodo TODO FIXME XXX TBD contained
syn region nyxLineComment start=+\/\/+ end=+$+ contains=nyxCommentTodo,@Spell
syn region nyxLineComment start=+^\s*\/\/+ skip=+\n\s*\/\/+ end=+$+ contains=nyxCommentTodo,@Spell fold
syn region nyxComment start="/\*" end="\*/" contains=nyxCommentTodo,@Spell fold

hi def link nyxCommentTodo Comment
hi def link nyxLineComment Comment
hi def link nyxComment Comment

Loading…
Cancel
Save