From b5f89bf73f4f81d0492971ee7f5485f0dac07f13 Mon Sep 17 00:00:00 2001 From: Buddy Sandidge Date: Wed, 24 Sep 2014 20:52:38 -0700 Subject: [PATCH] Squashed 'vim/bundle/dart/' content from commit ef0621a0d git-subtree-dir: vim/bundle/dart git-subtree-split: ef0621a0d461ff493baa4873012868b21db3f7f5 --- AUTHORS | 12 ++++++ LICENSE | 24 +++++++++++ README.md | 37 ++++++++++++++++ ftdetect/dart.vim | 1 + ftplugin/dart.vim | 25 +++++++++++ indent/dart.vim | 9 ++++ syntax/dart.vim | 106 ++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 214 insertions(+) create mode 100644 AUTHORS create mode 100644 LICENSE create mode 100644 README.md create mode 100644 ftdetect/dart.vim create mode 100644 ftplugin/dart.vim create mode 100644 indent/dart.vim create mode 100644 syntax/dart.vim diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..6cccc06 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,12 @@ +# Below is a list of people and organizations that have contributed +# to the Dart project. Names should be added to the list like so: +# +# If you contributed to the project(s) in this repository, and would +# like your name included here, please contact misc@dartlang.org mailing list. +# +# Name/Organization + +Google Inc. + +Ladislav Thon +Nishino Naruhiko (@rbtnn) diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..81764fd --- /dev/null +++ b/LICENSE @@ -0,0 +1,24 @@ +Copyright 2012, the Dart project authors. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..2e482eb --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ +# Dart plugin for VIM + +This is an (unsupported) plugin for using Dart with Vim. Pull requests welcome! + +Looking for an IDE experience? Try [Dart Editor][1], +[Dart plugin for Eclipse][2], or [Dart plugin for IntelliJ/WebStorm][3]. + +License: + + Copyright 2012, the Dart project authors. All rights reserved. + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +[1]: http://www.dartlang.org/editor +[2]: http://news.dartlang.org/2012/08/dart-plugin-for-eclipse-is-ready-for.html +[3]: http://plugins.intellij.net/plugin/?id=6351 \ No newline at end of file diff --git a/ftdetect/dart.vim b/ftdetect/dart.vim new file mode 100644 index 0000000..a3938b6 --- /dev/null +++ b/ftdetect/dart.vim @@ -0,0 +1 @@ +autocmd BufRead,BufNewFile *.dart set filetype=dart diff --git a/ftplugin/dart.vim b/ftplugin/dart.vim new file mode 100644 index 0000000..2300950 --- /dev/null +++ b/ftplugin/dart.vim @@ -0,0 +1,25 @@ +if exists('b:did_ftplugin') + finish +endif +let b:did_ftplugin = 1 + +" Enable automatic indentation (2 spaces) +setlocal expandtab +setlocal shiftwidth=2 +setlocal softtabstop=2 + +setlocal formatoptions-=t + +" Set 'comments' to format dashed lists in comments. +setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// + +setlocal commentstring=//%s +let s:win_sep = (has('win32') || has('win64')) ? '/' : '' +let &l:errorformat = + \ join([ + \ ' %#''file://' . s:win_sep . '%f'': %s: line %l pos %c:%m', + \ '%m' + \ ], ',') + + +let b:undo_ftplugin = 'setl et< fo< sw< sts< com< cms<' diff --git a/indent/dart.vim b/indent/dart.vim new file mode 100644 index 0000000..81a7b91 --- /dev/null +++ b/indent/dart.vim @@ -0,0 +1,9 @@ +if exists('b:did_indent') + finish +endif +let b:did_indent = 1 + +setlocal cindent +setlocal cinoptions+=j1,J1 + +let b:undo_indent = 'setl cin< cino<' diff --git a/syntax/dart.vim b/syntax/dart.vim new file mode 100644 index 0000000..b288dcb --- /dev/null +++ b/syntax/dart.vim @@ -0,0 +1,106 @@ +" Vim syntax file " Language: Dart +" Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file +" for details. All rights reserved. Use of this source code is governed by a +" BSD-style license that can be found in the LICENSE file. + +if !exists("g:main_syntax") + if version < 600 + syntax clear + elseif exists("b:current_syntax") + finish + endif + let g:main_syntax = 'dart' + syntax region dartFold start="{" end="}" transparent fold +endif + +" Ensure long multiline strings are highlighted. +syntax sync fromstart + +" keyword definitions +syntax keyword dartConditional if else switch +syntax keyword dartRepeat do while for +syntax keyword dartBoolean true false +syntax keyword dartConstant null +syntax keyword dartTypedef this super class typedef +syntax keyword dartOperator new is as in factory +syntax match dartOperator "+=\=\|-=\=\|*=\=\|/=\=\|%=\=\|\~/=\=\|<<=\=\|>>=\=\|[<>]=\=\|===\=\|\!==\=\|&=\=\|\^=\=\||=\=\|||\|&&\|\[\]=\=\|=>\|!\|\~\|?\|:" +syntax keyword dartType void var bool int double num dynamic +syntax keyword dartStatement return +syntax keyword dartStorageClass static abstract final const +syntax keyword dartExceptions throw rethrow try on catch finally +syntax keyword dartAssert assert +syntax keyword dartClassDecl extends with implements +syntax keyword dartBranch break continue nextgroup=dartUserLabelRef skipwhite +syntax keyword dartKeyword get set operator call external +syntax match dartUserLabelRef "\k\+" contained + +syntax region dartLabelRegion transparent matchgroup=dartLabel start="\" matchgroup=NONE end=":" +syntax keyword dartLabel default + +syntax match dartLibrary "^\(import\|part of\|part\|export\|library\|show\|hide\)\s" + +" Comments +syntax keyword dartTodo contained TODO FIXME XXX +syntax region dartComment start="/\*" end="\*/" contains=dartTodo,dartDocLink,@Spell +syntax match dartLineComment "//.*" contains=dartTodo,@Spell +syntax match dartLineDocComment "///.*" contains=dartTodo,dartDocLink,@Spell +syntax region dartDocLink contained start=+\[+ end=+\]+ + +" Strings +syntax region dartString start=+\z(["']\)+ end=+\z1+ contains=@Spell,dartInterpolation,dartSpecialChar +syntax region dartRawString start=+r\z(["']\)+ end=+\z1+ contains=@Spell +syntax region dartMultilineString start=+\z("\{3\}\|'\{3\}\)+ end=+\z1+ contains=@Spell,dartInterpolation,dartSpecialChar +syntax region dartRawMultilineString start=+r\z("\{3\}\|'\{3\}\)+ end=+\z1+ contains=@Spell +syntax match dartInterpolation contained "\$\(\w\+\|{[^}]\+}\)" +syntax match dartSpecialChar contained "\\\(u\x\{4\}\|u{\x\+}\|x\x\x\|x{\x\+}\|.\)" + +" Numbers +syntax match dartNumber "\<\d\+\(\.\d\+\)\=\>" + +" TODO(antonm): consider conditional highlighting of corelib classes. +syntax keyword dartCoreClasses BidirectionalIterator Comparable DateTime Duration Expando Function Invocation Iterable Iterator List Map Match Object Pattern RegExp RuneIterator Runes Set StackTrace Stopwatch String StringBuffer StringSink Symbol Type +syntax keyword dartCoreTypedefs Comparator +syntax keyword dartCoreExceptions AbstractClassInstantiationError ArgumentError AssertionError CastError ConcurrentModificationError Error Exception FallThroughError FormatException IntegerDivisionByZeroException NoSuchMethodError NullThrownError OutOfMemoryError RangeError RuntimeError StackOverflowError StateError TypeError UnimplementedError UnsupportedError + + +" The default highlighting. +highlight default link dartBranch Conditional +highlight default link dartUserLabelRef dartUserLabel +highlight default link dartLabel Label +highlight default link dartUserLabel Label +highlight default link dartConditional Conditional +highlight default link dartRepeat Repeat +highlight default link dartExceptions Exception +highlight default link dartAssert Statement +highlight default link dartStorageClass StorageClass +highlight default link dartClassDecl dartStorageClass +highlight default link dartBoolean Boolean +highlight default link dartString String +highlight default link dartRawString String +highlight default link dartMultilineString String +highlight default link dartRawMultilineString String +highlight default link dartNumber Number +highlight default link dartStatement Statement +highlight default link dartOperator Operator +highlight default link dartComment Comment +highlight default link dartLineComment Comment +highlight default link dartLineDocComment Comment +highlight default link dartConstant Constant +highlight default link dartTypedef Typedef +highlight default link dartTodo Todo +highlight default link dartKeyword Keyword +highlight default link dartType Type +highlight default link dartInterpolation PreProc +highlight default link dartDocLink SpecialComment +highlight default link dartSpecialChar SpecialChar +highlight default link dartLibrary Include +highlight default link dartCoreClasses Type +highlight default link dartCoreTypedefs Typedef +highlight default link dartCoreExceptions Exception + +let b:current_syntax = "dart" +let b:spell_options = "contained" + +if g:main_syntax is# 'dart' + unlet g:main_syntax +endif