From 3e0c887365bc1ebd55b91dd69ab73f2dee1f00ed Mon Sep 17 00:00:00 2001 From: Dan Reif Date: Mon, 30 Apr 2018 12:00:42 -0700 Subject: Update (periodic rebuild) I originally meant to run this before adding haproxy, but accidentally pushed that into my branch. If you'd like to see that content, it's at https://github.com/CH-DanReif/vim-polyglot/commit/414ad25c3ad1ab9c4b6a99fe4f08d6c30b7e0f57. --- autoload/dart.vim | 10 + autoload/xml/aria.vim | 81 ++- autoload/xml/html5.vim | 14 +- compiler/eruby.vim | 4 +- compiler/rake.vim | 12 +- compiler/rspec.vim | 2 +- compiler/ruby.vim | 8 +- extras/flow.vim | 6 +- ftdetect/polyglot.vim | 795 ++++++++++++----------- ftplugin/ansible.vim | 1 + ftplugin/cabal.vim | 9 - ftplugin/elixir.vim | 6 +- ftplugin/haskell.vim | 20 - ftplugin/nix.vim | 9 +- ftplugin/purescript.vim | 2 +- indent/haskell.vim | 2 +- indent/html.vim | 1445 +++++++++++++++++++++++++++++------------- indent/javascript.vim | 47 +- indent/julia.vim | 15 +- indent/nix.vim | 8 +- indent/swift.vim | 80 ++- syntax/Jenkinsfile.vim | 119 +++- syntax/ansible.vim | 98 +-- syntax/ansible_template.vim | 31 - syntax/blade.vim | 6 +- syntax/carp.vim | 21 +- syntax/coffee.vim | 2 +- syntax/crystal.vim | 8 +- syntax/elixir.vim | 35 +- syntax/gitcommit.vim | 11 +- syntax/gitconfig.vim | 6 +- syntax/go.vim | 147 +---- syntax/godebugoutput.vim | 17 + syntax/godebugstacktrace.vim | 15 + syntax/godebugvariables.vim | 27 + syntax/gohtmltmpl.vim | 2 + syntax/haproxy.vim | 360 +++++++++++ syntax/haskell.vim | 6 +- syntax/html.vim | 1 + syntax/javascript.vim | 8 +- syntax/jinja2.vim | 58 +- syntax/julia.vim | 35 +- syntax/nim.vim | 14 +- syntax/nix.vim | 42 +- syntax/php.vim | 128 ++-- syntax/purescript.vim | 65 +- syntax/ruby.vim | 64 +- syntax/solidity.vim | 4 +- syntax/swift.vim | 7 +- syntax/terraform.vim | 239 +++++++ syntax/typescript.vim | 1 + syntax/vifm.vim | 48 +- syntax/vue.vim | 4 +- 53 files changed, 2776 insertions(+), 1429 deletions(-) delete mode 100644 ftplugin/cabal.vim delete mode 100644 ftplugin/haskell.vim delete mode 100644 syntax/ansible_template.vim create mode 100644 syntax/godebugoutput.vim create mode 100644 syntax/godebugstacktrace.vim create mode 100644 syntax/godebugvariables.vim create mode 100644 syntax/haproxy.vim diff --git a/autoload/dart.vim b/autoload/dart.vim index 2ff55cb6..0e8fb525 100644 --- a/autoload/dart.vim +++ b/autoload/dart.vim @@ -22,6 +22,7 @@ function! dart#fmt(q_args) abort if executable('dartfmt') let buffer_content = join(getline(1, '$'), "\n") let joined_lines = system(printf('dartfmt %s', a:q_args), buffer_content) + if buffer_content ==# joined_lines[:-2] | return | endif if 0 == v:shell_error let win_view = winsaveview() let lines = split(joined_lines, "\n") @@ -129,6 +130,15 @@ function! s:PackageMap() abort return [v:true, map] endfunction +" Toggle whether dartfmt is run on save or not. +function! dart#ToggleFormatOnSave() abort + if get(g:, "dart_format_on_save", 0) + let g:dart_format_on_save = 0 + return + endif + let g:dart_format_on_save = 1 +endfunction + " Finds a file name '.packages' in the cwd, or in any directory above the open " file. " diff --git a/autoload/xml/aria.vim b/autoload/xml/aria.vim index 2a3c88f0..5e642e1d 100644 --- a/autoload/xml/aria.vim +++ b/autoload/xml/aria.vim @@ -94,44 +94,61 @@ let landmark_role = [ \ ] " Ref: https://www.w3.org/TR/dpub-aria-1.0/ -" Version: W3C Candidate Recommendation 15 December 2016 +" Version: W3C Recommendation 14 December 2017 let dpub_role = [ - \ 'dpub-abstract', - \ 'dpub-afterword', - \ 'dpub-appendix', - \ 'dpub-biblioentry', - \ 'dpub-bibliography', - \ 'dpub-biblioref', - \ 'dpub-chapter', - \ 'dpub-cover', - \ 'dpub-epilogue', - \ 'dpub-footnote', - \ 'dpub-footnotes', - \ 'dpub-foreword', - \ 'dpub-glossary', - \ 'dpub-glossdef', - \ 'dpub-glossref', - \ 'dpub-glossterm', - \ 'dpub-index', - \ 'dpub-locator', - \ 'dpub-noteref', - \ 'dpub-notice', - \ 'dpub-pagebreak', - \ 'dpub-pagelist', - \ 'dpub-part', - \ 'dpub-preface', - \ 'dpub-prologue', - \ 'dpub-pullquote', - \ 'dpub-qna', - \ 'dpub-subtitle', - \ 'dpub-tip', - \ 'dpub-title', - \ 'dpub-toc' + \ 'doc-abstract', + \ 'doc-acknowledgments', + \ 'doc-afterword', + \ 'doc-appendix', + \ 'doc-backlink', + \ 'doc-biblioentry', + \ 'doc-bibliography', + \ 'doc-biblioref', + \ 'doc-chapter', + \ 'doc-colophon', + \ 'doc-conclusion', + \ 'doc-cover', + \ 'doc-credit', + \ 'doc-credits', + \ 'doc-dedication', + \ 'doc-endnote', + \ 'doc-endnotes', + \ 'doc-epigraph', + \ 'doc-epilogue', + \ 'doc-errata', + \ 'doc-example', + \ 'doc-footnote', + \ 'doc-foreword', + \ 'doc-glossary', + \ 'doc-glossref', + \ 'doc-index', + \ 'doc-introduction', + \ 'doc-noteref', + \ 'doc-notice', + \ 'doc-pagebreak', + \ 'doc-pagelist', + \ 'doc-part', + \ 'doc-preface', + \ 'doc-prologue', + \ 'doc-pullquote', + \ 'doc-qna', + \ 'doc-subtitle', + \ 'doc-tip', + \ 'doc-toc' +\ ] + +" Ref: https://www.w3.org/TR/graphics-aria-1.0/ +" Version: W3C Candidate Recommendation 29 March 2018 +let graphic_role = [ + \ 'graphics-document', + \ 'graphics-object', + \ 'graphics-symbol' \ ] let role = extend(widget_role, document_structure) let role = extend(role, landmark_role) let role = extend(role, dpub_role) +let role = extend(role, graphic_role) " https://www.w3.org/TR/wai-aria-1.1/#states_and_properties let global_states_and_properties = { diff --git a/autoload/xml/html5.vim b/autoload/xml/html5.vim index 404dd567..5a474ace 100644 --- a/autoload/xml/html5.vim +++ b/autoload/xml/html5.vim @@ -374,6 +374,8 @@ let abutton_dec = 'details\\|embed\\|iframe\\|keygen\\|label\\|menu\\|select\\|t let crossorigin = ['anonymous', 'use-credentials'] +let referrerpolicy = ['no-referrer', 'no-referrer-when-downgrade', 'same-origin', 'origin', 'strict-origin', 'origin-when-cross-origin', 'strict-origin-when-cross-origin', 'unsafe-url'] + let g:xmldata_html5 = { \ 'vimxmlentities': ['AElig', 'Aacute', 'Acirc', 'Agrave', 'Alpha', 'Aring', 'Atilde', 'Auml', 'Beta', 'Ccedil', 'Chi', 'Dagger', 'Delta', 'ETH', 'Eacute', 'Ecirc', 'Egrave', 'Epsilon', 'Eta', 'Euml', 'Gamma', 'Iacute', 'Icirc', 'Igrave', 'Iota', 'Iuml', 'Kappa', 'Lambda', 'Mu', 'Ntilde', 'Nu', 'OElig', 'Oacute', 'Ocirc', 'Ograve', 'Omega', 'Omicron', 'Oslash', 'Otilde', 'Ouml', 'Phi', 'Pi', 'Prime', 'Psi', 'Rho', 'Scaron', 'Sigma', 'THORN', 'Tau', 'Theta', 'Uacute', 'Ucirc', 'Ugrave', 'Upsilon', 'Uuml', 'Xi', 'Yacute', 'Yuml', 'Zeta', 'aacute', 'acirc', 'acute', 'aelig', 'agrave', 'alefsym', 'alpha', 'amp', 'and', 'ang', 'apos', 'aring', 'asymp', 'atilde', 'auml', 'bdquo', 'beta', 'brvbar', 'bull', 'cap', 'ccedil', 'cedil', 'cent', 'chi', 'circ', 'clubs', 'cong', 'copy', 'crarr', 'cup', 'curren', 'dArr', 'dagger', 'darr', 'deg', 'delta', 'diams', 'divide', 'eacute', 'ecirc', 'egrave', 'empty', 'emsp', 'ensp', 'epsilon', 'equiv', 'eta', 'eth', 'euml', 'euro', 'exist', 'fnof', 'forall', 'frac12', 'frac14', 'frac34', 'frasl', 'gamma', 'ge', 'gt', 'hArr', 'harr', 'hearts', 'hellip', 'iacute', 'icirc', 'iexcl', 'igrave', 'image', 'infin', 'int', 'iota', 'iquest', 'isin', 'iuml', 'kappa', 'lArr', 'lambda', 'lang', 'laquo', 'larr', 'lceil', 'ldquo', 'le', 'lfloor', 'lowast', 'loz', 'lrm', 'lsaquo', 'lsquo', 'lt', 'macr', 'mdash', 'micro', 'middot', 'minus', 'mu', 'nabla', 'nbsp', 'ndash', 'ne', 'ni', 'not', 'notin', 'nsub', 'ntilde', 'nu', 'oacute', 'ocirc', 'oelig', 'ograve', 'oline', 'omega', 'omicron', 'oplus', 'or', 'ordf', 'ordm', 'oslash', 'otilde', 'otimes', 'ouml', 'para', 'part', 'permil', 'perp', 'phi', 'pi', 'piv', 'plusmn', 'pound', 'prime', 'prod', 'prop', 'psi', 'quot', 'rArr', 'radic', 'rang', 'raquo', 'rarr', 'rceil', 'rdquo', 'real', 'reg', 'rfloor', 'rho', 'rlm', 'rsaquo', 'rsquo', 'sbquo', 'scaron', 'sdot', 'sect', 'shy', 'sigma', 'sigmaf', 'sim', 'spades', 'sub', 'sube', 'sum', 'sup', 'sup1', 'sup2', 'sup3', 'supe', 'szlig', 'tau', 'there4', 'theta', 'thetasym', 'thinsp', 'thorn', 'tilde', 'times', 'trade', 'uArr', 'uacute', 'uarr', 'ucirc', 'ugrave', 'uml', 'upsih', 'upsilon', 'uuml', 'weierp', 'xi', 'yacute', 'yen', 'yuml', 'zeta', 'zwj', 'zwnj'], @@ -392,7 +394,7 @@ let g:xmldata_html5 = { \ ], \ 'area': [ \ [], - \ extend(copy(global_attributes), {'alt': [], 'href': [], 'target': [], 'rel': linktypes, 'media': [], 'hreflang': lang_tag, 'type': [], 'shape': ['rect', 'circle', 'poly', 'default'], 'coords': [], 'referrerpolicy': ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'unsafe-url']}) + \ extend(copy(global_attributes), {'alt': [], 'href': [], 'target': [], 'rel': linktypes, 'media': [], 'hreflang': lang_tag, 'type': [], 'shape': ['rect', 'circle', 'poly', 'default'], 'coords': [], 'referrerpolicy': referrerpolicy}) \ ], \ 'article': [ \ flow_elements + ['style'], @@ -490,6 +492,10 @@ let g:xmldata_html5 = { \ filter(copy(phrasing_elements), "!(v:val =~ 'dfn')"), \ global_attributes \ ], +\ 'dialog': [ + \ flow_elements, + \ extend(copy(global_attributes), {'open': []}) +\ ], \ 'div': [ \ flow_elements + ['style'], \ global_attributes @@ -580,11 +586,11 @@ let g:xmldata_html5 = { \ ], \ 'iframe': [ \ [], - \ extend(copy(global_attributes), {'src': [], 'srcdoc': [], 'name': [], 'width': [], 'height': [], 'sandbox': ['allow-same-origin', 'allow-forms', 'allow-scripts'], 'seamless': ['seamless', ''], 'referrerpolicy': ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'unsafe-url'], 'allowfullscreen': [], 'allowpaymentrequest': [], 'allowpresentation': [], 'allowusermedia': []}) + \ extend(copy(global_attributes), {'src': [], 'srcdoc': [], 'name': [], 'width': [], 'height': [], 'sandbox': ['allow-same-origin', 'allow-forms', 'allow-scripts'], 'seamless': ['seamless', ''], 'referrerpolicy': referrerpolicy, 'allowfullscreen': [], 'allowpaymentrequest': [], 'allowpresentation': [], 'allowusermedia': []}) \ ], \ 'img': [ \ [], - \ extend(copy(global_attributes), {'src': [], 'alt': [], 'height': [], 'width': [], 'decoding': ['async', 'sync', 'auto'], 'usemap': [], 'ismap': ['ismap', ''], 'referrerpolicy': ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'unsafe-url'], 'crossorigin': ['anonymous', 'use-credentials']}) + \ extend(copy(global_attributes), {'src': [], 'alt': [], 'height': [], 'width': [], 'decoding': ['async', 'sync', 'auto'], 'usemap': [], 'ismap': ['ismap', ''], 'referrerpolicy': referrerpolicy, 'crossorigin': ['anonymous', 'use-credentials']}) \ ], \ 'input': [ \ [], @@ -616,7 +622,7 @@ let g:xmldata_html5 = { \ ], \ 'link': [ \ [], - \ extend(copy(global_attributes), {'href': [], 'rel': linkreltypes, 'hreflang': lang_tag, 'media': [], 'type': [], 'sizes': ['any'], 'referrerpolicy': ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'unsafe-url'], 'crossorigin': crossorigin, 'preload': ['preload', ''], 'prefetch': ['prefetch', ''], 'as': ['report', 'document', 'document', 'object', 'embed', 'audio', 'font', 'image', 'audioworklet', 'paintworklet', 'script', 'serviceworker', 'sharedworker', 'worker', 'style', 'track', 'video', 'image', 'manifest', 'xslt', 'fetch', '']}) + \ extend(copy(global_attributes), {'href': [], 'rel': linkreltypes, 'hreflang': lang_tag, 'media': [], 'type': [], 'sizes': ['any'], 'referrerpolicy': referrerpolicy, 'crossorigin': crossorigin, 'preload': ['preload', ''], 'prefetch': ['prefetch', ''], 'as': ['report', 'document', 'document', 'object', 'embed', 'audio', 'font', 'image', 'audioworklet', 'paintworklet', 'script', 'serviceworker', 'sharedworker', 'worker', 'style', 'track', 'video', 'image', 'manifest', 'xslt', 'fetch', '']}) \ ], \ 'main': [ \ flow_elements + ['style'], diff --git a/compiler/eruby.vim b/compiler/eruby.vim index fd9a8e59..b3c102ec 100644 --- a/compiler/eruby.vim +++ b/compiler/eruby.vim @@ -30,8 +30,8 @@ CompilerSet errorformat= \%W%f:%l:\ warning:\ %m, \%E%f:%l:in\ %*[^:]:\ %m, \%E%f:%l:\ %m, - \%-C%\tfrom\ %f:%l:in\ %.%#, - \%-Z%\tfrom\ %f:%l, + \%-C%\t%\\d%#:%#\ %#from\ %f:%l:in\ %.%#, + \%-Z%\t%\\d%#:%#\ %#from\ %f:%l, \%-Z%p^, \%-G%.%# diff --git a/compiler/rake.vim b/compiler/rake.vim index e304f8fa..fba50815 100644 --- a/compiler/rake.vim +++ b/compiler/rake.vim @@ -22,12 +22,12 @@ CompilerSet makeprg=rake CompilerSet errorformat= \%D(in\ %f), - \%\\s%#from\ %f:%l:%m, - \%\\s%#from\ %f:%l:, - \%\\s%##\ %f:%l:%m%\\&%.%#%\\D:%\\d%#:%.%#, - \%\\s%##\ %f:%l%\\&%.%#%\\D:%\\d%#, - \%\\s%#[%f:%l:\ %#%m%\\&%.%#%\\D:%\\d%#:%.%#, - \%\\s%#%f:%l:\ %#%m%\\&%.%#%\\D:%\\d%#:%.%#, + \%\\s%#%\\d%#:%#\ %#from\ %f:%l:%m, + \%\\s%#%\\d%#:%#\ %#from\ %f:%l:, + \%\\s%##\ %f:%l:%m%\\&%.%#%\\D:%\\d%\\+:%.%#, + \%\\s%##\ %f:%l%\\&%.%#%\\D:%\\d%\\+, + \%\\s%#[%f:%l:\ %#%m%\\&%.%#%\\D:%\\d%\\+:%.%#, + \%\\s%#%f:%l:\ %#%m%\\&%.%#%\\D:%\\d%\\+:%.%#, \%\\s%#%f:%l:, \%m\ [%f:%l]:, \%+Erake\ aborted!, diff --git a/compiler/rspec.vim b/compiler/rspec.vim index 8c5a5fe3..b990bd48 100644 --- a/compiler/rspec.vim +++ b/compiler/rspec.vim @@ -25,7 +25,7 @@ CompilerSet errorformat= \%E%.%#:in\ `load':\ %f:%l:%m, \%E%f:%l:in\ `%*[^']':\ %m, \%-Z\ \ \ \ \ %\\+\#\ %f:%l:%.%#, - \%E\ \ %\\d%\\+)%.%#, + \%E\ \ \ \ \ Failure/Error:\ %m, \%C\ \ \ \ \ %m, \%C%\\s%#, \%-G%.%# diff --git a/compiler/ruby.vim b/compiler/ruby.vim index 81721285..453b398b 100644 --- a/compiler/ruby.vim +++ b/compiler/ruby.vim @@ -23,21 +23,21 @@ set cpo-=C " default settings runs script normally " add '-c' switch to run syntax check only: " -" CompilerSet makeprg=ruby\ -wc\ $* +" CompilerSet makeprg=ruby\ -c " " or add '-c' at :make command line: " " :make -c % " -CompilerSet makeprg=ruby\ -w\ $* +CompilerSet makeprg=ruby CompilerSet errorformat= \%+E%f:%l:\ parse\ error, \%W%f:%l:\ warning:\ %m, \%E%f:%l:in\ %*[^:]:\ %m, \%E%f:%l:\ %m, - \%-C%\tfrom\ %f:%l:in\ %.%#, - \%-Z%\tfrom\ %f:%l, + \%-C%\t%\\d%#:%#\ %#from\ %f:%l:in\ %.%#, + \%-Z%\t%\\d%#:%#\ %#from\ %f:%l, \%-Z%p^, \%-G%.%# diff --git a/extras/flow.vim b/extras/flow.vim index bbb84496..d029db88 100644 --- a/extras/flow.vim +++ b/extras/flow.vim @@ -29,8 +29,9 @@ syntax region jsFlowReturnGroup contained matchgroup=jsFlowNoise start=// contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncArgs -syntax region jsFlowClassGroup contained matchgroup=jsFlowNoise start=// contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassBlock +syntax region jsFlowFunctionGroup contained matchgroup=jsFlowNoise start=// contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncArgs +syntax region jsFlowClassGroup contained matchgroup=jsFlowNoise start=// contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassBlock +syntax region jsFlowClassFunctionGroup contained matchgroup=jsFlowNoise start=// contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncArgs syntax region jsFlowTypeStatement start=/type\%(\s\+\k\)\@=/ end=/=\@=/ contains=jsFlowTypeOperator oneline skipwhite skipempty nextgroup=jsFlowTypeValue keepend syntax region jsFlowTypeValue contained matchgroup=jsFlowNoise start=/=/ end=/[\n;]/ contains=@jsFlowCluster,jsFlowGroup,jsFlowMaybe @@ -83,6 +84,7 @@ if version >= 508 || !exists("did_javascript_syn_inits") HiLink jsFlowReturnGroup jsFlowGroup HiLink jsFlowFunctionGroup PreProc HiLink jsFlowClassGroup PreProc + HiLink jsFlowClassFunctionGroup PreProc HiLink jsFlowArrowArguments PreProc HiLink jsFlowArrow PreProc HiLink jsFlowReturnArrow PreProc diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 6bf83344..f7286b68 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -69,29 +69,26 @@ augroup filetypedetect autocmd BufNewFile,BufRead *.swift set filetype=swift augroup END -augroup filetypedetect -" apiblueprint:sheerun/apiblueprint.vim +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'apiblueprint') == -1 + augroup filetypedetect + " apiblueprint, from apiblueprint.vim in sheerun/apiblueprint.vim autocmd BufReadPost,BufNewFile *.apib set filetype=apiblueprint autocmd FileType apiblueprint set syntax=apiblueprint autocmd FileType apiblueprint set makeprg=drafter\ -l\ % -augroup END - -augroup filetypedetect -" applescript:vim-scripts/applescript.vim -augroup END + augroup end +endif -augroup filetypedetect -" asciidoc:asciidoc/vim-asciidoc +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'asciidoc') == -1 + augroup filetypedetect + " asciidoc, from asciidoc.vim in asciidoc/vim-asciidoc autocmd BufNewFile,BufRead *.asciidoc,*.adoc \ set ft=asciidoc -augroup END - -augroup filetypedetect -" yaml:stephpy/vim-yaml -augroup END + augroup end +endif -augroup filetypedetect -" ansible:pearofducks/ansible-vim +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ansible') == -1 + augroup filetypedetect + " ansible, from ansible.vim in pearofducks/ansible-vim function! s:isAnsible() let filepath = expand("%:p") let filename = expand("%:t") @@ -106,62 +103,74 @@ function! s:isAnsible() return 0 endfunction -:au BufNewFile,BufRead * if s:isAnsible() | set ft=ansible | en -:au BufNewFile,BufRead *.j2 set ft=ansible_template -:au BufNewFile,BufRead hosts set ft=ansible_hosts -augroup END +function! s:setupTemplate() + if exists("g:ansible_template_syntaxes") + let filepath = expand("%:p") + for syntax_name in items(g:ansible_template_syntaxes) + let s:syntax_string = '\v/'.syntax_name[0] + if filepath =~ s:syntax_string + execute 'set ft='.syntax_name[1].'.jinja2' + return + endif + endfor + endif + set ft=jinja2 +endfunction -augroup filetypedetect -" arduino:sudar/vim-arduino-syntax -au BufRead,BufNewFile *.ino,*.pde set filetype=arduino -augroup END +au BufNewFile,BufRead * if s:isAnsible() | set ft=yaml.ansible | en +au BufNewFile,BufRead *.j2 call s:setupTemplate() +au BufNewFile,BufRead hosts set ft=ansible_hosts + augroup end +endif -augroup filetypedetect -" autohotkey:hnamikaw/vim-autohotkey -augroup END +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'arduino') == -1 + augroup filetypedetect + " arduino, from arduino.vim in sudar/vim-arduino-syntax +au BufRead,BufNewFile *.ino,*.pde set filetype=arduino + augroup end +endif -augroup filetypedetect -" blade:jwalton512/vim-blade +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'blade') == -1 + augroup filetypedetect + " blade, from blade.vim in jwalton512/vim-blade autocmd BufNewFile,BufRead *.blade.php set filetype=blade -augroup END - -augroup filetypedetect -" c++11:octol/vim-cpp-enhanced-highlight -augroup END - -augroup filetypedetect -" c/c++:vim-jp/vim-cpp -augroup END + augroup end +endif -augroup filetypedetect -" caddyfile:isobit/vim-caddyfile +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'caddyfile') == -1 + augroup filetypedetect + " caddyfile, from caddyfile.vim in isobit/vim-caddyfile au BufNewFile,BufRead Caddyfile set ft=caddyfile -augroup END + augroup end +endif -augroup filetypedetect -" carp:hellerve/carp-vim +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'carp') == -1 + augroup filetypedetect + " carp, from carp.vim in hellerve/carp-vim au BufRead,BufNewFile *.carp set filetype=carp -augroup END + augroup end +endif -augroup filetypedetect -" cjsx:mtscout6/vim-cjsx +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cjsx') == -1 + augroup filetypedetect + " cjsx, from cjsx.vim in mtscout6/vim-cjsx augroup CJSX au! autocmd BufNewFile,BufRead *.csx,*.cjsx set filetype=coffee augroup END -augroup END + augroup end +endif -augroup filetypedetect -" clojure:guns/vim-clojure-static +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'clojure') == -1 + augroup filetypedetect + " clojure, from clojure.vim in guns/vim-clojure-static autocmd BufNewFile,BufRead *.clj,*.cljs,*.edn,*.cljx,*.cljc,{build,profile}.boot setlocal filetype=clojure -augroup END - -augroup filetypedetect -" cmake:pboettch/vim-cmake-syntax -augroup END + augroup end +endif -augroup filetypedetect -" cryptol:victoredwardocallaghan/cryptol.vim +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cryptol') == -1 + augroup filetypedetect + " cryptol, from cryptol.vim in victoredwardocallaghan/cryptol.vim " Copyright © 2013 Edward O'Callaghan. All Rights Reserved. " Normal Cryptol Program; au! BufRead,BufNewFile *.cry set filetype=cryptol @@ -170,46 +179,54 @@ au! BufRead,BufNewFile *.cyl set filetype=cryptol au! BufRead,BufNewFile *.lcry set filetype=cryptol au! BufRead,BufNewFile *.lcyl set filetype=cryptol " Also in LaTeX *.tex which is outside our coverage scope. -augroup END + augroup end +endif -augroup filetypedetect -" crystal:rhysd/vim-crystal +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1 + augroup filetypedetect + " crystal, from crystal.vim in rhysd/vim-crystal autocmd BufNewFile,BufReadPost *.cr setlocal filetype=crystal autocmd BufNewFile,BufReadPost Projectfile setlocal filetype=crystal autocmd BufNewFile,BufReadPost *.ecr setlocal filetype=eruby -augroup END + augroup end +endif -augroup filetypedetect -" cql:elubow/cql-vim +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cql') == -1 + augroup filetypedetect + " cql, from cql.vim in elubow/cql-vim if has("autocmd") au BufNewFile,BufRead *.cql set filetype=cql endif -augroup END + augroup end +endif -augroup filetypedetect -" cucumber:tpope/vim-cucumber +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cucumber') == -1 + augroup filetypedetect + " cucumber, from cucumber.vim in tpope/vim-cucumber " Cucumber autocmd BufNewFile,BufReadPost *.feature,*.story set filetype=cucumber -augroup END + augroup end +endif -augroup filetypedetect -" dart:dart-lang/dart-vim-plugin +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dart') == -1 + augroup filetypedetect + " dart, from dart.vim in dart-lang/dart-vim-plugin autocmd BufRead,BufNewFile *.dart set filetype=dart -augroup END - -augroup filetypedetect -" dockerfile:docker/docker::/contrib/syntax/vim/ -augroup END + augroup end +endif -augroup filetypedetect -" elm:ElmCast/elm-vim +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elm') == -1 + augroup filetypedetect + " elm, from elm.vim in ElmCast/elm-vim " detection for Elm (http://elm-lang.org/) au BufRead,BufNewFile *.elm set filetype=elm -augroup END + augroup end +endif -augroup filetypedetect -" emberscript:yalesov/vim-ember-script +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'emberscript') == -1 + augroup filetypedetect + " emberscript, from ember-script.vim in yalesov/vim-ember-script " Language: ember-script " Maintainer: Yulij Andreevich Lesov > " URL: http://github.com/yalesov/vim-ember-script @@ -223,10 +240,12 @@ endif autocmd BufNewFile,BufRead *.em set filetype=ember-script autocmd FileType ember-script set tabstop=2|set shiftwidth=2|set expandtab -augroup END + augroup end +endif -augroup filetypedetect -" emblem:yalesov/vim-emblem +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'emblem') == -1 + augroup filetypedetect + " emblem, from emblem.vim in yalesov/vim-emblem " Language: emblem " Maintainer: Yulij Andreevich Lesov " URL: http://github.com/yalesov/vim-emblem @@ -244,26 +263,34 @@ else autocmd BufNewFile,BufRead *.em,*.emblem set filetype=emblem endif autocmd FileType emblem set tabstop=2|set shiftwidth=2|set expandtab -augroup END + augroup end +endif -augroup filetypedetect -" erlang:vim-erlang/vim-erlang-runtime +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'erlang') == -1 + augroup filetypedetect + " erlang, from erlang.vim in vim-erlang/vim-erlang-runtime au BufNewFile,BufRead *.erl,*.hrl,rebar.config,*.app,*.app.src,*.yaws,*.xrl,*.escript set ft=erlang -augroup END + augroup end +endif -augroup filetypedetect -" fsharp:fsharp/vim-fsharp:_BASIC +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'fsharp') == -1 + augroup filetypedetect + " fsharp, from fsharp.vim in fsharp/vim-fsharp:_BASIC " F#, fsharp autocmd BufNewFile,BufRead *.fs,*.fsi,*.fsx set filetype=fsharp -augroup END + augroup end +endif -augroup filetypedetect -" gmpl:maelvalais/gmpl.vim +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'gmpl') == -1 + augroup filetypedetect + " gmpl, from gmpl.vim in maelvalais/gmpl.vim au BufRead,BufNewFile *.mod set filetype=gmpl -augroup END + augroup end +endif -augroup filetypedetect -" glsl:tikhomirov/vim-glsl +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'glsl') == -1 + augroup filetypedetect + " glsl, from glsl.vim in tikhomirov/vim-glsl " Language: OpenGL Shading Language " Maintainer: Sergey Tikhomirov @@ -272,14 +299,12 @@ augroup filetypedetect autocmd! BufNewFile,BufRead *.vert,*.tesc,*.tese,*.glsl,*.geom,*.frag,*.comp set filetype=glsl " vim:set sts=2 sw=2 : -augroup END - -augroup filetypedetect -" gnuplot:vim-scripts/gnuplot-syntax-highlighting -augroup END + augroup end +endif -augroup filetypedetect -" go:fatih/vim-go:_BASIC +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1 + augroup filetypedetect + " go, from gofiletype.vim in fatih/vim-go:_BASIC " vint: -ProhibitAutocmdWithNoGroup " We take care to preserve the user's fileencodings and fileformats, @@ -314,57 +339,70 @@ au BufReadPost *.s call s:gofiletype_post() au BufRead,BufNewFile *.tmpl set filetype=gohtmltmpl " vim: sw=2 ts=2 et -augroup END - -augroup filetypedetect -" groovy:vim-scripts/groovy.vim -augroup END + augroup end +endif -augroup filetypedetect -" haml:sheerun/vim-haml +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haml') == -1 + augroup filetypedetect + " haml, from haml.vim in sheerun/vim-haml autocmd BufNewFile,BufRead *.sass setf sass autocmd BufNewFile,BufRead *.scss setf scss -augroup END + augroup end +endif -augroup filetypedetect -" handlebars:mustache/vim-mustache-handlebars +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'handlebars') == -1 + augroup filetypedetect + " handlebars, from mustache.vim in mustache/vim-mustache-handlebars if has("autocmd") au BufNewFile,BufRead *.mustache,*.hogan,*.hulk,*.hjs set filetype=html.mustache syntax=mustache | runtime! ftplugin/mustache.vim ftplugin/mustache*.vim ftplugin/mustache/*.vim au BufNewFile,BufRead *.handlebars,*.hbs set filetype=html.handlebars syntax=mustache | runtime! ftplugin/mustache.vim ftplugin/mustache*.vim ftplugin/mustache/*.vim endif -augroup END + augroup end +endif -augroup filetypedetect -" haskell:neovimhaskell/haskell-vim +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haproxy') == -1 + augroup filetypedetect + " haproxy, from haproxy.vim in CH-DanReif/haproxy.vim +au BufRead,BufNewFile haproxy*.c* set ft=haproxy + augroup end +endif + +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haskell') == -1 + augroup filetypedetect + " haskell, from haskell.vim in neovimhaskell/haskell-vim au BufRead,BufNewFile *.hsc set filetype=haskell au BufRead,BufNewFile *.bpk set filetype=haskell au BufRead,BufNewFile *.hsig set filetype=haskell -augroup END + augroup end +endif -augroup filetypedetect -" haxe:yaymukund/vim-haxe +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haxe') == -1 + augroup filetypedetect + " haxe, from haxe.vim in yaymukund/vim-haxe autocmd BufNewFile,BufRead *.hx setf haxe -augroup END - -augroup filetypedetect -" html5:othree/html5.vim -augroup END + augroup end +endif -augroup filetypedetect -" i3:PotatoesMaster/i3-vim-syntax +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'i3') == -1 + augroup filetypedetect + " i3, from i3.vim in PotatoesMaster/i3-vim-syntax augroup i3_ftdetect au! au BufRead,BufNewFile *i3/config,*sway/config set ft=i3 augroup END -augroup END + augroup end +endif -augroup filetypedetect -" jasmine:glanotte/vim-jasmine +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jasmine') == -1 + augroup filetypedetect + " jasmine, from jasmine.vim in glanotte/vim-jasmine autocmd BufNewFile,BufRead *Spec.js,*_spec.js set filetype=jasmine.javascript syntax=jasmine -augroup END + augroup end +endif -augroup filetypedetect -" javascript:pangloss/vim-javascript:_JAVASCRIPT +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1 + augroup filetypedetect + " javascript, from javascript.vim in pangloss/vim-javascript:_JAVASCRIPT au BufNewFile,BufRead *.{js,mjs,jsm,es,es6},Jakefile setf javascript fun! s:SourceFlowSyntax() @@ -382,42 +420,52 @@ fun! s:SelectJavascript() endif endfun au BufNewFile,BufRead * call s:SelectJavascript() -augroup END + augroup end +endif -augroup filetypedetect -" jenkins:martinda/Jenkinsfile-vim-syntax +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jenkins') == -1 + augroup filetypedetect + " jenkins, from Jenkinsfile.vim in martinda/Jenkinsfile-vim-syntax " Jenkinsfile autocmd BufRead,BufNewFile Jenkinsfile set ft=Jenkinsfile autocmd BufRead,BufNewFile Jenkinsfile* setf Jenkinsfile autocmd BufRead,BufNewFile *.jenkinsfile set ft=Jenkinsfile autocmd BufRead,BufNewFile *.jenkinsfile setf Jenkinsfile -augroup END + augroup end +endif -augroup filetypedetect -" json:elzr/vim-json +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'json') == -1 + augroup filetypedetect + " json, from json.vim in elzr/vim-json autocmd BufNewFile,BufRead *.json setlocal filetype=json autocmd BufNewFile,BufRead *.jsonl setlocal filetype=json autocmd BufNewFile,BufRead *.jsonp setlocal filetype=json autocmd BufNewFile,BufRead *.geojson setlocal filetype=json autocmd BufNewFile,BufRead *.template setlocal filetype=json -augroup END + augroup end +endif -augroup filetypedetect -" json5:GutenYe/json5.vim +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'json5') == -1 + augroup filetypedetect + " json5, from json5.vim in GutenYe/json5.vim au BufNewFile,BufRead *.json5 setfiletype json5 -augroup END + augroup end +endif -augroup filetypedetect -" jst:briancollins/vim-jst +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jst') == -1 + augroup filetypedetect + " jst, from jst.vim in briancollins/vim-jst au BufNewFile,BufRead *.ejs set filetype=jst au BufNewFile,BufRead *.jst set filetype=jst au BufNewFile,BufRead *.djs set filetype=jst au BufNewFile,BufRead *.hamljs set filetype=jst au BufNewFile,BufRead *.ect set filetype=jst -augroup END + augroup end +endif -augroup filetypedetect -" jsx:mxw/vim-jsx:_ALL +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsx') == -1 + augroup filetypedetect + " jsx, from javascript.vim in mxw/vim-jsx:_ALL """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Vim ftdetect file " @@ -428,7 +476,7 @@ augroup filetypedetect " Whether the .jsx extension is required. if !exists('g:jsx_ext_required') - let g:jsx_ext_required = 1 + let g:jsx_ext_required = 0 endif " Whether the @jsx pragma is required. @@ -455,25 +503,27 @@ autocmd BufNewFile,BufRead *.jsx let b:jsx_ext_found = 1 autocmd BufNewFile,BufRead *.jsx set filetype=javascript.jsx autocmd BufNewFile,BufRead *.js \ if EnableJSX() | set filetype=javascript.jsx | endif -augroup END + augroup end +endif -augroup filetypedetect -" kotlin:udalov/kotlin-vim +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'kotlin') == -1 + augroup filetypedetect + " kotlin, from kotlin.vim in udalov/kotlin-vim autocmd BufNewFile,BufRead *.kt setfiletype kotlin autocmd BufNewFile,BufRead *.kts setfiletype kotlin -augroup END - -augroup filetypedetect -" latex:LaTeX-Box-Team/LaTeX-Box -augroup END + augroup end +endif -augroup filetypedetect -" less:groenewege/vim-less +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'less') == -1 + augroup filetypedetect + " less, from less.vim in groenewege/vim-less autocmd BufNewFile,BufRead *.less setf less -augroup END + augroup end +endif -augroup filetypedetect -" liquid:tpope/vim-liquid +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'liquid') == -1 + augroup filetypedetect + " liquid, from liquid.vim in tpope/vim-liquid " Liquid au BufNewFile,BufRead *.liquid set ft=liquid @@ -490,10 +540,12 @@ au BufNewFile,BufRead *.markdown,*.mkd,*.mkdn,*.md au BufNewFile,BufRead */templates/**.liquid,*/layout/**.liquid,*/snippets/**.liquid \ let b:liquid_subtype = 'html' | \ set ft=liquid | -augroup END + augroup end +endif -augroup filetypedetect -" livescript:gkz/vim-ls +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'livescript') == -1 + augroup filetypedetect + " livescript, from ls.vim in gkz/vim-ls " Language: LiveScript " Maintainer: George Zahariev " URL: http://github.com/gkz/vim-ls @@ -501,14 +553,12 @@ augroup filetypedetect " autocmd BufNewFile,BufRead *.ls set filetype=ls autocmd BufNewFile,BufRead *Slakefile set filetype=ls -augroup END - -augroup filetypedetect -" lua:tbastos/vim-lua -augroup END + augroup end +endif -augroup filetypedetect -" mako:sophacles/vim-bundle-mako +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mako') == -1 + augroup filetypedetect + " mako, from mako.vim in sophacles/vim-bundle-mako if !exists("g:mako_detect_lang_from_ext") let g:mako_detect_lang_from_ext = 1 endif @@ -520,73 +570,69 @@ if g:mako_detect_lang_from_ext au BufReadPre *.*.mako execute "do BufRead filetypedetect " . expand(":r") | let b:mako_outer_lang = &filetype endif au BufRead,BufNewFile *.mako set filetype=mako -augroup END + augroup end +endif -augroup filetypedetect -" markdown:plasticboy/vim-markdown:_SYNTAX +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'markdown') == -1 + augroup filetypedetect + " markdown, from markdown.vim in plasticboy/vim-markdown:_SYNTAX " markdown filetype file au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn} set filetype=markdown au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn}.{des3,des,bf,bfa,aes,idea,cast,rc2,rc4,rc5,desx} set filetype=markdown -augroup END - -augroup filetypedetect -" mathematica:rsmenon/vim-mathematica -augroup END + augroup end +endif -augroup filetypedetect -" nginx:chr4/nginx.vim +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1 + augroup filetypedetect + " nginx, from nginx.vim in chr4/nginx.vim au BufRead,BufNewFile *.nginx set ft=nginx au BufRead,BufNewFile nginx*.conf set ft=nginx au BufRead,BufNewFile *nginx.conf set ft=nginx au BufRead,BufNewFile */etc/nginx/* set ft=nginx au BufRead,BufNewFile */usr/local/nginx/conf/* set ft=nginx -augroup END + augroup end +endif -augroup filetypedetect -" nim:zah/nim.vim:_BASIC +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nim') == -1 + augroup filetypedetect + " nim, from nim.vim in zah/nim.vim:_BASIC au BufNewFile,BufRead *.nim,*.nims set filetype=nim + augroup end +endif -augroup END - -augroup filetypedetect -" nix:LnL7/vim-nix +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nix') == -1 + augroup filetypedetect + " nix, from nix.vim in LnL7/vim-nix " Vim filetype detect " Language: Nix " Maintainer: Daiderd Jordan " URL: https://github.com/LnL7/vim-nix au BufRead,BufNewFile *.nix set filetype=nix -au FileType nix setl sw=2 sts=2 et iskeyword+=- -augroup END - -augroup filetypedetect -" objc:b4winckler/vim-objc -augroup END - -augroup filetypedetect -" ocaml:jrk/vim-ocaml -augroup END - -augroup filetypedetect -" octave:vim-scripts/octave.vim-- -augroup END + augroup end +endif -augroup filetypedetect -" opencl:petRUShka/vim-opencl +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'opencl') == -1 + augroup filetypedetect + " opencl, from opencl.vim in petRUShka/vim-opencl au! BufRead,BufNewFile *.cl set filetype=opencl -augroup END + augroup end +endif -augroup filetypedetect -" perl:vim-perl/vim-perl +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'perl') == -1 + augroup filetypedetect + " perl, from mason-in-html.vim in vim-perl/vim-perl " Highlight .html files as Mason if they start with Mason tags autocmd BufRead *.html \ if getline(1) =~ '^\(%\|<[%&].*>\)' | \ set filetype=mason | \ endif -augroup END + augroup end +endif -augroup filetypedetect -" perl:vim-perl/vim-perl +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'perl') == -1 + augroup filetypedetect + " perl, from perl11.vim in vim-perl/vim-perl function! s:DetectPerl6() let line_no = 1 let eof = line('$') @@ -621,20 +667,20 @@ endfunction autocmd BufReadPost *.pl,*.pm,*.t call s:DetectPerl6() autocmd BufNew,BufNewFile,BufRead *.nqp setf perl6 -augroup END + augroup end +endif -augroup filetypedetect -" pgsql:exu/pgsql.vim +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'pgsql') == -1 + augroup filetypedetect + " pgsql, from pgsql.vim in exu/pgsql.vim " postgreSQL au BufNewFile,BufRead *.pgsql setf pgsql -augroup END - -augroup filetypedetect -" php:StanAngeloff/php.vim -augroup END + augroup end +endif -augroup filetypedetect -" powershell:PProvost/vim-ps1 +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'powershell') == -1 + augroup filetypedetect + " powershell, from ps1.vim in PProvost/vim-ps1 " Vim ftdetect plugin file " Language: Windows PowerShell " Maintainer: Peter Provost @@ -646,10 +692,12 @@ au BufNewFile,BufRead *.ps1 set ft=ps1 au BufNewFile,BufRead *.psd1 set ft=ps1 au BufNewFile,BufRead *.psm1 set ft=ps1 au BufNewFile,BufRead *.pssc set ft=ps1 -augroup END + augroup end +endif -augroup filetypedetect -" powershell:PProvost/vim-ps1 +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'powershell') == -1 + augroup filetypedetect + " powershell, from ps1xml.vim in PProvost/vim-ps1 " Vim ftdetect plugin file " Language: Windows PowerShell " Maintainer: Peter Provost @@ -658,10 +706,12 @@ augroup filetypedetect " Vim Script Page: http://www.vim.org/scripts/script.php?script_id=1327 au BufNewFile,BufRead *.ps1xml set ft=ps1xml -augroup END + augroup end +endif -augroup filetypedetect -" powershell:PProvost/vim-ps1 +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'powershell') == -1 + augroup filetypedetect + " powershell, from xml.vim in PProvost/vim-ps1 " Vim ftdetect plugin file " Language: Windows PowerShell " Maintainer: Peter Provost @@ -671,81 +721,79 @@ augroup filetypedetect au BufNewFile,BufRead *.cdxml set ft=xml au BufNewFile,BufRead *.psc1 set ft=xml -augroup END + augroup end +endif -augroup filetypedetect -" protobuf:uarun/vim-protobuf +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'protobuf') == -1 + augroup filetypedetect + " protobuf, from proto.vim in uarun/vim-protobuf autocmd BufNewFile,BufRead *.proto setfiletype proto -augroup END + augroup end +endif -augroup filetypedetect -" pug:digitaltoad/vim-pug +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'pug') == -1 + augroup filetypedetect + " pug, from pug.vim in digitaltoad/vim-pug " Pug autocmd BufNewFile,BufReadPost *.pug set filetype=pug " Jade autocmd BufNewFile,BufReadPost *.jade set filetype=pug -augroup END + augroup end +endif -augroup filetypedetect -" puppet:voxpupuli/vim-puppet +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'puppet') == -1 + augroup filetypedetect + " puppet, from puppet.vim in voxpupuli/vim-puppet au! BufRead,BufNewFile *.pp setfiletype puppet au! BufRead,BufNewFile Puppetfile setfiletype ruby -augroup END + augroup end +endif -augroup filetypedetect -" purescript:purescript-contrib/purescript-vim +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'purescript') == -1 + augroup filetypedetect + " purescript, from purescript.vim in purescript-contrib/purescript-vim au BufNewFile,BufRead *.purs setf purescript au FileType purescript let &l:commentstring='{--%s--}' -augroup END - -augroup filetypedetect -" python:vim-python/python-syntax -augroup END + augroup end +endif -augroup filetypedetect -" python-compiler:aliev/vim-compiler-python +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'python-compiler') == -1 + augroup filetypedetect + " python-compiler, from python.vim in aliev/vim-compiler-python " Vim compiler file " Compiler: Unit testing tool for Python " Maintainer: Ali Aliev " Last Change: 2015 Nov 2 autocmd FileType python compiler python -augroup END - -augroup filetypedetect -" python-ident:Vimjas/vim-python-pep8-indent -augroup END + augroup end +endif -augroup filetypedetect -" qml:peterhoeg/vim-qml +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'qml') == -1 + augroup filetypedetect + " qml, from qml.vim in peterhoeg/vim-qml autocmd BufRead,BufNewFile *.qml setfiletype qml -augroup END - -augroup filetypedetect -" r-lang:vim-scripts/R.vim -augroup END + augroup end +endif -augroup filetypedetect -" racket:wlangstroth/vim-racket +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'racket') == -1 + augroup filetypedetect + " racket, from racket.vim in wlangstroth/vim-racket au BufRead,BufNewFile *.rkt,*.rktl set filetype=racket -augroup END + augroup end +endif -augroup filetypedetect -" raml:IN3D/vim-raml +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'raml') == -1 + augroup filetypedetect + " raml, from raml.vim in IN3D/vim-raml au BufRead,BufNewFile *.raml set ft=raml -augroup END - -augroup filetypedetect -" ragel:jneen/ragel.vim -augroup END - -augroup filetypedetect -" rspec:sheerun/rspec.vim -augroup END + augroup end +endif -augroup filetypedetect -" ruby:vim-ruby/vim-ruby +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ruby') == -1 + augroup filetypedetect + " ruby, from ruby.vim in vim-ruby/vim-ruby " Officially distributed filetypes " Support functions {{{ @@ -788,10 +836,12 @@ au BufNewFile,BufRead [rR]akefile* call s:StarSetf('ruby') au BufNewFile,BufRead [rR]antfile,*.rant call s:setf('ruby') " vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker: -augroup END + augroup end +endif -augroup filetypedetect -" ruby:vim-ruby/vim-ruby +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ruby') == -1 + augroup filetypedetect + " ruby, from ruby_extra.vim in vim-ruby/vim-ruby " All other filetypes " Support functions {{{ @@ -855,62 +905,80 @@ au BufNewFile,BufRead [tT]horfile,*.thor call s:setf('ruby') au BufNewFile,BufRead [vV]agrantfile call s:setf('ruby') " vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker: -augroup END + augroup end +endif -augroup filetypedetect -" rust:rust-lang/rust.vim +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1 + augroup filetypedetect + " rust, from rust.vim in rust-lang/rust.vim au BufRead,BufNewFile *.rs set filetype=rust -augroup END + augroup end +endif -augroup filetypedetect -" sbt:derekwyatt/vim-sbt +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'sbt') == -1 + augroup filetypedetect + " sbt, from sbt.vim in derekwyatt/vim-sbt " Vim detect file " Language: sbt " Maintainer: Derek Wyatt " Last Change: 2012 Jan 19 au BufRead,BufNewFile *.sbt set filetype=sbt.scala -augroup END + augroup end +endif -augroup filetypedetect -" scss:cakebaker/scss-syntax.vim +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'scss') == -1 + augroup filetypedetect + " scss, from scss.vim in cakebaker/scss-syntax.vim au BufRead,BufNewFile *.scss setfiletype scss au BufEnter *.scss :syntax sync fromstart -augroup END + augroup end +endif -augroup filetypedetect -" slim:slim-template/vim-slim +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'slim') == -1 + augroup filetypedetect + " slim, from slim.vim in slim-template/vim-slim autocmd BufNewFile,BufRead *.slim setfiletype slim -augroup END + augroup end +endif -augroup filetypedetect -" slime:slime-lang/vim-slime-syntax +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'slime') == -1 + augroup filetypedetect + " slime, from slime.vim in slime-lang/vim-slime-syntax autocmd BufNewFile,BufRead *.slime set filetype=slime -augroup END + augroup end +endif -augroup filetypedetect -" solidity:tomlion/vim-solidity +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'solidity') == -1 + augroup filetypedetect + " solidity, from solidity.vim in tomlion/vim-solidity au BufNewFile,BufRead *.sol setf solidity -augroup END + augroup end +endif -augroup filetypedetect -" stylus:wavded/vim-stylus +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'stylus') == -1 + augroup filetypedetect + " stylus, from stylus.vim in wavded/vim-stylus " Stylus autocmd BufNewFile,BufReadPost *.styl set filetype=stylus autocmd BufNewFile,BufReadPost *.stylus set filetype=stylus -augroup END + augroup end +endif -augroup filetypedetect -" sxhkd:baskerville/vim-sxhkdrc +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'sxhkd') == -1 + augroup filetypedetect + " sxhkd, from sxhkdrc.vim in baskerville/vim-sxhkdrc if &compatible || v:version < 603 finish endif autocmd BufNewFile,BufRead sxhkdrc,*.sxhkdrc set ft=sxhkdrc -augroup END + augroup end +endif -augroup filetypedetect -" systemd:kurayama/systemd-vim-syntax +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'systemd') == -1 + augroup filetypedetect + " systemd, from systemd.vim in kurayama/systemd-vim-syntax au BufNewFile,BufRead *.automount set filetype=systemd au BufNewFile,BufRead *.mount set filetype=systemd au BufNewFile,BufRead *.path set filetype=systemd @@ -919,17 +987,21 @@ au BufNewFile,BufRead *.socket set filetype=systemd au BufNewFile,BufRead *.swap set filetype=systemd au BufNewFile,BufRead *.target set filetype=systemd au BufNewFile,BufRead *.timer set filetype=systemd -augroup END + augroup end +endif -augroup filetypedetect -" terraform:hashivim/vim-terraform +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'terraform') == -1 + augroup filetypedetect + " terraform, from terraform.vim in hashivim/vim-terraform au BufRead,BufNewFile *.tf setlocal filetype=terraform au BufRead,BufNewFile *.tfvars setlocal filetype=terraform au BufRead,BufNewFile *.tfstate setlocal filetype=javascript -augroup END + augroup end +endif -augroup filetypedetect -" textile:timcharper/textile.vim +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'textile') == -1 + augroup filetypedetect + " textile, from textile.vim in timcharper/textile.vim " textile.vim " " Tim Harper (tim.theenchanter.com) @@ -938,87 +1010,94 @@ augroup filetypedetect " This will override the system ftplugin/changelog " set on some distros au BufRead,BufNewFile *.textile set filetype=textile -augroup END + augroup end +endif -augroup filetypedetect -" thrift:solarnz/thrift.vim +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'thrift') == -1 + augroup filetypedetect + " thrift, from thrift.vim in solarnz/thrift.vim au BufNewFile,BufRead *.thrift setlocal filetype=thrift -augroup END + augroup end +endif -augroup filetypedetect -" tmux:keith/tmux.vim +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'tmux') == -1 + augroup filetypedetect + " tmux, from tmux.vim in keith/tmux.vim autocmd BufNewFile,BufRead {.,}tmux*.conf* setfiletype tmux -augroup END - -augroup filetypedetect -" tomdoc:wellbredgrapefruit/tomdoc.vim -augroup END + augroup end +endif -augroup filetypedetect -" toml:cespare/vim-toml +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'toml') == -1 + augroup filetypedetect + " toml, from toml.vim in cespare/vim-toml " Go dep and Rust use several TOML config files that are not named with .toml. -autocmd BufNewFile,BufRead *.toml,Gopkg.lock,Cargo.lock,*/.cargo/config set filetype=toml -augroup END +autocmd BufNewFile,BufRead *.toml,Gopkg.lock,Cargo.lock,*/.cargo/config,Pipfile set filetype=toml + augroup end +endif -augroup filetypedetect -" twig:lumiliet/vim-twig +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'twig') == -1 + augroup filetypedetect + " twig, from twig.vim in lumiliet/vim-twig if !exists('g:vim_twig_filetype_detected') && has("autocmd") au BufNewFile,BufRead *.twig set filetype=html.twig au BufNewFile,BufRead *.html.twig set filetype=html.twig au BufNewFile,BufRead *.xml.twig set filetype=xml.twig endif -augroup END + augroup end +endif -augroup filetypedetect -" typescript:leafgarland/typescript-vim +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'typescript') == -1 + augroup filetypedetect + " typescript, from typescript.vim in leafgarland/typescript-vim " use `set filetype` to override default filetype=xml for *.ts files autocmd BufNewFile,BufRead *.ts set filetype=typescript " use `setfiletype` to not override any other plugins like ianks/vim-tsx autocmd BufNewFile,BufRead *.tsx setfiletype typescript -augroup END + augroup end +endif -augroup filetypedetect -" vala:arrufat/vala.vim +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vala') == -1 + augroup filetypedetect + " vala, from vala.vim in arrufat/vala.vim autocmd BufRead *.vala,*.vapi set efm=%f:%l.%c-%[%^:]%#:\ %t%[%^:]%#:\ %m au BufRead,BufNewFile *.vala,*.vapi,*.valadoc setfiletype vala -augroup END - -augroup filetypedetect -" vbnet:vim-scripts/vbnet.vim -augroup END + augroup end +endif -augroup filetypedetect -" vcl:smerrill/vcl-vim-plugin +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vcl') == -1 + augroup filetypedetect + " vcl, from vcl.vim in smerrill/vcl-vim-plugin au BufRead,BufNewFile *.vcl set filetype=vcl -augroup END + augroup end +endif -augroup filetypedetect -" vifm:vifm/vifm.vim +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vifm') == -1 + augroup filetypedetect + " vifm, from vifm-rename.vim in vifm/vifm.vim autocmd BufRead,BufNewFile vifm.rename* :set filetype=vifm-rename -augroup END + augroup end +endif -augroup filetypedetect -" vifm:vifm/vifm.vim +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vifm') == -1 + augroup filetypedetect + " vifm, from vifm.vim in vifm/vifm.vim autocmd BufRead,BufNewFile vifmrc :set filetype=vifm autocmd BufRead,BufNewFile *vifm/colors/* :set filetype=vifm -augroup END + augroup end +endif -augroup filetypedetect -" vue:posva/vim-vue -au BufNewFile,BufRead *.vue setf vue -augroup END +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vue') == -1 + augroup filetypedetect + " vue, from vue.vim in posva/vim-vue +au BufNewFile,BufRead *.vue,*.wpy setf vue + augroup end +endif -augroup filetypedetect -" vm:lepture/vim-velocity +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vm') == -1 + augroup filetypedetect + " vm, from velocity.vim in lepture/vim-velocity au BufRead,BufNewFile *.vm set ft=velocity syntax=velocity -augroup END - -augroup filetypedetect -" xls:vim-scripts/XSLT-syntax -augroup END - -augroup filetypedetect -" yard:sheerun/vim-yardoc -augroup END + augroup end +endif diff --git a/ftplugin/ansible.vim b/ftplugin/ansible.vim index e068dd3a..5f2f3f74 100644 --- a/ftplugin/ansible.vim +++ b/ftplugin/ansible.vim @@ -4,6 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ansible') == -1 if exists('+regexpengine') && ('®expengine' == 0) setlocal regexpengine=1 endif +set isfname+=@-@ set path+=./../templates,./../files,templates,files endif diff --git a/ftplugin/cabal.vim b/ftplugin/cabal.vim deleted file mode 100644 index 5c041bd3..00000000 --- a/ftplugin/cabal.vim +++ /dev/null @@ -1,9 +0,0 @@ -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haskell') == -1 - -if exists("g:loaded_haskellvim_cabal") - finish -endif - -let g:loaded_haskellvim_cabal = 1 - -endif diff --git a/ftplugin/elixir.vim b/ftplugin/elixir.vim index c02bff35..debaa10a 100644 --- a/ftplugin/elixir.vim +++ b/ftplugin/elixir.vim @@ -32,11 +32,7 @@ let &l:path = setlocal includeexpr=elixir#util#get_filename(v:fname) setlocal suffixesadd=.ex,.exs,.eex,.erl,.yrl,.hrl -if empty(&formatprg) - setlocal formatprg=mix\ format\ - -endif - -let &l:define = 'def\(macro|guard|delegate\)p' +let &l:define = 'def\(macro\|guard\|delegate\)\=p\=' silent! setlocal formatoptions-=t formatoptions+=croqlj diff --git a/ftplugin/haskell.vim b/ftplugin/haskell.vim deleted file mode 100644 index b1028620..00000000 --- a/ftplugin/haskell.vim +++ /dev/null @@ -1,20 +0,0 @@ -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haskell') == -1 - -if exists("g:loaded_haskellvim_haskell") - finish -endif - -let g:loaded_haskellvim_haskell = 1 - -function! haskell#sortImports(line1, line2) - exe a:line1 . "," . a:line2 . "sort /import\\s\\+\\(qualified\\s\\+\\)\\?/" -endfunction - -function! haskell#formatImport(line1, line2) - exec a:line1 . ",". a:line2 . "s/import\\s\\+\\([A-Z].*\\)/import \\1" -endfunction - -command! -buffer -range HaskellSortImports call haskell#sortImports(, ) -command! -buffer -range HaskellFormatImport call haskell#formatImport(, ) - -endif diff --git a/ftplugin/nix.vim b/ftplugin/nix.vim index 8f3cf812..52c0ee69 100644 --- a/ftplugin/nix.vim +++ b/ftplugin/nix.vim @@ -11,7 +11,12 @@ endif let b:did_ftplugin = 1 -setlocal comments=:# -setlocal commentstring=#\ %s +setlocal + \ comments=:# + \ commentstring=#\ %s + \ shiftwidth=2 + \ softtabstop=2 + \ expandtab + \ iskeyword+=- endif diff --git a/ftplugin/purescript.vim b/ftplugin/purescript.vim index 695a4108..37951f44 100644 --- a/ftplugin/purescript.vim +++ b/ftplugin/purescript.vim @@ -1,6 +1,6 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'purescript') == -1 -setlocal comments=s1fl:{-,mb:\ \ ,ex:-},:-- +setlocal comments=s1fl:{-,mb:\ \ ,ex:-},:--\ \|,:-- setlocal include=^import setlocal includeexpr=printf('%s.purs',substitute(v:fname,'\\.','/','g')) diff --git a/indent/haskell.vim b/indent/haskell.vim index 5a337144..11cca26b 100644 --- a/indent/haskell.vim +++ b/indent/haskell.vim @@ -320,7 +320,7 @@ function! GetHaskellIndent() " newtype Foo = Foo " >>deriving - if l:prevline =~ '\C\s*\<\(newtype\|data\)\>[^{]\+' && l:line =~ '\C^\s*\' + if l:prevline =~ '\C^\s*\<\(newtype\|data\)\>[^{]\+' && l:line =~ '\C^\s*\' return match(l:prevline, '\S') + &shiftwidth endif diff --git a/indent/html.vim b/indent/html.vim index 1e5691f7..defaca2a 100644 --- a/indent/html.vim +++ b/indent/html.vim @@ -1,466 +1,1065 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'html5') == -1 -" Description: HTML5 and inline SVG indenter -" Changed By: HT de Beer -" Last Change: 20121013 -" Added the SVG elements to the list of indenting element. SVG elements -" taken from http://www.w3.org/TR/SVG/eltindex.html -" -" Description: html5 (and html4) indenter -" Changed By: Brian Gershon -" Last Change: 30 Jan 2011 -" -" 1. Started with vim72 html indent file authored by Johannes Zellner (below) -" 2. Added html5 list as described here: -" http://stackoverflow.com/questions/3232518/how-to-update-vim-to-color-code-new-html-elements -" 3. Added this to a fork of https://github.com/othree/html5.vim -" which already provides nice html5 syntax highlighting. +" Vim indent script for HTML +" Header: "{{{ +" Maintainer: Bram Moolenaar +" Original Author: Andy Wokula +" Last Change: 2017 Jun 13 +" Version: 1.0 +" Description: HTML indent script with cached state for faster indenting on a +" range of lines. +" Supports template systems through hooks. +" Supports Closure stylesheets. " -" Description: html indenter -" Author: Johannes Zellner -" Last Change: Mo, 05 Jun 2006 22:32:41 CEST -" Restoring 'cpo' and 'ic' added by Bram 2006 May 5 -" Globals: -" let g:html_indent_tags = 'html\|p\|time' -" let g:html_exclude_tags = ['html', 'style', 'script', 'body'] - - -" Only load this indent file when no other was loaded. -if exists("b:did_indent") - finish +" Credits: +" indent/html.vim (2006 Jun 05) from J. Zellner +" indent/css.vim (2006 Dec 20) from N. Weibull +" +" History: +" 2014 June (v1.0) overhaul (Bram) +" 2012 Oct 21 (v0.9) added support for shiftwidth() +" 2011 Sep 09 (v0.8) added HTML5 tags (thx to J. Zuckerman) +" 2008 Apr 28 (v0.6) revised customization +" 2008 Mar 09 (v0.5) fixed 'indk' issue (thx to C.J. Robinson) +"}}} + +" Init Folklore, check user settings (2nd time ++) +if exists("b:did_indent") "{{{ + finish endif -runtime! indent/javascript.vim -let s:jsindent = &indentexpr -unlet b:did_indent -runtime! indent/css.vim -let s:cssindent = &indentexpr -let b:did_indent = 1 -" [-- local settings (must come before aborting the script) --] -setlocal indentexpr=HtmlIndentGet(v:lnum) -setlocal indentkeys=o,O,*,<>>,{,},!^F - - -let s:tags = [] -let s:no_tags = [] - -" [-- --] -call add(s:tags, 'a') -call add(s:tags, 'abbr') -call add(s:tags, 'acronym') -call add(s:tags, 'address') -call add(s:tags, 'b') -call add(s:tags, 'bdo') -call add(s:tags, 'big') -call add(s:tags, 'blockquote') -call add(s:tags, 'button') -call add(s:tags, 'caption') -call add(s:tags, 'center') -call add(s:tags, 'cite') -call add(s:tags, 'code') -call add(s:tags, 'colgroup') -call add(s:tags, 'del') -call add(s:tags, 'dfn') -call add(s:tags, 'dir') -call add(s:tags, 'div') -call add(s:tags, 'dl') -call add(s:tags, 'dt') -call add(s:tags, 'dd') -call add(s:tags, 'em') -call add(s:tags, 'fieldset') -call add(s:tags, 'font') -call add(s:tags, 'form') -call add(s:tags, 'frameset') -call add(s:tags, 'h1') -call add(s:tags, 'h2') -call add(s:tags, 'h3') -call add(s:tags, 'h4') -call add(s:tags, 'h5') -call add(s:tags, 'h6') -call add(s:tags, 'i') -call add(s:tags, 'iframe') -call add(s:tags, 'ins') -call add(s:tags, 'kbd') -call add(s:tags, 'label') -call add(s:tags, 'legend') -call add(s:tags, 'li') -call add(s:tags, 'map') -call add(s:tags, 'menu') -call add(s:tags, 'noframes') -call add(s:tags, 'noscript') -call add(s:tags, 'object') -call add(s:tags, 'ol') -call add(s:tags, 'optgroup') -call add(s:tags, 'p') -" call add(s:tags, 'pre') -call add(s:tags, 'q') -call add(s:tags, 's') -call add(s:tags, 'samp') -call add(s:tags, 'script') -call add(s:tags, 'select') -call add(s:tags, 'small') -call add(s:tags, 'span') -call add(s:tags, 'strong') -call add(s:tags, 'style') -call add(s:tags, 'sub') -call add(s:tags, 'sup') -call add(s:tags, 'table') -call add(s:tags, 'textarea') -call add(s:tags, 'title') -call add(s:tags, 'tt') -call add(s:tags, 'u') -call add(s:tags, 'ul') -call add(s:tags, 'var') - -" New HTML 5 elements -call add(s:tags, 'article') -call add(s:tags, 'aside') -call add(s:tags, 'audio') -call add(s:tags, 'canvas') -call add(s:tags, 'datalist') -call add(s:tags, 'details') -call add(s:tags, 'figcaption') -call add(s:tags, 'figure') -call add(s:tags, 'footer') -call add(s:tags, 'header') -call add(s:tags, 'hgroup') -call add(s:tags, 'main') -call add(s:tags, 'mark') -call add(s:tags, 'meter') -call add(s:tags, 'nav') -call add(s:tags, 'output') -call add(s:tags, 'progress') -call add(s:tags, 'picture') -call add(s:tags, 'rb') -call add(s:tags, 'rp') -call add(s:tags, 'rt') -call add(s:tags, 'rtc') -call add(s:tags, 'ruby') -call add(s:tags, 'section') -call add(s:tags, 'source') -call add(s:tags, 'summary') -call add(s:tags, 'time') -call add(s:tags, 'video') -call add(s:tags, 'bdi') -call add(s:tags, 'data') - -" Web Component -call add(s:tags, 'template') - -" Common inline used SVG elements -call add(s:tags, 'clipPath') -call add(s:tags, 'defs') -call add(s:tags, 'desc') -call add(s:tags, 'filter') -call add(s:tags, 'foreignObject') -call add(s:tags, 'g') -call add(s:tags, 'linearGradient') -call add(s:tags, 'marker') -call add(s:tags, 'mask') -call add(s:tags, 'pattern') -call add(s:tags, 'radialGradient') -call add(s:tags, 'svg') -call add(s:tags, 'switch') -call add(s:tags, 'symbol') -call add(s:tags, 'text') -call add(s:tags, 'textPath') -call add(s:tags, 'tref') -call add(s:tags, 'tspan') -" Common self closing SVG elements -call add(s:no_tags, 'animate') -call add(s:no_tags, 'animateTransform') -call add(s:no_tags, 'circle') -call add(s:no_tags, 'ellipse') -call add(s:no_tags, 'feBlend') -call add(s:no_tags, 'feColorMatrix') -call add(s:no_tags, 'feComposite') -call add(s:no_tags, 'feConvolveMatrix') -call add(s:no_tags, 'feDisplacementMap') -call add(s:no_tags, 'feFlood') -call add(s:no_tags, 'feFuncR') -call add(s:no_tags, 'feFuncG') -call add(s:no_tags, 'feFuncB') -call add(s:no_tags, 'feFuncA') -call add(s:no_tags, 'feGaussianBlur') -call add(s:no_tags, 'feImage') -call add(s:no_tags, 'feMergeNode') -call add(s:no_tags, 'feMorphology') -call add(s:no_tags, 'feOffset') -call add(s:no_tags, 'fePointLight') -call add(s:no_tags, 'feSpotLight') -call add(s:no_tags, 'feTile') -call add(s:no_tags, 'feTurbulence') -call add(s:no_tags, 'hatchpath') -call add(s:no_tags, 'hkern') -call add(s:no_tags, 'image') -call add(s:no_tags, 'line') -call add(s:no_tags, 'mpath') -call add(s:no_tags, 'polygon') -call add(s:no_tags, 'polyline') -call add(s:no_tags, 'path') -call add(s:no_tags, 'rect') -call add(s:no_tags, 'solidColor') -call add(s:no_tags, 'stop') -call add(s:no_tags, 'use') -call add(s:no_tags, 'view') -call add(s:no_tags, 'vkern') - -call add(s:tags, 'html') -call add(s:tags, 'head') -call add(s:tags, 'body') - -call add(s:tags, 'thead') -call add(s:tags, 'tbody') -call add(s:tags, 'tfoot') -call add(s:tags, 'tr') -call add(s:tags, 'th') -call add(s:tags, 'td') - -call add(s:no_tags, 'base') -call add(s:no_tags, 'link') -call add(s:no_tags, 'meta') -call add(s:no_tags, 'hr') -call add(s:no_tags, 'br') -call add(s:no_tags, 'wbr') -call add(s:no_tags, 'img') -call add(s:no_tags, 'embed') -call add(s:no_tags, 'param') -call add(s:no_tags, 'source') -call add(s:no_tags, 'track') -call add(s:no_tags, 'area') -call add(s:no_tags, 'col') -call add(s:no_tags, 'input') -call add(s:no_tags, 'keygen') -call add(s:no_tags, 'menuitem') - -let s:omittable = [ - \ ['address', 'article', 'aside', 'blockquote', 'dir', 'div', 'dl', 'fieldset', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hr', 'menu', 'nav', 'ol', 'p', 'pre', 'section', 'table', 'ul'], - \ ['dt', 'dd'], - \ ['li'], - \ ['thead', 'tbody', 'tfoot'], - \ ['th', 'td'], - \] - - -let s:html_noindent_tags = join(s:no_tags, '\|') - -if exists('g:html_exclude_tags') - for tag in g:html_exclude_tags - call remove(s:tags, index(s:tags, tag)) - endfor - let s:html_noindent_tags = s:html_noindent_tags.'\|'.join(g:html_exclude_tags, '\|') +" Load the Javascript indent script first, it defines GetJavascriptIndent(). +" Undo the rest. +" Load base python indent. +if !exists('*GetJavascriptIndent') + runtime! indent/javascript.vim endif +let b:did_indent = 1 + +setlocal indentexpr=HtmlIndent() +setlocal indentkeys=o,O,,<>>,{,},!^F + +" Needed for % to work when finding start/end of a tag. +setlocal matchpairs+=<:> + +let b:undo_indent = "setlocal inde< indk<" -" let s:html_indent_tags = join(s:tags, '\|') -let s:html_indent_tags = '[a-z_][a-z0-9_.-]*' -" if exists('g:html_indent_tags') - " let s:html_indent_tags = s:html_indent_tags.'\|'.g:html_indent_tags -" endif +" b:hi_indent keeps state to speed up indenting consecutive lines. +let b:hi_indent = {"lnum": -1} +"""""" Code below this is loaded only once. """"" +if exists("*HtmlIndent") && !exists('g:force_reload_html') + call HtmlIndent_CheckUserSettings() + finish +endif + +" Allow for line continuation below. let s:cpo_save = &cpo set cpo-=C +"}}} -func! HtmlIndentPatternCount(content, pattern) - let s = substitute('x'.a:content, a:pattern, "\1", 'g') - let s = substitute(s, "[^\1].*$", '', '') - return strlen(s) -endfun - -" [-- count indent-increasing tags of line a:lnum --] -fun! HtmlIndentOpen(lnum, pattern) - return HtmlIndentPatternCount(getline(a:lnum), - \ '.\{-}\(\(<\)\('.a:pattern.'\)\>\)') -endfun - -" [-- count indent-decreasing tags of line a:lnum --] -fun! HtmlIndentClose(lnum, pattern) - return HtmlIndentPatternCount(getline(a:lnum), - \ '.\{-}\(\(<\)/\('.a:pattern.'\)\>>\)') -endfun - -" [-- count self close tags of line a:lnum --] -fun! HtmlIndentSelfClose(lnum, pattern) - return HtmlIndentPatternCount(getline(a:lnum), - \ '.\{-}\(\(<\('.a:pattern.'\).*\)\@\)') -endfun - -" [-- count indent-increasing '{' of (java|css) line a:lnum --] -fun! HtmlIndentOpenAlt(lnum) - return strlen(substitute(getline(a:lnum), '[^{]\+', '', 'g')) -endfun - -" [-- count indent-decreasing '}' of (java|css) line a:lnum --] -fun! HtmlIndentCloseAlt(lnum) - return strlen(substitute(getline(a:lnum), '[^}]\+', '', 'g')) -endfun - -" [-- return the sum of indents respecting the syntax of a:lnum --] -fun! HtmlIndentSum(lnum, style) - if a:style == match(getline(a:lnum), '^\s*') - let open = HtmlIndentOpen(a:lnum, s:html_indent_tags) - HtmlIndentOpen(a:lnum, s:html_noindent_tags) - let close = HtmlIndentClose(a:lnum, s:html_indent_tags) - HtmlIndentClose(a:lnum, s:html_noindent_tags) - let self_close = HtmlIndentSelfClose(a:lnum, s:html_noindent_tags) - if 0 != open || 0 != close || 0 != self_close - return open - close - self_close - endif - endif - endif +" Check and process settings from b:html_indent and g:html_indent... variables. +" Prefer using buffer-local settings over global settings, so that there can +" be defaults for all HTML files and exceptions for specific types of HTML +" files. +func! HtmlIndent_CheckUserSettings() + "{{{ + let inctags = '' + if exists("b:html_indent_inctags") + let inctags = b:html_indent_inctags + elseif exists("g:html_indent_inctags") + let inctags = g:html_indent_inctags + endif + let b:hi_tags = {} + if len(inctags) > 0 + call s:AddITags(b:hi_tags, split(inctags, ",")) + endif - if '' != &syntax && - \ synIDattr(synID(a:lnum, 1, 1), 'name') =~ '\(css\|java\).*' && - \ synIDattr(synID(a:lnum, strlen(getline(a:lnum)), 1), 'name') - \ =~ '\(css\|java\).*' - if a:style == match(getline(a:lnum), '^\s*}') - return HtmlIndentOpenAlt(a:lnum) - HtmlIndentCloseAlt(a:lnum) - endif + let autotags = '' + if exists("b:html_indent_autotags") + let autotags = b:html_indent_autotags + elseif exists("g:html_indent_autotags") + let autotags = g:html_indent_autotags + endif + let b:hi_removed_tags = {} + if len(autotags) > 0 + call s:RemoveITags(b:hi_removed_tags, split(autotags, ",")) + endif + + " Syntax names indicating being inside a string of an attribute value. + let string_names = [] + if exists("b:html_indent_string_names") + let string_names = b:html_indent_string_names + elseif exists("g:html_indent_string_names") + let string_names = g:html_indent_string_names + endif + let b:hi_insideStringNames = ['htmlString'] + if len(string_names) > 0 + for s in string_names + call add(b:hi_insideStringNames, s) + endfor + endif + + " Syntax names indicating being inside a tag. + let tag_names = [] + if exists("b:html_indent_tag_names") + let tag_names = b:html_indent_tag_names + elseif exists("g:html_indent_tag_names") + let tag_names = g:html_indent_tag_names + endif + let b:hi_insideTagNames = ['htmlTag', 'htmlScriptTag'] + if len(tag_names) > 0 + for s in tag_names + call add(b:hi_insideTagNames, s) + endfor + endif + + let indone = {"zero": 0 + \,"auto": "indent(prevnonblank(v:lnum-1))" + \,"inc": "b:hi_indent.blocktagind + shiftwidth()"} + + let script1 = '' + if exists("b:html_indent_script1") + let script1 = b:html_indent_script1 + elseif exists("g:html_indent_script1") + let script1 = g:html_indent_script1 + endif + if len(script1) > 0 + let b:hi_js1indent = get(indone, script1, indone.zero) + else + let b:hi_js1indent = 0 + endif + + let style1 = '' + if exists("b:html_indent_style1") + let style1 = b:html_indent_style1 + elseif exists("g:html_indent_style1") + let style1 = g:html_indent_style1 + endif + if len(style1) > 0 + let b:hi_css1indent = get(indone, style1, indone.zero) + else + let b:hi_css1indent = 0 + endif + + if !exists('b:html_indent_line_limit') + if exists('g:html_indent_line_limit') + let b:html_indent_line_limit = g:html_indent_line_limit + else + let b:html_indent_line_limit = 200 endif + endif +endfunc "}}} + +" Init Script Vars +"{{{ +let b:hi_lasttick = 0 +let b:hi_newstate = {} +let s:countonly = 0 + "}}} + +" Fill the s:indent_tags dict with known tags. +" The key is "tagname" or "/tagname". {{{ +" The value is: +" 1 opening tag +" 2 "pre" +" 3 "script" +" 4 "style" +" 5 comment start +" 6 conditional comment start +" -1 closing tag +" -2 "/pre" +" -3 "/script" +" -4 "/style" +" -5 comment end +" -6 conditional comment end +let s:indent_tags = {} +let s:endtags = [0,0,0,0,0,0,0] " long enough for the highest index +"}}} + +" Add a list of tag names for a pair of to "tags". +func! s:AddITags(tags, taglist) + "{{{ + for itag in a:taglist + let a:tags[itag] = 1 + let a:tags['/' . itag] = -1 + endfor +endfunc "}}} + +" Take a list of tag name pairs that are not to be used as tag pairs. +func! s:RemoveITags(tags, taglist) + "{{{ + for itag in a:taglist + let a:tags[itag] = 1 + let a:tags['/' . itag] = 1 + endfor +endfunc "}}} + +" Add a block tag, that is a tag with a different kind of indenting. +func! s:AddBlockTag(tag, id, ...) + "{{{ + if !(a:id >= 2 && a:id < len(s:endtags)) + echoerr 'AddBlockTag ' . a:id + return + endif + let s:indent_tags[a:tag] = a:id + if a:0 == 0 + let s:indent_tags['/' . a:tag] = -a:id + let s:endtags[a:id] = "" + else + let s:indent_tags[a:1] = -a:id + let s:endtags[a:id] = a:1 + endif +endfunc "}}} + +" Add known tag pairs. +" Self-closing tags and tags that are sometimes {{{ +" self-closing (e.g.,

) are not here (when encountering

we can find +" the matching

, but not the other way around). +" Old HTML tags: +call s:AddITags(s:indent_tags, [ + \ 'a', 'abbr', 'acronym', 'address', 'b', 'bdo', 'big', + \ 'blockquote', 'body', 'button', 'caption', 'center', 'cite', 'code', + \ 'colgroup', 'del', 'dfn', 'dir', 'div', 'dl', 'em', 'fieldset', 'font', + \ 'form', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'html', + \ 'i', 'iframe', 'ins', 'kbd', 'label', 'legend', 'li', + \ 'map', 'menu', 'noframes', 'noscript', 'object', 'ol', + \ 'optgroup', 'p', 'q', 's', 'samp', 'select', 'small', 'span', 'strong', 'sub', + \ 'sup', 'table', 'textarea', 'title', 'tt', 'u', 'ul', 'var', 'th', 'td', + \ 'tr', 'tbody', 'tfoot', 'thead']) + +" New HTML5 elements: +call s:AddITags(s:indent_tags, [ + \ 'area', 'article', 'aside', 'audio', 'bdi', 'canvas', + \ 'command', 'data', 'datalist', 'details', 'dislog', 'embed', 'figcaption', + \ 'figure', 'footer', 'header', 'keygen', 'main', 'mark', 'meter', 'nav', 'output', + \ 'picture', 'progress', 'rp', 'rt', 'ruby', 'section', 'source', 'summary', 'svg', + \ 'time', 'track', 'video', 'wbr']) + +" Tags added for web components: +call s:AddITags(s:indent_tags, [ + \ 'content', 'shadow', 'template']) +"}}} + +" Add Block Tags: these contain alien content +"{{{ +call s:AddBlockTag('pre', 2) +call s:AddBlockTag('script', 3) +call s:AddBlockTag('style', 4) +call s:AddBlockTag('') +call s:AddBlockTag('') +"}}} + +" Return non-zero when "tagname" is an opening tag, not being a block tag, for +" which there should be a closing tag. Can be used by scripts that include +" HTML indenting. +func! HtmlIndent_IsOpenTag(tagname) + "{{{ + if get(s:indent_tags, a:tagname) == 1 + return 1 + endif + return get(b:hi_tags, a:tagname) == 1 +endfunc "}}} + +" Get the value for "tagname", taking care of buffer-local tags. +func! s:get_tag(tagname) + "{{{ + let i = get(s:indent_tags, a:tagname) + if (i == 1 || i == -1) && get(b:hi_removed_tags, a:tagname) != 0 return 0 -endfun + endif + if i == 0 + let i = get(b:hi_tags, a:tagname) + endif + return i +endfunc "}}} -fun! HtmlIndentGet(lnum) - " Get shiftwidth value. - if exists('*shiftwidth') - let sw = shiftwidth() +" Count the number of start and end tags in "text". +func! s:CountITags(text) + "{{{ + " Store the result in s:curind and s:nextrel. + let s:curind = 0 " relative indent steps for current line [unit &sw]: + let s:nextrel = 0 " relative indent steps for next line [unit &sw]: + let s:block = 0 " assume starting outside of a block + let s:countonly = 1 " don't change state + call substitute(a:text, '<\zs/\=\w\+\(-\w\+\)*\>\|\|', '\=s:CheckTag(submatch(0))', 'g') + let s:countonly = 0 +endfunc "}}} + +" Count the number of start and end tags in text. +func! s:CountTagsAndState(text) + "{{{ + " Store the result in s:curind and s:nextrel. Update b:hi_newstate.block. + let s:curind = 0 " relative indent steps for current line [unit &sw]: + let s:nextrel = 0 " relative indent steps for next line [unit &sw]: + + let s:block = b:hi_newstate.block + let tmp = substitute(a:text, '<\zs/\=\w\+\(-\w\+\)*\>\|\|', '\=s:CheckTag(submatch(0))', 'g') + if s:block == 3 + let b:hi_newstate.scripttype = s:GetScriptType(matchstr(tmp, '\C.*\zs[^>]*')) + endif + let b:hi_newstate.block = s:block +endfunc "}}} + +" Used by s:CountITags() and s:CountTagsAndState(). +func! s:CheckTag(itag) + "{{{ + " Returns an empty string or "SCRIPT". + " a:itag can be "tag" or "/tag" or "" + if (s:CheckCustomTag(a:itag)) + return "" + endif + let ind = s:get_tag(a:itag) + if ind == -1 + " closing tag + if s:block != 0 + " ignore itag within a block + return "" + endif + if s:nextrel == 0 + let s:curind -= 1 else - let sw = &sw + let s:nextrel -= 1 endif + elseif ind == 1 + " opening tag + if s:block != 0 + return "" + endif + let s:nextrel += 1 + elseif ind != 0 + " block-tag (opening or closing) + return s:CheckBlockTag(a:itag, ind) + " else ind==0 (other tag found): keep indent + endif + return "" +endfunc "}}} - " Find a non-empty line above the current line. - let lnum = prevnonblank(a:lnum - 1) +" Used by s:CheckTag(). Returns an empty string or "SCRIPT". +func! s:CheckBlockTag(blocktag, ind) + "{{{ + if a:ind > 0 + " a block starts here + if s:block != 0 + " already in a block (nesting) - ignore + " especially ignore comments after other blocktags + return "" + endif + let s:block = a:ind " block type + if s:countonly + return "" + endif + let b:hi_newstate.blocklnr = v:lnum + " save allover indent for the endtag + let b:hi_newstate.blocktagind = b:hi_indent.baseindent + (s:nextrel + s:curind) * shiftwidth() + if a:ind == 3 + return "SCRIPT" " all except this must be lowercase + " line is to be checked again for the type attribute + endif + else + let s:block = 0 + " we get here if starting and closing a block-tag on the same line + endif + return "" +endfunc "}}} - " Hit the start of the file, use zero indent. - if lnum == 0 - return 0 +" Used by s:CheckTag(). +func! s:CheckCustomTag(ctag) + "{{{ + " Returns 1 if ctag is the tag for a custom element, 0 otherwise. + " a:ctag can be "tag" or "/tag" or "" + let pattern = '\%\(\w\+-\)\+\w\+' + if match(a:ctag, pattern) == -1 + return 0 + endif + if matchstr(a:ctag, '\/\ze.\+') == "/" + " closing tag + if s:block != 0 + " ignore ctag within a block + return 1 + endif + if s:nextrel == 0 + let s:curind -= 1 + else + let s:nextrel -= 1 endif + else + " opening tag + if s:block != 0 + return 1 + endif + let s:nextrel += 1 + endif + return 1 +endfunc "}}} - let restore_ic = &ic - setlocal ic " ignore case +" Return the ' - - """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - " by Tye Zdrojewski , 05 Jun 2006 - " ZDR: This needs to be an AND (we are 'after the start of the pair' AND - " we are 'before the end of the pair'). Otherwise, indentation - " before the start of the script block will be affected; the end of - " the pair will still match if we are before the beginning of the - " pair. - " - if 0 < searchpair(js, '', jse, 'nWb') - \ && 0 < searchpair(js, '', jse, 'nW') - " we're inside javascript - if getline(searchpair(js, '', '', 'nWb')) !~ '