From 55ccf1fac7f75965ccc3a14595c255935683305b Mon Sep 17 00:00:00 2001 From: Ry Date: Tue, 9 Aug 2022 18:13:49 -0700 Subject: [PATCH] Add vim syntax highlighter --- vim-highlighting/README.md | 1 + vim-highlighting/ftdetect/fox32.vim | 1 + vim-highlighting/syntax/fox32.vim | 42 +++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 vim-highlighting/README.md create mode 100644 vim-highlighting/ftdetect/fox32.vim create mode 100644 vim-highlighting/syntax/fox32.vim diff --git a/vim-highlighting/README.md b/vim-highlighting/README.md new file mode 100644 index 0000000..9da0292 --- /dev/null +++ b/vim-highlighting/README.md @@ -0,0 +1 @@ +Copy these folders to your `~/.config/vim` or `~/.config/nvim` folder, then restart vim/nvim. This will automatically enable fox32 syntax highlighting for .asm files. diff --git a/vim-highlighting/ftdetect/fox32.vim b/vim-highlighting/ftdetect/fox32.vim new file mode 100644 index 0000000..93d6271 --- /dev/null +++ b/vim-highlighting/ftdetect/fox32.vim @@ -0,0 +1 @@ +au BufRead,BufNewFile *.asm set filetype=fox32 diff --git a/vim-highlighting/syntax/fox32.vim b/vim-highlighting/syntax/fox32.vim new file mode 100644 index 0000000..8bcab07 --- /dev/null +++ b/vim-highlighting/syntax/fox32.vim @@ -0,0 +1,42 @@ +" fox32 vim syntax highlighting + +if exists("b:current_syntax") + finish +endif + +syn match foxIdentifier /[_A-Za-z0-9]*/ +syn region foxString start=/"/ end=/"/ skip=/\\"/ +syn match foxCharacter /'\(?\|\\?\)/ +syn match foxDecimalNumber /\$\?-\?\d\+/ +syn match foxBinaryNumber /\$\?-\?0b[01]\+/ +syn match foxHexNumber /\$\?-\?0x\x\+/ + +syn match foxComment ";.*$" +syn match foxInclude "#.*$" + +syn match foxRegisters /\vr(3[01]|[12]?\d|sp)/ + +syn match foxLabel /[_A-Za-z0-9]*:/ + +syn keyword foxInstructions nop halt brk reti ret ise icl +syn keyword foxInstructions inc dec not jmp call loop rjmp rcall rloop push pop int +syn keyword foxInstructions add sub mul div rem and or xor sla sra srl rol ror bse bcl bts cmp movz mov rta in out + +syn keyword foxConditions ifz ifnz ifc ifnc ifgteq ifgt iglteq iflt + +syn keyword foxData data + +let b:current_syntax = "fox32" +hi def link foxIdentifier Identifier +hi def link foxString String +hi def link foxCharacter Character +hi def link foxDecimalNumber Number +hi def link foxBinaryNumber Number +hi def link foxHexNumber Number +hi def link foxComment Comment +hi def link foxInclude Include +hi def link foxRegisters Operator +hi def link foxLabel Function +hi def link foxInstructions Statement +hi def link foxConditions Conditional +hi def link foxData Keyword