neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

odin.vim (3890B)


      1 " Vim indent plugin file
      2 " Language: Odin
      3 " Maintainer: Maxim Kim <habamax@gmail.com>
      4 " Website: https://github.com/habamax/vim-odin
      5 " Last Change: 2024-01-15
      6 "
      7 " This file has been manually translated from Vim9 script.
      8 
      9 if exists("b:current_syntax")
     10  finish
     11 endif
     12 
     13 let s:cpo_save = &cpo
     14 set cpo&vim
     15 
     16 syntax keyword odinKeyword using transmute cast distinct opaque where dynamic
     17 syntax keyword odinKeyword struct enum union const bit_field bit_set
     18 syntax keyword odinKeyword package proc map import export foreign
     19 syntax keyword odinKeyword size_of offset_of type_info_of typeid_of type_of align_of
     20 syntax keyword odinKeyword return defer
     21 syntax keyword odinKeyword or_return or_else
     22 syntax keyword odinKeyword inline no_inline
     23 
     24 syntax keyword odinConditional if when else do for switch case continue break
     25 syntax keyword odinType string cstring bool b8 b16 b32 b64 rune any rawptr
     26 syntax keyword odinType f16 f32 f64 f16le f16be f32le f32be f64le f64be
     27 syntax keyword odinType u8 u16 u32 u64 u128 u16le u32le u64le u128le u16be
     28 syntax keyword odinType u32be u64be u128be uint uintptr i8 i16 i32 i64 i128
     29 syntax keyword odinType i16le i32le i64le i128le i16be i32be i64be i128be
     30 syntax keyword odinType int complex complex32 complex64 complex128 matrix typeid
     31 syntax keyword odinType quaternion quaternion64 quaternion128 quaternion256
     32 syntax keyword odinBool true false
     33 syntax keyword odinNull nil
     34 syntax match odinUninitialized '\s\+---\(\s\|$\)'
     35 
     36 syntax keyword odinOperator in notin not_in
     37 syntax match odinOperator "?" display
     38 syntax match odinOperator "->" display
     39 
     40 syntax match odinTodo "TODO" contained
     41 syntax match odinTodo "XXX" contained
     42 syntax match odinTodo "FIXME" contained
     43 syntax match odinTodo "HACK" contained
     44 
     45 syntax region odinRawString start=+`+ end=+`+
     46 syntax region odinChar start=+'+ skip=+\\\\\|\\'+ end=+'+
     47 syntax region odinString start=+"+ skip=+\\\\\|\\'+ end=+"+ contains=odinEscape
     48 syntax match odinEscape display contained /\\\([nrt\\'"]\|x\x\{2}\)/
     49 
     50 syntax match odinProcedure "\v<\w*>(\s*::\s*proc)@="
     51 
     52 syntax match odinAttribute "@\ze\<\w\+\>" display
     53 syntax region odinAttribute
     54      \ matchgroup=odinAttribute
     55      \ start="@\ze(" end="\ze)"
     56      \ transparent oneline
     57 
     58 syntax match odinInteger "\-\?\<\d\+\>" display
     59 syntax match odinFloat "\-\?\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\%([eE][+-]\=[0-9_]\+\)\=" display
     60 syntax match odinHex "\<0[xX][0-9A-Fa-f]\+\>" display
     61 syntax match odinDoz "\<0[zZ][0-9a-bA-B]\+\>" display
     62 syntax match odinOct "\<0[oO][0-7]\+\>" display
     63 syntax match odinBin "\<0[bB][01]\+\>" display
     64 
     65 syntax match odinAddressOf "&" display
     66 syntax match odinDeref "\^" display
     67 
     68 syntax match odinMacro "#\<\w\+\>" display
     69 
     70 syntax match odinTemplate "$\<\w\+\>"
     71 
     72 syntax region odinLineComment start=/\/\// end=/$/  contains=@Spell,odinTodo
     73 syntax region odinBlockComment start=/\/\*/ end=/\*\// contains=@Spell,odinTodo,odinBlockComment
     74 syn sync ccomment odinBlockComment
     75 
     76 highlight def link odinKeyword Statement
     77 highlight def link odinConditional Conditional
     78 highlight def link odinOperator Operator
     79 
     80 highlight def link odinString String
     81 highlight def link odinRawString String
     82 highlight def link odinChar Character
     83 highlight def link odinEscape Special
     84 
     85 highlight def link odinProcedure Function
     86 
     87 highlight def link odinMacro PreProc
     88 
     89 highlight def link odinLineComment Comment
     90 highlight def link odinBlockComment Comment
     91 
     92 highlight def link odinTodo Todo
     93 
     94 highlight def link odinAttribute Statement
     95 highlight def link odinType Type
     96 highlight def link odinBool Boolean
     97 highlight def link odinNull Constant
     98 highlight def link odinUninitialized Constant
     99 highlight def link odinInteger Number
    100 highlight def link odinFloat Float
    101 highlight def link odinHex Number
    102 highlight def link odinOct Number
    103 highlight def link odinBin Number
    104 highlight def link odinDoz Number
    105 
    106 let b:current_syntax = "odin"
    107 
    108 let &cpo = s:cpo_save
    109 unlet s:cpo_save