diff options
| -rw-r--r-- | .config/nvim/ftdetect/microscript.lua | 7 | ||||
| -rw-r--r-- | .config/nvim/ftplugin/microscript.vim | 7 | ||||
| -rw-r--r-- | .config/nvim/syntax/microscript.vim | 42 |
3 files changed, 56 insertions, 0 deletions
diff --git a/.config/nvim/ftdetect/microscript.lua b/.config/nvim/ftdetect/microscript.lua new file mode 100644 index 0000000..d14f783 --- /dev/null +++ b/.config/nvim/ftdetect/microscript.lua @@ -0,0 +1,7 @@ +---@diagnostic disable: undefined-global +vim.api.nvim_create_autocmd({"BufNewFile", "BufRead"}, { + pattern = {"*.us", "*.microscript"}, + callback = function() + vim.o.filetype = "microscript" + end +}) diff --git a/.config/nvim/ftplugin/microscript.vim b/.config/nvim/ftplugin/microscript.vim new file mode 100644 index 0000000..13f29fc --- /dev/null +++ b/.config/nvim/ftplugin/microscript.vim @@ -0,0 +1,7 @@ +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +setlocal comments=# +setlocal commentstring=#\ %s diff --git a/.config/nvim/syntax/microscript.vim b/.config/nvim/syntax/microscript.vim new file mode 100644 index 0000000..e6b77f7 --- /dev/null +++ b/.config/nvim/syntax/microscript.vim @@ -0,0 +1,42 @@ +if exists("b:current_syntax") + finish +endif + +syn keyword usStatement break next ret +syn keyword usStructure let global +syn keyword usLiteral true false zilch nada +syn keyword usConditional else elseif +syn keyword usOperator and or +syn keyword usTodo TODO FIXME HACK XXX + +syn region usIfEnd transparent matchgroup=usConditional start="\<if\>" end="\<end\>" contains=TOP +syn region usRepeatEnd transparent matchgroup=usRepeat start="\<loop\>" end="\<end\>" contains=TOP +syn region usDoEnd transparent matchgroup=usStatement start="\<do\>" end="\<end\>" contains=TOP +syn region usFunEnd transparent matchgroup=usStructure start="\<fun\>" end="\<end\>" contains=TOP +syn region usString start=/"/ end=/"/ contains=usSpecial +syn region usString start=/'/ end=/'/ contains=usSpecial + +syn match usFunction /[a-zA-Z_][a-zA-Z0-9_:]*\ze(/ +syn match usLabel /<[a-zA-Z_][a-zA-Z0-9_:]*>$/ +syn match usSpecial contained /\\[\\"'tnr]/ +syn match usComment /\#.*/ contains=usTodo +syn match usNumber /\<\d\+\>/ +syn match usNumber /\<\d\+\.\d*/ +syn match usOperator /=|\+=|-=|\*=|\/=|%=||\+|-|\*|\/|%|<|>|<=|>=|==|!=|!|\.|\.\./ + +hi def link usStructure Structure +hi def link usFunction Function +hi def link usStatement Statement +hi def link usLabel Label +hi def link usConditional Conditional +hi def link usRepeat Repeat +hi def link usModifier StorageClass +hi def link usString String +hi def link usSpecial Special +hi def link usOperator Operator +hi def link usNumber Constant +hi def link usLiteral Constant +hi def link usComment Comment +hi def link usTodo Todo + +let b:current_syntax = 'microscript' |
