diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2019-09-04 16:06:18 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2019-09-04 16:06:18 +0200 |
commit | 832dfece7629ac1a6f4894e956802b456ae791ea (patch) | |
tree | 2165f0f8cfded20568d3022b0a19bbb25b025434 | |
parent | 933e42ea1f2d615c8ce5aa6daa2994e6369de3cf (diff) | |
download | vim-polyglot-832dfece7629ac1a6f4894e956802b456ae791ea.tar.gz vim-polyglot-832dfece7629ac1a6f4894e956802b456ae791ea.zip |
Add dhall, closes #426
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | after/syntax/haskell.vim | 17 | ||||
-rwxr-xr-x | build | 1 | ||||
-rw-r--r-- | ftdetect/polyglot.vim | 9 | ||||
-rw-r--r-- | ftplugin/dhall.vim | 39 | ||||
-rw-r--r-- | syntax/dhall.vim | 66 |
6 files changed, 134 insertions, 1 deletions
@@ -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-->145<!--/Package Count--> packages it consists of. +- It **installs and updates 120+ times faster** than the <!--Package Count-->146<!--/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`). @@ -68,6 +68,7 @@ If you need full functionality of any plugin, please use it directly with your p - [cucumber](https://github.com/tpope/vim-cucumber) (syntax, indent, compiler, ftplugin) - [cue](https://github.com/mgrabovsky/vim-cuesheet) (syntax) - [dart](https://github.com/dart-lang/dart-vim-plugin) (syntax, indent, autoload, ftplugin) +- [dhall](https://github.com/vmchale/dhall-vim) (syntax, ftplugin) - [dlang](https://github.com/JesseKPhillips/d.vim) (syntax, indent) - [dockerfile](https://github.com/ekalinin/Dockerfile.vim) (syntax, indent, ftplugin) - [elixir](https://github.com/elixir-lang/vim-elixir) (syntax, indent, compiler, autoload, ftplugin) diff --git a/after/syntax/haskell.vim b/after/syntax/haskell.vim new file mode 100644 index 00000000..db454f2f --- /dev/null +++ b/after/syntax/haskell.vim @@ -0,0 +1,17 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'dhall') != -1 + finish +endif + +" store and remove current syntax value +let old_syntax = b:current_syntax +unlet b:current_syntax + +syn include @dhall syntax/dhall.vim +unlet b:current_syntax + +syn region dhallBlock matchgroup=quasiQuote start=/\[\$\?staticDhallExpression|/ end=/|\]/ contains=@dhall + +hi def link quasiQuote Underlined + +" restore current syntax value +let b:current_syntax = old_syntax @@ -178,6 +178,7 @@ PACKS=" cucumber:tpope/vim-cucumber cue:mgrabovsky/vim-cuesheet dart:dart-lang/dart-vim-plugin + dhall:vmchale/dhall-vim dlang:JesseKPhillips/d.vim dockerfile:ekalinin/Dockerfile.vim elixir:elixir-lang/vim-elixir diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 61b9baba..af4d6941 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -289,6 +289,15 @@ autocmd BufRead,BufNewFile *.dart set filetype=dart augroup end endif +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dhall') == -1 + augroup filetypedetect + " dhall, from dhall.vim in vmchale/dhall-vim +augroup dhall + autocmd BufNewFile,BufRead *.dhall set filetype=dhall +augroup END + augroup end +endif + if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dlang') == -1 augroup filetypedetect " dlang, from d.vim in JesseKPhillips/d.vim diff --git a/ftplugin/dhall.vim b/ftplugin/dhall.vim new file mode 100644 index 00000000..7afad55f --- /dev/null +++ b/ftplugin/dhall.vim @@ -0,0 +1,39 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'dhall') != -1 + finish +endif + +if exists('b:dhall_ftplugin') + finish +endif +let b:dhall_ftplugin = 1 + +setlocal commentstring=--\ %s + +set smarttab + +if exists('g:dhall_use_ctags') + if g:dhall_use_ctags == 1 + augroup dhall + autocmd BufWritePost *.dhall silent !ctags -R . + augroup END + endif +endif + +function! StripTrailingWhitespace() + let myline=line('.') + let mycolumn = col('.') + exec 'silent %s/ *$//' + call cursor(myline, mycolumn) +endfunction + +if exists('g:dhall_strip_whitespace') + if g:dhall_strip_whitespace == 1 + augroup dhall + au BufWritePre *.dhall silent! call StripTrailingWhitespace() + augroup END + endif +endif + +augroup dhall + au BufNewFile,BufRead *.dhall setl shiftwidth=2 +augroup END diff --git a/syntax/dhall.vim b/syntax/dhall.vim new file mode 100644 index 00000000..8c79b9f0 --- /dev/null +++ b/syntax/dhall.vim @@ -0,0 +1,66 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'dhall') != -1 + finish +endif + +scriptencoding utf-8 + +if exists('b:current_syntax') + finish +endif + +syntax match dhallInterpolation "\v\$\{[^\}]*\}" +syntax keyword dhallTodo TODO FIXME +syntax match dhallBrackets "[<>|]" +syntax match dhallOperator "+\|*\|#" +syntax match dhallOperator "//\|⫽" +syntax match dhallOperator "/\\\|∧" +syntax match dhallOperator "//\\\\\|⩓" +syntax match dhallNumber "\v[0-9]" +syntax match dhallNumber "\v\+[0-9]" +syntax match dhallIndex "\v\@[0-9]+" contains=dhallNumber +syntax match dhallLambda "∀\|λ\|→\|->\|\\" +syntax match dhallType "\v[A-Z][a-z0-9A-Z_]*" +syntax match dhallSpecialLabel "\v`[A-Z][a-z]*`" +syntax match dhallLabel "\v[A-Z][a-z]*/[a-z_][A-Za-z0-9\.\-]*" +syntax match dhallLabel "\v[a-z_][A-Za-z0-9\-]*" +syntax match dhallType "\v[a-zA-Z]+\.[A-Z][a-z0-9A-Z_]*" +syntax match dhallParens "(\|)\|\[\|\]\|," +syntax match dhallRecord "{\|}\|:" +syntax keyword dhallKeyword let in forall constructors if then else merge env as +syntax match dhallEsc +\\["\\abfnrtv$/]+ +syntax match dhallSingleSpecial +'''+ +syntax match dhallSingleSpecial +''${+ +syntax match dhallComment '\v--.*$' contains=@Spell,dhallTodo +syntax region dhallMultilineComment start="{-" end="-}" contains=@Spell,dhallTodo,dhallMultilineComment +syntax match dhallUrl "https://[a-zA-Z0-9/.\-_\?\=\&]*" +syntax match dhallUrl "http://[a-zA-Z0-9/.\-_\?\=\&]*" +syntax match dhallUrl "/[a-zA-Z0-9/.\-_]*" +syntax match dhallUrl "\.\./[a-zA-Z0-9/.\-_]*" +syntax match dhallUrl "\./[a-zA-Z0-9/.\-_]*" +syntax region dhallString start=+''+ end=+''+ contains=@Spell,dhallInterpolation,dhallSingleSpecial +syntax region dhallString start=+"+ end=+"+ contains=dhallInterpolation,dhallEsc +syntax region dhallString start=+"/+ end=+"+ contains=dhallInterpolation,dhallEsc +syntax keyword dhallBool True False + +highlight link dhallSingleSpecial Special +highlight link dhallIndex Special +highlight link dhallSpecialLabel Operator +highlight link dhallEsc Special +highlight link dhallInterpolation Special +highlight link dhallTodo Todo +highlight link dhallBrackets Operator +highlight link dhallBool Underlined +highlight link dhallUrl String +highlight link dhallOperator Operator +highlight link dhallNumber Number +highlight link dhallLambda Special +highlight link dhallString String +highlight link dhallLabel Identifier +highlight link dhallRecord Special +highlight link dhallKeyword Keyword +highlight link dhallType Structure +highlight link dhallParens Special +highlight link dhallComment Comment +highlight link dhallMultilineComment Comment + +let b:current_syntax = 'dhall' |