summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md3
-rwxr-xr-xbuild1
-rw-r--r--syntax/unison.vim155
3 files changed, 158 insertions, 1 deletions
diff --git a/README.md b/README.md
index acbb71ea..5176171f 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,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 120+ times faster** than the <!--Package Count-->151<!--/Package Count--> packages it consists of.
+- It **installs and updates 120+ times faster** than the <!--Package Count-->152<!--/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`).
@@ -181,6 +181,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [tptp](https://github.com/c-cube/vim-tptp) (syntax)
- [twig](https://github.com/lumiliet/vim-twig) (syntax, indent, ftplugin)
- [typescript](https://github.com/HerringtonDarkholme/yats.vim) (syntax, indent, compiler, ftplugin, ctags)
+- [unison](https://github.com/unisonweb/unison#trunk) (syntax)
- [v](https://github.com/ollykel/v-vim) (syntax, indent, ftplugin)
- [vala](https://github.com/arrufat/vala.vim) (syntax, indent, ftplugin)
- [vbnet](https://github.com/vim-scripts/vbnet.vim) (syntax)
diff --git a/build b/build
index 05d26080..5e786c9f 100755
--- a/build
+++ b/build
@@ -273,6 +273,7 @@ PACKS="
tptp:c-cube/vim-tptp
twig:lumiliet/vim-twig
typescript:HerringtonDarkholme/yats.vim
+ unison:unisonweb/unison#trunk:_ALL:/editor-support/vim/
v:ollykel/v-vim
vala:arrufat/vala.vim
vbnet:vim-scripts/vbnet.vim
diff --git a/syntax/unison.vim b/syntax/unison.vim
new file mode 100644
index 00000000..8353dce9
--- /dev/null
+++ b/syntax/unison.vim
@@ -0,0 +1,155 @@
+if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'unison') == -1
+
+" Vim syntax file, adapted from Haskell file by John Williams <jrw@pobox.com>
+"
+" Language: unison
+" Maintainer: Unison Computing
+" Last Change: Aug 23, 2018
+" Original Author: Paul Chiusano and Rúnar Bjarnason
+"
+" Options-assign a value to these variables to turn the option on:
+"
+" u_highlight_delimiters - Highlight delimiter characters--users
+" with a light-colored background will
+" probably want to turn this on.
+" u_highlight_boolean - Treat True and False as keywords.
+" u_highlight_types - Treat names of primitive types as keywords.
+" u_highlight_more_types - Treat names of other common types as keywords.
+" u_highlight_debug - Highlight names of debugging functions.
+" u_allow_hash_operator - Don't highlight seemingly incorrect C
+" preprocessor directives but assume them to be
+" operators
+"
+" 2018 Aug 23: Adapt Haskell highlighting to Unison, cleanup.
+" 2004 Feb 19: Added C preprocessor directive handling, corrected eol comments
+" cleaned away literate unison support (should be entirely in
+" lunison.vim)
+" 2004 Feb 20: Cleaned up C preprocessor directive handling, fixed single \
+" in eol comment character class
+" 2004 Feb 23: Made the leading comments somewhat clearer where it comes
+" to attribution of work.
+
+" Remove any old syntax stuff hanging around
+if version < 600
+ syn clear
+elseif exists("b:current_syntax")
+ finish
+endif
+
+" (Qualified) identifiers (no default highlighting)
+syn match ConId "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=\<[A-Z][a-zA-Z0-9_']*\>"
+syn match VarId "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=\<[a-z][a-zA-Z0-9_']*\>"
+
+" Infix operators--most punctuation characters and any (qualified) identifier
+" enclosed in `backquotes`. An operator starting with : is a constructor,
+" others are variables (e.g. functions).
+syn match uVarSym "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[-!#$%&\*\+/<=>\?@\\^|~.][-!#$%&\*\+/<=>\?@\\^|~:.]*"
+syn match uConSym "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=:[-!#$%&\*\+./<=>\?@\\^|~:]*"
+syn match uVarSym "`\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[a-z][a-zA-Z0-9_']*`"
+syn match uConSym "`\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[A-Z][a-zA-Z0-9_']*`"
+
+" Reserved symbols--cannot be overloaded.
+syn match uDelimiter "(\|)\|\[\|\]\|,\|_\|{\|}"
+
+" Strings and constants
+syn match uSpecialChar contained "\\\([0-9]\+\|o[0-7]\+\|x[0-9a-fA-F]\+\|[\"\\'&\\abfnrtv]\|^[A-Z^_\[\\\]]\)"
+syn match uSpecialChar contained "\\\(NUL\|SOH\|STX\|ETX\|EOT\|ENQ\|ACK\|BEL\|BS\|HT\|LF\|VT\|FF\|CR\|SO\|SI\|DLE\|DC1\|DC2\|DC3\|DC4\|NAK\|SYN\|ETB\|CAN\|EM\|SUB\|ESC\|FS\|GS\|RS\|US\|SP\|DEL\)"
+syn match uSpecialCharError contained "\\&\|'''\+"
+syn region uString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=uSpecialChar
+syn match uCharacter "[^a-zA-Z0-9_']'\([^\\]\|\\[^']\+\|\\'\)'"lc=1 contains=uSpecialChar,uSpecialCharError
+syn match uCharacter "^'\([^\\]\|\\[^']\+\|\\'\)'" contains=uSpecialChar,uSpecialCharError
+syn match uNumber "\<[0-9]\+\>\|\<0[xX][0-9a-fA-F]\+\>\|\<0[oO][0-7]\+\>"
+syn match uFloat "\<[0-9]\+\.[0-9]\+\([eE][-+]\=[0-9]\+\)\=\>"
+
+" Keyword definitions. These must be patterns instead of keywords
+" because otherwise they would match as keywords at the start of a
+" "literate" comment (see lu.vim).
+syn match uModule "\<module\>"
+syn match uImport "\<use\>"
+syn match uInfix "\<\(infix\|infixl\|infixr\)\>"
+syn match uTypedef "\<\(∀\|forall\)\>"
+syn match uStatement "\<\(unique\|ability\|type\|where\|match\|cases\|;\|let\|with\|handle\)\>"
+syn match uConditional "\<\(if\|else\|then\)\>"
+
+" Not real keywords, but close.
+if exists("u_highlight_boolean")
+ " Boolean constants from the standard prelude.
+ syn match uBoolean "\<\(true\|false\)\>"
+endif
+if exists("u_highlight_types")
+ " Primitive types from the standard prelude and libraries.
+ syn match uType "\<\(Float\|Nat\|Int\|Boolean\|Remote\|Text\)\>"
+endif
+if exists("u_highlight_more_types")
+ " Types from the standard prelude libraries.
+ syn match uType "\<\(Optional\|Either\|Sequence\|Effect\)\>"
+ syn match uMaybe "\<None\>"
+ syn match uExitCode "\<\(ExitSuccess\)\>"
+ syn match uOrdering "\<\(GT\|LT\|EQ\)\>"
+endif
+if exists("u_highlight_debug")
+ " Debugging functions from the standard prelude.
+ syn match uDebug "\<\(undefined\|error\|trace\)\>"
+endif
+
+
+" Comments
+syn match uLineComment "---*\([^-!#$%&\*\+./<=>\?@\\^|~].*\)\?$"
+syn region uBlockComment start="{-" end="-}" contains=uBlockComment
+syn region uPragma start="{-#" end="#-}"
+
+" Docs
+syn region uDocBlock start="\[:" end=":]" contains=uLink,uDocDirective
+syn match uLink contained "@\([A-Z][a-zA-Z0-9_']*\.\)\=\<[a-z][a-zA-Z0-9_'.]*\>"
+syn match uDocDirective contained "@\[\([A-Z][a-zA-Z0-9_']*\.\)\=\<[a-z][a-zA-Z0-9_'.]*\>] \(\<[A-Z][a-zA-Z0-9_']*\.\)\=\<[a-z][a-zA-Z0-9_'.]*\>"
+
+" Define the default highlighting.
+" For version 5.7 and earlier: only when not done already
+" For version 5.8 and later: only when an item doesn't have highlighting yet
+if version >= 508 || !exists("did_u_syntax_inits")
+ if version < 508
+ let did_u_syntax_inits = 1
+ command -nargs=+ HiLink hi link <args>
+ else
+ command -nargs=+ HiLink hi def link <args>
+ endif
+
+ HiLink uImport Include
+ HiLink uInfix PreProc
+ HiLink uStatement Statement
+ HiLink uConditional Conditional
+ HiLink uSpecialChar SpecialChar
+ HiLink uTypedef Typedef
+ HiLink uVarSym uOperator
+ HiLink uConSym uOperator
+ HiLink uOperator Operator
+ HiLink uDelimiter Delimiter
+ HiLink uSpecialCharError Error
+ HiLink uString String
+ HiLink uCharacter Character
+ HiLink uNumber Number
+ HiLink uFloat Float
+ HiLink uConditional Conditional
+ HiLink uLiterateComment uComment
+ HiLink uBlockComment uComment
+ HiLink uLineComment uComment
+ HiLink uComment Comment
+ HiLink uDocBlock String
+ HiLink uLink uType
+ HiLink uDocDirective uImport
+ HiLink uPragma SpecialComment
+ HiLink uBoolean Boolean
+ HiLink uType Type
+ HiLink uMaybe uEnumConst
+ HiLink uOrdering uEnumConst
+ HiLink uEnumConst Constant
+ HiLink uDebug Debug
+
+ delcommand HiLink
+endif
+
+let b:current_syntax = "unison"
+
+" Options for vi: ts=8 sw=2 sts=2 nowrap noexpandtab ft=vim
+
+endif