diff options
| author | Adam Stankiewicz <sheerun@sher.pl> | 2019-03-04 10:35:44 +0100 | 
|---|---|---|
| committer | Adam Stankiewicz <sheerun@sher.pl> | 2019-03-04 10:35:44 +0100 | 
| commit | 4f0bde6d67160df91875be29abae7f87587771a2 (patch) | |
| tree | 5ea4b27712a6602fc7bc2a2ea1c6bfaa5839971d | |
| parent | 833b2fadd5e9830435d53b9b16e438b0aa96ac77 (diff) | |
| download | vim-polyglot-4f0bde6d67160df91875be29abae7f87587771a2.tar.gz vim-polyglot-4f0bde6d67160df91875be29abae7f87587771a2.zip | |
Add flatbuffers support, closes #368
| -rw-r--r-- | README.md | 3 | ||||
| -rwxr-xr-x | build | 1 | ||||
| -rw-r--r-- | ftdetect/polyglot.vim | 7 | ||||
| -rw-r--r-- | syntax/fbs.vim | 56 | 
4 files changed, 66 insertions, 1 deletions
| @@ -8,7 +8,7 @@ A collection of language packs for Vim.  > One to rule them all, one to find them, one to bring them all and in the darkness bind them.  - It **won't affect your startup time**, as scripts are loaded only on demand\*. -- It **installs and updates 100+ times faster** than the <!--Package Count-->124<!--/Package Count--> packages it consists of. +- It **installs and updates 100+ times faster** than the <!--Package Count-->125<!--/Package Count--> packages it consists of.  - Solid syntax and indentation support (other features skipped). Only the best language packs.  - All unnecessary files are ignored (like enormous documentation from php support).  - No support for esoteric languages, only most popular ones (modern too, like `slim`). @@ -72,6 +72,7 @@ If you need full functionality of any plugin, please use it directly with your p  - [erlang](https://github.com/vim-erlang/vim-erlang-runtime) (syntax, indent)  - [ferm](https://github.com/vim-scripts/ferm.vim) (syntax)  - [fish](https://github.com/dag/vim-fish) (syntax, indent, compiler, autoload, ftplugin) +- [flatbuffers](https://github.com/dcharbon/vim-flatbuffers) (syntax)  - [fsharp](https://github.com/fsharp/vim-fsharp) (syntax, indent)  - [git](https://github.com/tpope/vim-git) (syntax, indent, ftplugin)  - [glsl](https://github.com/tikhomirov/vim-glsl) (syntax, indent) @@ -180,6 +180,7 @@ PACKS="    erlang:vim-erlang/vim-erlang-runtime    ferm:vim-scripts/ferm.vim    fish:dag/vim-fish +  flatbuffers:dcharbon/vim-flatbuffers    fsharp:fsharp/vim-fsharp:_BASIC    git:tpope/vim-git    glsl:tikhomirov/vim-glsl diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 4e8214a8..a996ad42 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -345,6 +345,13 @@ autocmd BufNewFile,BufRead *.ferm setf ferm    augroup end  endif +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'flatbuffers') == -1 +  augroup filetypedetect +  " flatbuffers, from fbs.vim in dcharbon/vim-flatbuffers +autocmd BufNewFile,BufRead *.fbs setfiletype fbs +  augroup end +endif +  if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'fsharp') == -1    augroup filetypedetect    " fsharp, from fsharp.vim in fsharp/vim-fsharp:_BASIC diff --git a/syntax/fbs.vim b/syntax/fbs.vim new file mode 100644 index 00000000..90ee9409 --- /dev/null +++ b/syntax/fbs.vim @@ -0,0 +1,56 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'flatbuffers') != -1 +  finish +endif + +if exists("b:current_syntax") +  finish +endif + +syn case match + +syn keyword fbTodo contained TODO FIXME XXX +syn cluster fbCommentGrp contains=fbTodo + +syn keyword fbSyntax include namespace attribute root_type +syn keyword fbTypeDef enum +syn keyword fbTypeDecl union struct table +syn keyword fbFieldType bool byte int8 ubyte uint8 +syn keyword fbFieldType short int16 ushort uint16 +syn keyword fbFieldType int int32 uint uint32 +syn keyword fbFieldType long int64 ulong uint64 +syn keyword fbFieldType float float32 double float64 +syn keyword fbFieldType string +syn keyword fbBool true false + +syn region fbComment start="//" skip="\\$" end="$" keepend contains=@fbCommentGrp + +syn match fbInt /-\?\<\d\+\>/ +syn match fbInt /\<0[xX]\x+\>/ +syn match fbFloat /\<-\?\d*\(\.\d*\)\?/ + +syn region fbString start=/"/ skip=/\\./ end=/"/ + +if version >= 508 || !exists("did_proto_syn_inits") +  if version < 508 +    let did_proto_syn_inits = 1 +    command -nargs=+ HiLink hi link <args> +  else +    command -nargs=+ HiLink hi def link <args> +  endif + +  HiLink fbTodo Todo +  HiLink fbSyntax Include +  HiLink fbTypeDecl Structure +  HiLink fbFieldType Type +  HiLink fbTypeDef Typedef +  HiLink fbBool Boolean + +  HiLink fbInt Number +  HiLink fbFloat Float +  HiLink fbComment Comment +  HiLink fbString String + +  delcommand HiLink +endif + +let b:current_syntax = "fbs" | 
