├── LICENSE ├── README.md ├── ftdetect └── wren.vim ├── ftplugin └── wren.vim ├── indent └── wren.vim └── syntax └── wren.vim /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Lukas Werling 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | vim-wren 2 | ======== 3 | 4 | Vim syntax highlighting for the [Wren][wren] scripting language. 5 | 6 | [Example rendering with the gruvbox colorscheme][example] 7 | 8 | Installation 9 | ------------ 10 | 11 | With pathogen, run 12 | 13 | ```bash 14 | git clone https://github.com/lluchs/vim-wren ~/.vim/bundle/vim-wren 15 | ``` 16 | 17 | With vim-plug, add the following to your `~/.vimrc`: 18 | 19 | ```vim 20 | Plug 'lluchs/vim-wren' 21 | ``` 22 | 23 | With Vundle, add this: 24 | 25 | ```vim 26 | Plugin 'lluchs/vim-wren' 27 | ``` 28 | 29 | [wren]: http://wren.io/ 30 | [example]: https://rawgit.com/lluchs/ff2c0e380af8c58e0154/raw/syntax.wren.html 31 | -------------------------------------------------------------------------------- /ftdetect/wren.vim: -------------------------------------------------------------------------------- 1 | au BufNewFile,BufRead *.wren setfiletype wren 2 | -------------------------------------------------------------------------------- /ftplugin/wren.vim: -------------------------------------------------------------------------------- 1 | " Only do this when not done yet for this buffer 2 | if exists("b:did_ftplugin") 3 | finish 4 | endif 5 | 6 | " Don't load another plugin for this buffer 7 | let b:did_ftplugin = 1 8 | 9 | " Set 'formatoptions' to break comment lines but not other lines, 10 | " and insert the comment leader when hitting or using "o". 11 | setlocal fo-=t fo+=croql 12 | 13 | " Set a template for a comment. 14 | setlocal commentstring=//\ %s 15 | -------------------------------------------------------------------------------- /indent/wren.vim: -------------------------------------------------------------------------------- 1 | if exists("b:did_indent") 2 | finish 3 | endif 4 | let b:did_indent = 1 5 | 6 | " 'smartindent' works well enough. 7 | setlocal autoindent smartindent nocindent indentexpr= 8 | setlocal cinwords=if,else,while,for 9 | -------------------------------------------------------------------------------- /syntax/wren.vim: -------------------------------------------------------------------------------- 1 | if exists("b:current_syntax") 2 | finish 3 | endif 4 | 5 | syntax keyword wrenNull null 6 | syntax keyword wrenBoolean true false 7 | syntax match wrenNumber "\v<\d+(\.\d+)?>|\.\d+>" 8 | syntax match wrenNumber "\v<0x[[:xdigit:]]+>" 9 | 10 | syntax match wrenEscape "\v\\0|\\\"|\\\\|\\a|\\b|\\f|\\n|\\r|\\t|\\v|\\u[[:xdigit:]]{4}|\\x[[:xdigit:]]{2}" 11 | syntax region wrenString contains=wrenEscape start=/\v"/ skip=/\v\\"/ end=/\v"/ 12 | 13 | syntax keyword wrenConditional else if 14 | syntax keyword wrenRepeat break for while continue 15 | syntax keyword wrenKeyword class as in is new return super this var import 16 | syntax keyword wrenConstruct construct contained containedin=wrenConstructor 17 | syntax keyword wrenStatic static contained containedin=wrenMethod,wrenForeignMethod 18 | syntax keyword wrenForeign foreign contained containedin=wrenForeignMethod 19 | 20 | " The contains= fixes highlighting of indented if, for, and while. 21 | syntax match wrenMethod "\v^\s*(static\s+)?\w+\=?\ze\s*(\([^)]*\))?\s*\{" contains=wrenRepeat,wrenConditional 22 | syntax match wrenConstructor "\v^\s*construct\s+\w+\ze\s*(\([^)]*\))?\s*\{" 23 | syntax match wrenForeignMethod "\v^\s*foreign\s+(static\s+)?\w+" 24 | syntax match wrenForeignClass "\v^\s*foreign\s+class" 25 | 26 | syntax match wrenOperatorDef "\V\^\s\*\(!\|~\|-\|==\?\|!=\|<=\?\|>=\?\|...\?\||\|&\|+\|-\|*\|/\|%\)\ze\s\*\((\[^)]\*)\)\?\s\*{" 27 | syntax match wrenOperator "\V!\|~\|-\|==\?\|!=\|<=\?\|>=\?\|...\?\||\|&\|+\|-\|*\|/\|%" 28 | 29 | syntax match wrenField "\v_\w+" display 30 | syntax match wrenStaticField "\v__\w+" display 31 | syntax match wrenToplevel "\v<[A-Z]\w*" display 32 | 33 | syntax keyword wrenTodo contained TODO FIXME XXX 34 | syntax match wrenComment contains=wrenTodo "\v//.*$" 35 | syntax region wrenComment contains=wrenTodo,wrenComment start=#\v/\*# end=#\*/# 36 | syntax match wrenComment "\%^#!.*" 37 | 38 | syntax keyword wrenMisplacedKeyword static 39 | 40 | highlight def link wrenNull Constant 41 | highlight def link wrenBoolean Boolean 42 | highlight def link wrenNumber Number 43 | highlight def link wrenString String 44 | highlight def link wrenEscape SpecialChar 45 | highlight def link wrenConditional Conditional 46 | highlight def link wrenRepeat Repeat 47 | highlight def link wrenKeyword Keyword 48 | highlight def link wrenConstruct Keyword 49 | highlight def link wrenStatic Keyword 50 | highlight def link wrenForeign Keyword 51 | highlight def link wrenMethod Function 52 | highlight def link wrenForeignClass Keyword 53 | highlight def link wrenConstructor Function 54 | highlight def link wrenForeignMethod Function 55 | highlight def link wrenOperatorDef Function 56 | highlight def link wrenOperator Operator 57 | highlight def link wrenIdentifier Identifier 58 | highlight def link wrenStaticField wrenIdentifier 59 | highlight def link wrenField wrenIdentifier 60 | highlight def link wrenToplevel wrenIdentifier 61 | highlight def link wrenComment Comment 62 | highlight def link wrenTodo Todo 63 | highlight def link wrenMisplacedKeyword Error 64 | 65 | let b:current_syntax = "wren" 66 | --------------------------------------------------------------------------------