Add type, pragma, additional keywords
This commit is contained in:
parent
7a8737a453
commit
65a8caac8f
3 changed files with 11 additions and 4 deletions
|
|
@ -19,8 +19,7 @@ fun! nim#init() abort
|
||||||
if !v:shell_error && expand('%:e') ==# 'nim'
|
if !v:shell_error && expand('%:e') ==# 'nim'
|
||||||
let false = 0 " Needed for eval of json
|
let false = 0 " Needed for eval of json
|
||||||
let true = 1 " Needed for eval of json
|
let true = 1 " Needed for eval of json
|
||||||
let dumpdata = eval(substitute(raw_dumpdata, "\n", '', 'g'))
|
let dumpdata = eval(trim(substitute(raw_dumpdata, "\n", '', 'g'), ""))
|
||||||
|
|
||||||
let b:nim_project_root = dumpdata['project_path']
|
let b:nim_project_root = dumpdata['project_path']
|
||||||
let b:nim_defined_symbols = dumpdata['defined_symbols']
|
let b:nim_defined_symbols = dumpdata['defined_symbols']
|
||||||
let b:nim_caas_enabled = g:nim_caas_enabled || index(dumpdata['defined_symbols'], 'forcecaas') != -1
|
let b:nim_caas_enabled = g:nim_caas_enabled || index(dumpdata['defined_symbols'], 'forcecaas') != -1
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ let b:nim_loaded = 1
|
||||||
let s:cpo_save = &cpo
|
let s:cpo_save = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
call nim#init()
|
:call nim#init()
|
||||||
|
|
||||||
setlocal formatoptions-=t formatoptions+=croql
|
setlocal formatoptions-=t formatoptions+=croql
|
||||||
setlocal comments=:##,:#
|
setlocal comments=:##,:#
|
||||||
|
|
|
||||||
|
|
@ -54,9 +54,12 @@ syn keyword nimKeyword var vtref vtptr
|
||||||
syn keyword nimKeyword when while with without
|
syn keyword nimKeyword when while with without
|
||||||
syn keyword nimKeyword xor
|
syn keyword nimKeyword xor
|
||||||
syn keyword nimKeyword yield
|
syn keyword nimKeyword yield
|
||||||
|
syn keyword nimKeyword lent sink
|
||||||
|
|
||||||
syn match nimFunction "[a-zA-Z_][a-zA-Z0-9_]*" contained
|
syn match nimFunction "[a-zA-Z_][a-zA-Z0-9_]*" contained
|
||||||
|
syn match nimPragma "[a-zA-Z_][a-zA-Z0-9_]*" contained
|
||||||
syn match nimClass "[a-zA-Z_][a-zA-Z0-9_]*" contained
|
syn match nimClass "[a-zA-Z_][a-zA-Z0-9_]*" contained
|
||||||
|
syn match nimType "\v<[A-Z][a-zA-Z0-9_]+>"
|
||||||
syn keyword nimRepeat for while
|
syn keyword nimRepeat for while
|
||||||
syn keyword nimConditional if elif else case of
|
syn keyword nimConditional if elif else case of
|
||||||
syn keyword nimOperator and in is not or xor shl shr div
|
syn keyword nimOperator and in is not or xor shl shr div
|
||||||
|
|
@ -68,6 +71,8 @@ syn keyword nimBoolean true false
|
||||||
|
|
||||||
" Strings
|
" Strings
|
||||||
syn region nimString start=+'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=nimEscape,nimEscapeError,@Spell
|
syn region nimString start=+'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=nimEscape,nimEscapeError,@Spell
|
||||||
|
syn region nimFunction start=+`+ skip=+\\\\\|\\`\|\\$+ excludenl end=+`+ end=+$+ keepend contains=nimEscape,nimEscapeError,@Spell
|
||||||
|
syn region nimPragmaSection start=+{.+ skip=+\\\\\|\\`\|\\$+ excludenl end=+.}+ end=+$+ keepend contains=nimEscape,nimEscapeError,@Spell,nimPragma
|
||||||
syn region nimString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=nimEscape,nimEscapeError,@Spell
|
syn region nimString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=nimEscape,nimEscapeError,@Spell
|
||||||
syn region nimString start=+"""+ end=+"""+ keepend contains=nimEscape,nimEscapeError,@Spell
|
syn region nimString start=+"""+ end=+"""+ keepend contains=nimEscape,nimEscapeError,@Spell
|
||||||
syn region nimRawString matchgroup=Normal start=+[rR]"+ end=+"+ skip=+\\\\\|\\"+ contains=@Spell
|
syn region nimRawString matchgroup=Normal start=+[rR]"+ end=+"+ skip=+\\\\\|\\"+ contains=@Spell
|
||||||
|
|
@ -101,6 +106,7 @@ if nim_highlight_builtins == 1
|
||||||
syn keyword nimBuiltin set Byte Natural Positive Conversion
|
syn keyword nimBuiltin set Byte Natural Positive Conversion
|
||||||
syn keyword nimBuiltin BiggestInt BiggestFloat cchar cschar cshort cint csize cuchar cushort
|
syn keyword nimBuiltin BiggestInt BiggestFloat cchar cschar cshort cint csize cuchar cushort
|
||||||
syn keyword nimBuiltin clong clonglong cfloat cdouble clongdouble cuint culong culonglong cchar
|
syn keyword nimBuiltin clong clonglong cfloat cdouble clongdouble cuint culong culonglong cchar
|
||||||
|
syn keyword nimBuiltin typedesc stmt expr any untyped typed
|
||||||
syn keyword nimBuiltin CompileDate CompileTime nimversion nimVersion nimmajor nimMajor
|
syn keyword nimBuiltin CompileDate CompileTime nimversion nimVersion nimmajor nimMajor
|
||||||
syn keyword nimBuiltin nimminor nimMinor nimpatch nimPatch cpuendian cpuEndian hostos hostOS hostcpu hostCPU inf
|
syn keyword nimBuiltin nimminor nimMinor nimpatch nimPatch cpuendian cpuEndian hostos hostOS hostcpu hostCPU inf
|
||||||
syn keyword nimBuiltin neginf nan QuitSuccess QuitFailure dbglinehook dbgLineHook stdin
|
syn keyword nimBuiltin neginf nan QuitSuccess QuitFailure dbglinehook dbgLineHook stdin
|
||||||
|
|
@ -168,6 +174,8 @@ if v:version >= 508 || !exists('did_nim_syn_inits')
|
||||||
HiLink nimBrackets Operator
|
HiLink nimBrackets Operator
|
||||||
HiLink nimKeyword Keyword
|
HiLink nimKeyword Keyword
|
||||||
HiLink nimFunction Function
|
HiLink nimFunction Function
|
||||||
|
HiLink nimPragma Pragma
|
||||||
|
HiLink nimType Type
|
||||||
HiLink nimConditional Conditional
|
HiLink nimConditional Conditional
|
||||||
HiLink nimRepeat Repeat
|
HiLink nimRepeat Repeat
|
||||||
HiLink nimString String
|
HiLink nimString String
|
||||||
|
|
@ -186,7 +194,7 @@ if v:version >= 508 || !exists('did_nim_syn_inits')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if nim_highlight_builtins == 1
|
if nim_highlight_builtins == 1
|
||||||
HiLink nimBuiltin Number
|
HiLink nimBuiltin Special
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if nim_highlight_exceptions == 1
|
if nim_highlight_exceptions == 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue