From 09729362e79d31f7c9de2ba35ed336109924670f Mon Sep 17 00:00:00 2001 From: sup39 Date: Tue, 22 Feb 2022 12:14:04 +0900 Subject: [PATCH] init --- LICENSE | 22 ++++++++++++++++++++ README.md | 12 +++++++++++ ftdetect/sunscript.vim | 1 + syntax/sunscript.vim | 47 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 82 insertions(+) create mode 100644 LICENSE create mode 100644 README.md create mode 100644 ftdetect/sunscript.vim create mode 100644 syntax/sunscript.vim diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..af788f7 --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2022 sup39[サポミク] + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..686b1a3 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# sunscript.vim +Vim syntax highlight for SunScript. + +## Installation +If you are using [vim-plug](https://github.com/junegunn/vim-plug/), +add the following line between +`call plug#begin('~/.vim/plugged')` and `call plug#end()`: +```vim +Plug 'sup39/sunscript.vim' +``` + +Then `:source $MYVIMRC` and `:PlugInstall` to install this plug. diff --git a/ftdetect/sunscript.vim b/ftdetect/sunscript.vim new file mode 100644 index 0000000..3107aae --- /dev/null +++ b/ftdetect/sunscript.vim @@ -0,0 +1 @@ +autocmd BufNewFile,BufRead *.sun setfiletype sunscript diff --git a/syntax/sunscript.vim b/syntax/sunscript.vim new file mode 100644 index 0000000..4640206 --- /dev/null +++ b/syntax/sunscript.vim @@ -0,0 +1,47 @@ +if exists("b:current_syntax") + finish +endif + +" literal-keyword +"" loop +syn keyword sunKeyword break continue return +"" flow +syn keyword sunKeyword yield exit block unlock +"" storage +syn keyword sunKeyword const var local + +" import +syn keyword sunKeyword import + +" CONDITIONALS +syn keyword sunKeyword do while for else if + +" function +syn keyword sunKeyword function builtin + +" comment +syn region sunComment start='\V/*' end='\V*/' +syn match sunComment '//.*' + +" literal +"" address +syn match sunNumber '\v\$[0-9A-Fa-f]{8}>' +"" hexadecimal +syn match sunNumber '\v<0x[0-9A-Fa-f]+>' +"" integer +syn match sunNumber '\v<[0-9]+>' +"" decimal +syn match sunNumber '\v<[0-9]+\.[0-9]+>' +"" string +syn match sunString '\v"%([^"\\]|\\%(\'\'|["\\0abfnrtv]|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}))*"' +"" bool +syn keyword sunBoolean true false + +"""" hi +hi link sunKeyword Keyword +hi link sunComment Comment +hi link sunNumber Number +hi link sunString String +hi link sunBoolean Boolean + +let b:current_syntax = 'sunscript'