Change vala provider to arrufat, closes #165

This commit is contained in:
Adam Stankiewicz 2017-02-02 21:53:26 +01:00
parent cc868aee51
commit b7e2b0cad3
No known key found for this signature in database
GPG Key ID: A62480DCEAC884DF
5 changed files with 113 additions and 42 deletions

View File

@ -114,7 +114,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [toml](https://github.com/cespare/vim-toml) (syntax, ftplugin, ftdetect) - [toml](https://github.com/cespare/vim-toml) (syntax, ftplugin, ftdetect)
- [twig](https://github.com/lumiliet/vim-twig) (syntax, indent, ftplugin) - [twig](https://github.com/lumiliet/vim-twig) (syntax, indent, ftplugin)
- [typescript](https://github.com/leafgarland/typescript-vim) (syntax, indent, compiler, ftplugin, ftdetect) - [typescript](https://github.com/leafgarland/typescript-vim) (syntax, indent, compiler, ftplugin, ftdetect)
- [vala](https://github.com/tkztmk/vim-vala) (syntax, indent, ftdetect) - [vala](https://github.com/arrufat/vala.vim) (syntax, indent, ftdetect)
- [vbnet](https://github.com/vim-scripts/vbnet.vim) (syntax) - [vbnet](https://github.com/vim-scripts/vbnet.vim) (syntax)
- [vcl](https://github.com/smerrill/vcl-vim-plugin) (syntax, ftdetect) - [vcl](https://github.com/smerrill/vcl-vim-plugin) (syntax, ftdetect)
- [vue](https://github.com/posva/vim-vue) (syntax, indent, ftplugin, ftdetect) - [vue](https://github.com/posva/vim-vue) (syntax, indent, ftplugin, ftdetect)

2
build
View File

@ -187,7 +187,7 @@ PACKS="
toml:cespare/vim-toml toml:cespare/vim-toml
twig:lumiliet/vim-twig twig:lumiliet/vim-twig
typescript:leafgarland/typescript-vim typescript:leafgarland/typescript-vim
vala:tkztmk/vim-vala vala:arrufat/vala.vim
vbnet:vim-scripts/vbnet.vim vbnet:vim-scripts/vbnet.vim
vcl:smerrill/vcl-vim-plugin vcl:smerrill/vcl-vim-plugin
vue:posva/vim-vue vue:posva/vim-vue

View File

@ -981,8 +981,7 @@ endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vala') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vala') == -1
autocmd BufRead *.vala,*.vapi set efm=%f:%l.%c-%[%^:]%#:\ %t%[%^:]%#:\ %m autocmd BufRead *.vala,*.vapi set efm=%f:%l.%c-%[%^:]%#:\ %t%[%^:]%#:\ %m
au BufRead,BufNewFile *.vala,*.vapi setfiletype vala au BufRead,BufNewFile *.vala,*.vapi,*.valadoc setfiletype vala
endif endif

View File

@ -1,36 +1,87 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vala') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vala') == -1
" Copyright (c) 2012 Takezoe Tomoaki <tkztmk@outlook.com> " Vim indent file
" " Language: Vala
" Permission is hereby granted, free of charge, to any person obtaining a copy " Author: Adrià Arrufat <adria.arrufat@protonmail.ch>
" of " Last Change: 2016 Dec 04
" 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.
" Vim indent file for Vala. " Only load this indent file when no other was loaded.
" It just sets cindent for Vala files...
if exists("b:did_indent") if exists("b:did_indent")
finish finish
endif endif
let b:did_indent = 1 let b:did_indent = 1
setl cin
let b:undo_indent = "setl cin<"
setlocal cindent
setlocal cinoptions=L0,(0,Ws,J1,j1
setlocal cinkeys=0{,0},!^F,o,O,0[,0]
" Some preliminary settings
setlocal nolisp " Make sure lisp indenting doesn't supersede us
setlocal autoindent " indentexpr isn't much help otherwise
setlocal indentexpr=GetValaIndent(v:lnum)
" Only define the function once.
if exists("*GetValaIndent")
finish
endif
" Come here when loading the script the first time.
function GetValaIndent(lnum)
" Hit the start of the file, use zero indent.
if a:lnum == 0
return 0
endif
" Starting assumption: cindent (called at the end) will do it right
" normally. We just want to fix up a few cases.
let line = getline(a:lnum)
" Search backwards for the previous non-empty line.
let prevlinenum = prevnonblank(a:lnum - 1)
let prevline = getline(prevlinenum)
while prevlinenum > 1 && prevline !~ '[^[:blank:]]'
let prevlinenum = prevnonblank(prevlinenum - 1)
let prevline = s:getline(prevlinenum)
endwhile
" If previous line contains a code attribute (e.g. [CCode (...)])
" don't increase the indentation
if prevline =~? '^\s*\[[A-Za-z]' && prevline =~? '\]$'
return indent(prevlinenum)
endif
" cindent gets lambda body wrong, as it treats the comma as indicating an
" unfinished statement (fix borrowed from rust.vim indent file):
"
" list.foreach ((entry) => {
" stdout.puts (entry);
" stdout.putc ('\n');
" if (entry == null) {
" print ("empty entry\n");
" }
" });
"
" and we want it to be:
" list.foreach ((entry) => {
" stdout.puts (entry);
" stdout.putc ('\n');
" if (entry == null) {
" print ("empty entry\n");
" }
" });
if prevline[len(prevline) - 1] == ","
\ && line !~ '^\s*[\[\]{}]'
\ && prevline !~ '([^()]\+,$'
\ && line !~ '^\s*\S\+\s*=>'
return indent(prevlinenum)
endif
" Fall back on cindent, which does it mostly right
return cindent(a:lnum)
endfunction
endif endif

View File

@ -6,8 +6,9 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vala') == -1
" Hans Vercammen <hveso3@gmail.com> " Hans Vercammen <hveso3@gmail.com>
" pancake <pancake@nopcode.org> " pancake <pancake@nopcode.org>
" Sebastian Reichel <sre@ring0.de> " Sebastian Reichel <sre@ring0.de>
" Last Change: 2012-02-19 " Adrià Arrufat <adria.arrufat@protonmail.ch>
" Filenames: *.vala *.vapi " Last Change: 2016-10-20
" Filenames: *.vala *.vapi *.valadoc
" "
" REFERENCES: " REFERENCES:
" [1] http://live.gnome.org/Vala " [1] http://live.gnome.org/Vala
@ -17,7 +18,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vala') == -1
" - better error checking for known errors " - better error checking for known errors
" - full support for valadoc " - full support for valadoc
" "
" add vala in /usr/share/vim/vim73/scripts.vim below ruby " add vala in /usr/share/vim/vim80/scripts.vim below ruby
" to have shebang support " to have shebang support
if exists("b:current_syntax") if exists("b:current_syntax")
@ -30,7 +31,7 @@ set cpo&vim
" Types " Types
syn keyword valaType bool char double float size_t ssize_t string unichar void syn keyword valaType bool char double float size_t ssize_t string unichar void
syn keyword valaType int int8 int16 int32 int64 long short syn keyword valaType int int8 int16 int32 int64 long short
syn keyword valaType uint uint8 uint16 uint32 uint64 ulong ushort syn keyword valaType uchar uint uint8 uint16 uint32 uint64 ulong ushort
" Storage keywords " Storage keywords
syn keyword valaStorage class delegate enum errordomain interface namespace struct syn keyword valaStorage class delegate enum errordomain interface namespace struct
" repeat / condition / label " repeat / condition / label
@ -49,19 +50,26 @@ syn keyword valaConstant false null true
syn keyword valaException try catch finally throw syn keyword valaException try catch finally throw
" Unspecified Statements " Unspecified Statements
syn keyword valaUnspecifiedStatement as base construct delete get in is lock new out params ref sizeof set this throws typeof using value var yield syn keyword valaUnspecifiedStatement as base construct delete get in is lock new out params ref sizeof set this throws typeof using value var yield
" Arrays and Lists
syn match valaArray "\(\w\(\w\)*\(\s\+\)\?<\)\+\(\(\s\+\)\?\w\(\w\)*\(?\|\*\)\?\(\,\)\?\)\+>\+"
" Methods
syn match valaMethod "\w\(\w\)*\(\s\+\)\?("he=e-1,me=e-1
" Operators
syn match valaOperator display "\%(+\|-\|/\|*\|=\|\^\|&\||\|!\|>\|<\|%\|?\)=\?"
" Delimiters
syn match valaDelimiter display "(\|)\|\[\|\]\|,\|;\|:\|{\|}\|\k\@<!_\k\@!\|[[:punct:]]\@<!@[[:punct:]]\@!"
" Comments " Comments
syn cluster valaCommentGroup contains=valaTodo syn cluster valaCommentGroup contains=valaTodo
syn keyword valaTodo contained TODO FIXME XXX NOTE syn keyword valaTodo contained TODO FIXME XXX NOTE
" valadoc Comments (ported from javadoc comments in java.vim) " valadoc Comments (ported from javadoc comments in java.vim)
" TODO: need to verify valadoc syntax
if !exists("vala_ignore_valadoc") if !exists("vala_ignore_valadoc")
syn cluster valaDocCommentGroup contains=valaDocTags,valaDocSeeTag syn cluster valaDocCommentGroup contains=valaDocTags,valaDocSeeTag
syn region valaDocTags contained start="{@\(link\|linkplain\|inherit[Dd]oc\|doc[rR]oot\|value\)" end="}" syn region valaDocTags contained start="{@\(link\|inherit[Dd]oc\)" end="}"
syn match valaDocTags contained "@\(param\|exception\|throws\|since\)\s\+\S\+" contains=valaDocParam syn match valaDocTags contained "@\(param\|exception\|throws\|since\)\s\+\S\+" contains=valaDocParam
syn match valaDocParam contained "\s\S\+" syn match valaDocParam contained "\s\S\+"
syn match valaDocTags contained "@\(author\|brief\|version\|return\|deprecated\)\>" syn match valaDocTags contained "@\(return\|deprecated\)\>"
syn region valaDocSeeTag contained matchgroup=valaDocTags start="@see\s\+" matchgroup=NONE end="\_."re=e-1 contains=valaDocSeeTagParam syn region valaDocSeeTag contained matchgroup=valaDocTags start="@see\s\+" matchgroup=NONE end="\_."re=e-1 contains=valaDocSeeTagParam
syn match valaDocSeeTagParam contained @"\_[^"]\+"\|<a\s\+\_.\{-}</a>\|\(\k\|\.\)*\(#\k\+\((\_[^)]\+)\)\=\)\=@ extend syn match valaDocSeeTagParam contained @"\_[^"]\+"\|<a\s\+\_.\{-}</a>\|\(\k\|\.\)*\(#\k\+\((\_[^)]\+)\)\=\)\=@ extend
endif endif
@ -80,9 +88,9 @@ if exists("vala_comment_strings")
endif endif
else else
syn region valaCommentL start="//" end="$" keepend contains=@valaCommentGroup,valaSpaceError,@Spell syn region valaCommentL start="//" end="$" keepend contains=@valaCommentGroup,valaSpaceError,@Spell
syn region valaComment matchgroup=valaCommentStart start="/\*" end="\*/" contains=@valaCommentGroup,valaCommentStartError,valaSpaceError,@Spell syn region valaComment matchgroup=valaCommentStart start="/\*" end="\*/" fold contains=@valaCommentGroup,valaCommentStartError,valaSpaceError,@Spell
if !exists("vala_ignore_valadoc") if !exists("vala_ignore_valadoc")
syn region valaDocComment matchgroup=valaCommentStart start="/\*\*" end="\*/" keepend contains=@valaCommentGroup,@valaDocCommentGroup,valaCommentStartError,valaSpaceError,@Spell syn region valaDocComment matchgroup=valaCommentStart start="/\*\*" end="\*/" fold keepend contains=@valaCommentGroup,@valaDocCommentGroup,valaCommentStartError,valaSpaceError,@Spell
endif endif
endif endif
@ -103,7 +111,7 @@ syntax match valaCommentStartError display "/\*"me=e-1 contained
syn match valaComment "/\*\*/" syn match valaComment "/\*\*/"
" Vala Code Attributes " Vala Code Attributes
syn region valaAttribute start="^\s*\[" end="\]$" contains=valaComment,valaString keepend syn region valaAttribute start="^\s*\[" end="\]" contains=valaComment,valaString keepend
syn region valaAttribute start="\[CCode" end="\]" contains=valaComment,valaString syn region valaAttribute start="\[CCode" end="\]" contains=valaComment,valaString
" Avoid escaped keyword matching " Avoid escaped keyword matching
@ -113,8 +121,12 @@ syn match valaUserContent display "@\I*"
syn match valaSpecialError contained "\\." syn match valaSpecialError contained "\\."
syn match valaSpecialCharError contained "[^']" syn match valaSpecialCharError contained "[^']"
syn match valaSpecialChar contained +\\["\\'0abfnrtvx]+ syn match valaSpecialChar contained +\\["\\'0abfnrtvx]+
syn region valaString start=+"+ end=+"+ end=+$+ contains=valaSpecialChar,valaSpecialError,valaUnicodeNumber,@Spell syn match valaFormatChar contained +%\(%\|\([-]\)\?\([+]\)\?\([0-9]\+\)\?\(\.\)\?\([0-9]\+\)\?\(l\?[dfiu]\|ll\?[diu]\|c\|g\|hh\?[iu]\|s\)\)+
syn region valaVerbatimString start=+"""+ end=+"""+ contains=@Spell syn match valaTemplateVariable contained +\($\w\(\w\)*\)+
syn region valaTemplateExpression start=+$(+ end=")"
syn region valaString start=+"+ end=+"+ end=+$+ contains=valaSpecialChar,valaSpecialError,valaUnicodeNumber,@Spell,valaFormatChar
syn region valaTemplateString start=+@"+ end=+"+ end=+$+ contains=valaSpecialChar,valaSpecialError,valaUnicodeNumber,@Spell,valaFormatChar,valaTemplateVariable,valaTemplateExpression
syn region valaVerbatimString start=+"""+ end=+"""+ contains=@Spell,valaFormatChar
syn match valaUnicodeNumber +\\\(u\x\{4}\|U\x\{8}\)+ contained contains=valaUnicodeSpecifier syn match valaUnicodeNumber +\\\(u\x\{4}\|U\x\{8}\)+ contained contains=valaUnicodeSpecifier
syn match valaUnicodeSpecifier +\\[uU]+ contained syn match valaUnicodeSpecifier +\\[uU]+ contained
syn match valaCharacter "'[^']*'" contains=valaSpecialChar,valaSpecialCharError syn match valaCharacter "'[^']*'" contains=valaSpecialChar,valaSpecialCharError
@ -144,6 +156,7 @@ endif
exec "syn sync ccomment valaComment minlines=" . b:vala_minlines exec "syn sync ccomment valaComment minlines=" . b:vala_minlines
" code folding " code folding
set foldmethod=syntax
syn region valaBlock start="{" end="}" transparent fold syn region valaBlock start="{" end="}" transparent fold
" The default highlighting. " The default highlighting.
@ -158,6 +171,10 @@ hi def link valaException Exception
hi def link valaUnspecifiedStatement Statement hi def link valaUnspecifiedStatement Statement
hi def link valaUnspecifiedKeyword Keyword hi def link valaUnspecifiedKeyword Keyword
hi def link valaContextualStatement Statement hi def link valaContextualStatement Statement
hi def link valaArray StorageClass
hi def link valaMethod Function
hi def link valaOperator Operator
hi def link valaDelimiter Delimiter
hi def link valaCommentError Error hi def link valaCommentError Error
hi def link valaCommentStartError Error hi def link valaCommentStartError Error
@ -179,9 +196,13 @@ hi def link valaAttribute PreCondit
hi def link valaCommentString valaString hi def link valaCommentString valaString
hi def link valaComment2String valaString hi def link valaComment2String valaString
hi def link valaString String hi def link valaString String
hi def link valaTemplateString String
hi def link valaVerbatimString String hi def link valaVerbatimString String
hi def link valaCharacter Character hi def link valaCharacter Character
hi def link valaSpecialChar SpecialChar hi def link valaSpecialChar SpecialChar
hi def link valaFormatChar SpecialChar
hi def link valaTemplateVariable SpecialChar
hi def link valaTemplateExpression SpecialChar
hi def link valaNumber Number hi def link valaNumber Number
hi def link valaUnicodeNumber SpecialChar hi def link valaUnicodeNumber SpecialChar
hi def link valaUnicodeSpecifier SpecialChar hi def link valaUnicodeSpecifier SpecialChar