diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2020-10-17 14:17:55 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-10-17 14:17:55 +0200 |
commit | af3ebda71002223b4bc6d4cc79a0359523eaa385 (patch) | |
tree | 74ed3ae3100bf4ae297fb1588073fa279cca063b | |
parent | 6b663ec330356e92de9c68a6dac09a80a2d5b07c (diff) | |
download | vim-polyglot-af3ebda71002223b4bc6d4cc79a0359523eaa385.tar.gz vim-polyglot-af3ebda71002223b4bc6d4cc79a0359523eaa385.zip |
Fix testsv4.13.4
Diffstat (limited to '')
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | autoload/context.vim | 188 | ||||
-rw-r--r-- | autoload/polyglot/sleuth.vim | 9 | ||||
-rw-r--r-- | compiler/context.vim | 58 | ||||
-rw-r--r-- | ftdetect/polyglot.vim | 30 | ||||
-rw-r--r-- | ftplugin/context.vim | 106 | ||||
-rw-r--r-- | ftplugin/docker-compose.vim | 2 | ||||
-rw-r--r-- | ftplugin/dockerfile.vim | 20 | ||||
-rw-r--r-- | ftplugin/man.vim | 254 | ||||
-rw-r--r-- | indent/context.vim | 40 | ||||
-rw-r--r-- | packages.yaml | 39 | ||||
-rw-r--r-- | syntax/context.vim | 145 | ||||
-rw-r--r-- | syntax/docker-compose.vim | 2 | ||||
-rw-r--r-- | syntax/dockerfile.vim | 49 | ||||
-rw-r--r-- | syntax/man.vim | 60 | ||||
-rw-r--r-- | syntax/xpm.vim | 142 | ||||
-rw-r--r-- | syntax/xpm2.vim | 157 | ||||
-rw-r--r-- | tests/filetypes.vim | 5 |
18 files changed, 1298 insertions, 14 deletions
@@ -7,7 +7,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-->593<!--/Package Count--> packages it consists of. +- It **installs and updates 120+ times faster** than the <!--Package Count-->598<!--/Package Count--> packages it consists of. - It is more secure because scripts loaded for all extensions are generated by vim-polyglot (ftdetect). - Solid syntax and indentation support (other features skipped). Only the best language packs. - All unnecessary files are ignored (like enormous documentation from php support). @@ -70,7 +70,7 @@ On top of all language packs from [vim repository](https://github.com/vim/vim/tr - [dart](https://github.com/dart-lang/dart-vim-plugin) (Dart syntax highlighting for dart and drt files) - [dhall](https://github.com/vmchale/dhall-vim) (Dhall syntax highlighting for dhall files) - [dlang](https://github.com/JesseKPhillips/d.vim) (D syntax highlighting for d, di, lst, dd, ddoc and sdl files) -- [dockerfile](https://github.com/ekalinin/Dockerfile.vim) +- [docker-compose](https://github.com/ekalinin/Dockerfile.vim) - [elixir](https://github.com/elixir-lang/vim-elixir) (Elixir and HTML+EEX syntax highlighting for ex, exs, eex and leex files) - [elm](https://github.com/andys8/vim-elm-syntax) (Elm syntax highlighting for elm files) - [emberscript](https://github.com/yalesov/vim-ember-script) (EmberScript syntax highlighting for em and emberscript files) @@ -138,7 +138,7 @@ On top of all language packs from [vim repository](https://github.com/vim/vim/tr - [opencl](https://github.com/petRUShka/vim-opencl) (OpenCL syntax highlighting for cl and opencl files) - [perl](https://github.com/vim-perl/vim-perl) (Perl syntax highlighting for pl, al, cgi, fcgi, perl and 12 more files) - [pgsql](https://github.com/lifepillar/pgsql.vim) (PLpgSQL syntax highlighting for pgsql files) -- [php](https://github.com/StanAngeloff/php.vim) (PHP syntax highlighting for php, aw, ctp, fcgi, inc and 6 more files) +- [php](https://github.com/StanAngeloff/php.vim) (PHP syntax highlighting for php, aw, ctp, fcgi, inc and 7 more files) - [plantuml](https://github.com/aklt/plantuml-syntax) (PlantUML syntax highlighting for puml, iuml, plantuml, uml and pu files) - [pony](https://github.com/jakwings/vim-pony) (Pony syntax highlighting for pony files) - [powershell](https://github.com/PProvost/vim-ps1) (PowerShell syntax highlighting for ps1, psd1, psm1, pssc and ps1xml files) diff --git a/autoload/context.vim b/autoload/context.vim new file mode 100644 index 00000000..43786463 --- /dev/null +++ b/autoload/context.vim @@ -0,0 +1,188 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'context') == -1 + +" Language: ConTeXt typesetting engine +" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> +" Latest Revision: 2016 Oct 21 + +let s:keepcpo= &cpo +set cpo&vim + +" Helper functions {{{ +function! s:context_echo(message, mode) + redraw + echo "\r" + execute 'echohl' a:mode + echomsg '[ConTeXt]' a:message + echohl None +endf + +function! s:sh() + return has('win32') || has('win64') || has('win16') || has('win95') + \ ? ['cmd.exe', '/C'] + \ : ['/bin/sh', '-c'] +endfunction + +" For backward compatibility +if exists('*win_getid') + + function! s:win_getid() + return win_getid() + endf + + function! s:win_id2win(winid) + return win_id2win(a:winid) + endf + +else + + function! s:win_getid() + return winnr() + endf + + function! s:win_id2win(winnr) + return a:winnr + endf + +endif +" }}} + +" ConTeXt jobs {{{ +if has('job') + + let g:context_jobs = [] + + " Print the status of ConTeXt jobs + function! context#job_status() + let l:jobs = filter(g:context_jobs, 'job_status(v:val) == "run"') + let l:n = len(l:jobs) + call s:context_echo( + \ 'There '.(l:n == 1 ? 'is' : 'are').' '.(l:n == 0 ? 'no' : l:n) + \ .' job'.(l:n == 1 ? '' : 's').' running' + \ .(l:n == 0 ? '.' : ' (' . join(l:jobs, ', ').').'), + \ 'ModeMsg') + endfunction + + " Stop all ConTeXt jobs + function! context#stop_jobs() + let l:jobs = filter(g:context_jobs, 'job_status(v:val) == "run"') + for job in l:jobs + call job_stop(job) + endfor + sleep 1 + let l:tmp = [] + for job in l:jobs + if job_status(job) == "run" + call add(l:tmp, job) + endif + endfor + let g:context_jobs = l:tmp + if empty(g:context_jobs) + call s:context_echo('Done. No jobs running.', 'ModeMsg') + else + call s:context_echo('There are still some jobs running. Please try again.', 'WarningMsg') + endif + endfunction + + function! context#callback(path, job, status) + if index(g:context_jobs, a:job) != -1 && job_status(a:job) != 'run' " just in case + call remove(g:context_jobs, index(g:context_jobs, a:job)) + endif + call s:callback(a:path, a:job, a:status) + endfunction + + function! context#close_cb(channel) + call job_status(ch_getjob(a:channel)) " Trigger exit_cb's callback for faster feedback + endfunction + + function! s:typeset(path) + call add(g:context_jobs, + \ job_start(add(s:sh(), context#command() . ' ' . shellescape(fnamemodify(a:path, ":t"))), { + \ 'close_cb' : 'context#close_cb', + \ 'exit_cb' : function(get(b:, 'context_callback', get(g:, 'context_callback', 'context#callback')), + \ [a:path]), + \ 'in_io' : 'null' + \ })) + endfunction + +else " No jobs + + function! context#job_status() + call s:context_echo('Not implemented', 'WarningMsg') + endfunction! + + function! context#stop_jobs() + call s:context_echo('Not implemented', 'WarningMsg') + endfunction + + function! context#callback(path, job, status) + call s:callback(a:path, a:job, a:status) + endfunction + + function! s:typeset(path) + execute '!' . context#command() . ' ' . shellescape(fnamemodify(a:path, ":t")) + call call(get(b:, 'context_callback', get(g:, 'context_callback', 'context#callback')), + \ [a:path, 0, v:shell_error]) + endfunction + +endif " has('job') + +function! s:callback(path, job, status) abort + if a:status < 0 " Assume the job was terminated + return + endif + " Get info about the current window + let l:winid = s:win_getid() " Save window id + let l:efm = &l:errorformat " Save local errorformat + let l:cwd = fnamemodify(getcwd(), ":p") " Save local working directory + " Set errorformat to parse ConTeXt errors + execute 'setl efm=' . escape(b:context_errorformat, ' ') + try " Set cwd to expand error file correctly + execute 'lcd' fnameescape(fnamemodify(a:path, ':h')) + catch /.*/ + execute 'setl efm=' . escape(l:efm, ' ') + throw v:exception + endtry + try + execute 'cgetfile' fnameescape(fnamemodify(a:path, ':r') . '.log') + botright cwindow + finally " Restore cwd and errorformat + execute s:win_id2win(l:winid) . 'wincmd w' + execute 'lcd ' . fnameescape(l:cwd) + execute 'setl efm=' . escape(l:efm, ' ') + endtry + if a:status == 0 + call s:context_echo('Success!', 'ModeMsg') + else + call s:context_echo('There are errors. ', 'ErrorMsg') + endif +endfunction + +function! context#command() + return get(b:, 'context_mtxrun', get(g:, 'context_mtxrun', 'mtxrun')) + \ . ' --script context --autogenerate --nonstopmode' + \ . ' --synctex=' . (get(b:, 'context_synctex', get(g:, 'context_synctex', 0)) ? '1' : '0') + \ . ' ' . get(b:, 'context_extra_options', get(g:, 'context_extra_options', '')) +endfunction + +" Accepts an optional path (useful for big projects, when the file you are +" editing is not the project's root document). If no argument is given, uses +" the path of the current buffer. +function! context#typeset(...) abort + let l:path = fnamemodify(strlen(a:000[0]) > 0 ? a:1 : expand("%"), ":p") + let l:cwd = fnamemodify(getcwd(), ":p") " Save local working directory + call s:context_echo('Typesetting...', 'ModeMsg') + execute 'lcd' fnameescape(fnamemodify(l:path, ":h")) + try + call s:typeset(l:path) + finally " Restore local working directory + execute 'lcd ' . fnameescape(l:cwd) + endtry +endfunction! +"}}} + +let &cpo = s:keepcpo +unlet s:keepcpo + +" vim: sw=2 fdm=marker + +endif diff --git a/autoload/polyglot/sleuth.vim b/autoload/polyglot/sleuth.vim index f8dc2344..db032dd6 100644 --- a/autoload/polyglot/sleuth.vim +++ b/autoload/polyglot/sleuth.vim @@ -79,6 +79,7 @@ let s:globs = { \ 'conaryrecipe': '*.recipe', \ 'conf': '*.conf,auto.master,config', \ 'config': 'configure.in,configure.ac,Pipfile', + \ 'context': '*.mkii,*.mkiv,*.mkvi', \ 'cpp': '*.cpp,*.c++,*.cc,*.cp,*.cxx,*.h,*.h++,*.hh,*.hpp,*.hxx,*.inc,*.inl,*.ipp,*.tcc,*.tpp,*.moc,*.tlh', \ 'cql': '*.cql', \ 'crm': '*.crm', @@ -121,6 +122,7 @@ let s:globs = { \ 'diff': '*.diff,*.rej', \ 'dircolors': '.dir_colors,.dircolors', \ 'dnsmasq': '', + \ 'dockerfile': '*.Dockerfile,*.dock,Containerfile,Dockerfile,dockerfile,Dockerfile*', \ 'dosbatch': '*.bat,*.sys', \ 'dosini': '*.wrap,*.ini,*.dof,*.lektorproject,*.prefs,*.pro,*.properties,buildozer.spec,.editorconfig,.npmrc,php.ini-*', \ 'dot': '*.dot,*.gv', @@ -307,6 +309,7 @@ let s:globs = { \ 'make': '*.mak,*.dsp,*.mk,*[mM]akefile', \ 'mako': '*.mako,*.mao', \ 'mallard': '*.page', + \ 'man': '*.1,*.1in,*.1m,*.1x,*.2,*.3,*.3in,*.3m,*.3p,*.3pm,*.3qt,*.3x,*.4,*.5,*.6,*.7,*.8,*.9,*.man,*.mdoc', \ 'manconf': 'man.config', \ 'map': '*.map', \ 'maple': '*.mv,*.mpl,*.mws', @@ -382,7 +385,7 @@ let s:globs = { \ 'perl': '*.pl,*.al,*.cgi,*.fcgi,*.perl,*.ph,*.plx,*.pm,*.psgi,*.t,Makefile.PL,Rexfile,ack,cpanfile,example.gitolite.rc,.gitolite.rc', \ 'pf': 'pf.conf', \ 'pfmain': 'main.cf', - \ 'php': '*.php,*.aw,*.ctp,*.fcgi,*.inc,*.php3,*.php4,*.php5,*.phps,*.phpt,*.phtml,.php,.php_cs,.php_cs.dist,Phakefile', + \ 'php': '*.php,*.aw,*.ctp,*.fcgi,*.inc,*.php3,*.php4,*.php5,*.phps,*.phpt,*.phtml,*.php9,.php,.php_cs,.php_cs.dist,Phakefile', \ 'pike': '*.pike,*.pmod', \ 'pilrc': '*.rcp', \ 'pine': '.pinerc,pinerc,.pinercex,pinercex', @@ -449,7 +452,7 @@ let s:globs = { \ 'rrst': '*.rrst,*.srst', \ 'rst': '*.rst,*.rest,*.rest.txt,*.rst.txt', \ 'rtf': '*.rtf', - \ 'ruby': '*.rb,*.builder,*.eye,*.fcgi,*.gemspec,*.god,*.jbuilder,*.mspec,*.pluginspec,*.podspec,*.rabl,*.rake,*.rbi,*.rbuild,*.rbw,*.rbx,*.ru,*.ruby,*.spec,*.thor,*.watchr,*.rxml,*.rjs,*.rant,*.axlsx,*.cap,*.opal,.irbrc,.pryrc,.simplecov,Appraisals,Berksfile,Buildfile,Capfile,Dangerfile,Deliverfile,Fastfile,Gemfile,Gemfile.lock,Guardfile,Jarfile,Mavenfile,Podfile,Puppetfile,Rakefile,Snapfile,Thorfile,Vagrantfile,buildfile,Rantfile,.autotest,Cheffile,KitchenSink,Routefile,.Guardfile,.Brewfile,vagrantfile,[Rr]akefile*,*_spec.rb', + \ 'ruby': '*.rb,*.builder,*.eye,*.fcgi,*.gemspec,*.god,*.jbuilder,*.mspec,*.pluginspec,*.podspec,*.rabl,*.rake,*.rbi,*.rbuild,*.rbw,*.rbx,*.ru,*.ruby,*.spec,*.thor,*.watchr,*.rxml,*.rjs,*.rant,*.axlsx,*.cap,*.opal,.irbrc,.pryrc,.simplecov,Appraisals,Berksfile,Buildfile,Capfile,Dangerfile,Deliverfile,Fastfile,Gemfile,Gemfile.lock,Guardfile,Jarfile,Mavenfile,Podfile,Puppetfile,Rakefile,Snapfile,Thorfile,Vagrantfile,buildfile,[Rr]antfile,.autotest,Cheffile,KitchenSink,Routefile,.Guardfile,.Brewfile,vagrantfile,[Rr]akefile*,*_spec.rb', \ 'rust': '*.rs,*.rs.in', \ 'samba': 'smb.conf', \ 'sas': '*.sas', @@ -601,6 +604,8 @@ let s:globs = { \ 'xml': '*.xml,*.adml,*.admx,*.ant,*.axml,*.builds,*.ccproj,*.ccxml,*.clixml,*.cproject,*.cscfg,*.csdef,*.csl,*.csproj,*.ct,*.depproj,*.dita,*.ditamap,*.ditaval,*.dll.config,*.dotsettings,*.filters,*.fsproj,*.fxml,*.glade,*.gml,*.gmx,*.grxml,*.gst,*.iml,*.ivy,*.jelly,*.jsproj,*.kml,*.launch,*.mdpolicy,*.mjml,*.mm,*.mod,*.mxml,*.natvis,*.ncl,*.ndproj,*.nproj,*.nuspec,*.odd,*.osm,*.pkgproj,*.pluginspec,*.proj,*.props,*.psc1,*.pt,*.rdf,*.resx,*.rss,*.sch,*.scxml,*.sfproj,*.shproj,*.srdf,*.storyboard,*.sublime-snippet,*.targets,*.tml,*.ui,*.urdf,*.ux,*.vbproj,*.vcxproj,*.vsixmanifest,*.vssettings,*.vstemplate,*.vxml,*.wixproj,*.workflow,*.wsdl,*.wsf,*.wxi,*.wxl,*.wxs,*.x3d,*.xacro,*.xaml,*.xib,*.xlf,*.xliff,*.xmi,*.xml.dist,*.xproj,*.xsd,*.xspec,*.xul,*.zcml,*.cdxml,*.tpm,*.csproj.user,*.wpl,.classpath,.cproject,.project,App.config,NuGet.config,Settings.StyleCop,Web.Debug.config,Web.Release.config,Web.config,packages.config,*fglrxrc', \ 'xml.twig': '*.xml.twig', \ 'xmodmap': '*Xmodmap,*xmodmap*', + \ 'xpm': '*.xpm,*.pm', + \ 'xpm2': '*.xpm2', \ 'xquery': '*.xq,*.xql,*.xqm,*.xquery,*.xqy', \ 'xs': '*.xs', \ 'xsd': '*.xsd', diff --git a/compiler/context.vim b/compiler/context.vim new file mode 100644 index 00000000..9c05b414 --- /dev/null +++ b/compiler/context.vim @@ -0,0 +1,58 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'context') == -1 + +" Vim compiler file +" Compiler: ConTeXt typesetting engine +" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> +" Last Change: 2016 Oct 21 + +if exists("current_compiler") + finish +endif +let s:keepcpo= &cpo +set cpo&vim + +if exists(":CompilerSet") != 2 " older Vim always used :setlocal + command -nargs=* CompilerSet setlocal <args> +endif + +" If makefile exists and we are not asked to ignore it, we use standard make +" (do not redefine makeprg) +if get(b:, 'context_ignore_makefile', get(g:, 'context_ignore_makefile', 0)) || + \ (!filereadable('Makefile') && !filereadable('makefile')) + let current_compiler = 'context' + " The following assumes that the current working directory is set to the + " directory of the file to be typeset + let &l:makeprg = get(b:, 'context_mtxrun', get(g:, 'context_mtxrun', 'mtxrun')) + \ . ' --script context --autogenerate --nonstopmode --synctex=' + \ . (get(b:, 'context_synctex', get(g:, 'context_synctex', 0)) ? '1' : '0') + \ . ' ' . get(b:, 'context_extra_options', get(g:, 'context_extra_options', '')) + \ . ' ' . shellescape(expand('%:p:t')) +else + let current_compiler = 'make' +endif + +let b:context_errorformat = '' + \ . '%-Popen source%.%#> %f,' + \ . '%-Qclose source%.%#> %f,' + \ . "%-Popen source%.%#name '%f'," + \ . "%-Qclose source%.%#name '%f'," + \ . '%Etex %trror%.%#mp error on line %l in file %f:%.%#,' + \ . 'tex %trror%.%#error on line %l in file %f: %m,' + \ . '%Elua %trror%.%#error on line %l in file %f:,' + \ . '%+Emetapost %#> error: %#,' + \ . '! error: %#%m,' + \ . '%-C %#,' + \ . '%C! %m,' + \ . '%Z[ctxlua]%m,' + \ . '%+C<*> %.%#,' + \ . '%-C%.%#,' + \ . '%Z...%m,' + \ . '%-Zno-error,' + \ . '%-G%.%#' " Skip remaining lines + +execute 'CompilerSet errorformat=' . escape(b:context_errorformat, ' ') + +let &cpo = s:keepcpo +unlet s:keepcpo + +endif diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 0ff59e1b..34dfdf8b 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -126,6 +126,23 @@ augroup filetypedetect " DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE +if !has_key(s:disabled_packages, 'context') + au BufNewFile,BufRead *.mkii,*.mkiv,*.mkvi setf context +endif + +if !has_key(s:disabled_packages, 'xpm2') + au BufNewFile,BufRead *.xpm2 setf xpm2 +endif + +if !has_key(s:disabled_packages, 'xpm') + au BufNewFile,BufRead,BufWritePost *.pm call polyglot#detect#Pm() + au BufNewFile,BufRead *.xpm setf xpm +endif + +if !has_key(s:disabled_packages, 'man') + au BufNewFile,BufRead *.1,*.1in,*.1m,*.1x,*.2,*.3,*.3in,*.3m,*.3p,*.3pm,*.3qt,*.3x,*.4,*.5,*.6,*.7,*.8,*.9,*.man,*.mdoc setf man +endif + if !has_key(s:disabled_packages, 'xf86conf') au BufNewFile,BufRead */xorg.conf.d/*.conf,xorg.conf,xorg.conf-4 setf xf86conf au BufNewFile,BufRead XF86Config-4* call s:StarSetf('xf86conf') @@ -1530,6 +1547,11 @@ if !has_key(s:disabled_packages, 'dcd') au BufNewFile,BufRead *.dcd setf dcd endif +if !has_key(s:disabled_packages, 'dockerfile') + au BufNewFile,BufRead *.Dockerfile,*.dock,Containerfile,Dockerfile,dockerfile setf dockerfile + au BufNewFile,BufRead Dockerfile* call s:StarSetf('dockerfile') +endif + if !has_key(s:disabled_packages, 'cuda') au BufNewFile,BufRead *.cu,*.cuh setf cuda endif @@ -1572,7 +1594,7 @@ if !has_key(s:disabled_packages, 'chill') endif if !has_key(s:disabled_packages, 'debchangelog') - au BufNewFile,BufRead NEWS.Debian,NEWS.dch,changelog.Debian,changelog.dch setf debchangelog + au BufNewFile,BufRead */debian/changelog,NEWS.Debian,NEWS.dch,changelog.Debian,changelog.dch setf debchangelog endif if !has_key(s:disabled_packages, 'cterm') @@ -1919,7 +1941,7 @@ if !has_key(s:disabled_packages, 'rspec') endif if !has_key(s:disabled_packages, 'ruby') - au BufNewFile,BufRead *.axlsx,*.builder,*.cap,*.eye,*.fcgi,*.gemspec,*.god,*.jbuilder,*.mspec,*.opal,*.pluginspec,*.podspec,*.rabl,*.rake,*.rant,*.rb,*.rbi,*.rbuild,*.rbw,*.rbx,*.rjs,*.ru,*.ruby,*.rxml,*.spec,*.thor,*.watchr,{.,}Brewfile,{.,}Guardfile,{.,}autotest,{.,}irbrc,{.,}pryrc,{.,}simplecov,Appraisals,Berksfile,Buildfile,Capfile,Cheffile,Dangerfile,Deliverfile,Fastfile,Gemfile,Gemfile.lock,Guardfile,Jarfile,KitchenSink,Mavenfile,Podfile,Puppetfile,Rakefile,Rantfile,Routefile,Snapfile,Thorfile,Vagrantfile,buildfile,vagrantfile setf ruby + au BufNewFile,BufRead *.axlsx,*.builder,*.cap,*.eye,*.fcgi,*.gemspec,*.god,*.jbuilder,*.mspec,*.opal,*.pluginspec,*.podspec,*.rabl,*.rake,*.rant,*.rb,*.rbi,*.rbuild,*.rbw,*.rbx,*.rjs,*.ru,*.ruby,*.rxml,*.spec,*.thor,*.watchr,{.,}Brewfile,{.,}Guardfile,{.,}autotest,{.,}irbrc,{.,}pryrc,{.,}simplecov,Appraisals,Berksfile,Buildfile,Capfile,Cheffile,Dangerfile,Deliverfile,Fastfile,Gemfile,Gemfile.lock,Guardfile,Jarfile,KitchenSink,Mavenfile,Podfile,Puppetfile,Rakefile,Routefile,Snapfile,Thorfile,Vagrantfile,[Rr]antfile,buildfile,vagrantfile setf ruby au BufNewFile,BufRead [Rr]akefile* call s:StarSetf('ruby') au BufNewFile,BufRead *.erb,*.erb.deface,*.rhtml setf eruby endif @@ -2012,7 +2034,7 @@ if !has_key(s:disabled_packages, 'blade') endif if !has_key(s:disabled_packages, 'php') - au BufNewFile,BufRead *.aw,*.ctp,*.fcgi,*.inc,*.php,*.php3,*.php4,*.php5,*.phps,*.phpt,*.phtml,{.,}php,{.,}php_cs,{.,}php_cs.dist,Phakefile setf php + au BufNewFile,BufRead *.aw,*.ctp,*.fcgi,*.inc,*.php,*.php3,*.php4,*.php5,*.php9,*.phps,*.phpt,*.phtml,{.,}php,{.,}php_cs,{.,}php_cs.dist,Phakefile setf php endif if !has_key(s:disabled_packages, 'cql') @@ -2333,7 +2355,7 @@ if !has_key(s:disabled_packages, 'elixir') au BufNewFile,BufRead *.eex,*.leex setf eelixir endif -if !has_key(s:disabled_packages, 'dockerfile') +if !has_key(s:disabled_packages, 'docker-compose') au BufNewFile,BufRead docker-compose*.yaml,docker-compose*.yml setf yaml.docker-compose endif diff --git a/ftplugin/context.vim b/ftplugin/context.vim new file mode 100644 index 00000000..2e68ecfc --- /dev/null +++ b/ftplugin/context.vim @@ -0,0 +1,106 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'context') == -1 + +" Vim filetype plugin file +" Language: ConTeXt typesetting engine +" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> +" Former Maintainers: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2016 Oct 30 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:cpo_save = &cpo +set cpo&vim + +if !exists('current_compiler') + compiler context +endif + +let b:undo_ftplugin = "setl com< cms< def< inc< sua< fo< ofu<" + \ . "| unlet! b:match_ignorecase b:match_words b:match_skip" + +setlocal comments=b:%D,b:%C,b:%M,:% commentstring=%\ %s formatoptions+=tjcroql2 +if get(b:, 'context_metapost', get(g:, 'context_metapost', 1)) + setlocal omnifunc=contextcomplete#Complete + let g:omni_syntax_group_include_context = 'mf\w\+,mp\w\+' + let g:omni_syntax_group_exclude_context = 'mfTodoComment' +endif + +let &l:define='\\\%([egx]\|char\|mathchar\|count\|dimen\|muskip\|skip\|toks\)\=' + \ . 'def\|\\font\|\\\%(future\)\=let' + \ . '\|\\new\%(count\|dimen\|skip\|muskip\|box\|toks\|read\|write' + \ . '\|fam\|insert\|if\)' + +let &l:include = '^\s*\\\%(input\|component\|product\|project\|environment\)' + +setlocal suffixesadd=.tex + +if exists("loaded_matchit") + let b:match_ignorecase = 0 + let b:match_skip = 'r:\\\@<!\%(\\\\\)*%' + let b:match_words = '(:),\[:],{:},\\(:\\),\\\[:\\],' . + \ '\\start\(\a\+\):\\stop\1' +endif + +let s:context_regex = { + \ 'beginsection' : '\\\%(start\)\=\%(\%(sub\)*section\|\%(sub\)*subject\|chapter\|part\|component\|product\|title\)\>', + \ 'endsection' : '\\\%(stop\)\=\%(\%(sub\)*section\|\%(sub\)*subject\|chapter\|part\|component\|product\|title\)\>', + \ 'beginblock' : '\\\%(start\|setup\|define\)', + \ 'endblock' : '\\\%(stop\|setup\|define\)' + \ } + +function! s:move_around(count, what, flags, visual) + if a:visual + exe "normal! gv" + endif + call search(s:context_regex[a:what], a:flags.'s') " 's' sets previous context mark + call map(range(2, a:count), 'search(s:context_regex[a:what], a:flags)') +endfunction + +" Move around macros. +nnoremap <silent><buffer> [[ :<C-U>call <SID>move_around(v:count1, "beginsection", "bW", v:false) <CR> +vnoremap <silent><buffer> [[ :<C-U>call <SID>move_around(v:count1, "beginsection", "bW", v:true) <CR> +nnoremap <silent><buffer> ]] :<C-U>call <SID>move_around(v:count1, "beginsection", "W", v:false) <CR> +vnoremap <silent><buffer> ]] :<C-U>call <SID>move_around(v:count1, "beginsection", "W", v:true) <CR> +nnoremap <silent><buffer> [] :<C-U>call <SID>move_around(v:count1, "endsection", "bW", v:false) <CR> +vnoremap <silent><buffer> [] :<C-U>call <SID>move_around(v:count1, "endsection", "bW", v:true) <CR> +nnoremap <silent><buffer> ][ :<C-U>call <SID>move_around(v:count1, "endsection", "W", v:false) <CR> +vnoremap <silent><buffer> ][ :<C-U>call <SID>move_around(v:count1, "endsection", "W", v:true) <CR> +nnoremap <silent><buffer> [{ :<C-U>call <SID>move_around(v:count1, "beginblock", "bW", v:false) <CR> +vnoremap <silent><buffer> [{ :<C-U>call <SID>move_around(v:count1, "beginblock", "bW", v:true) <CR> +nnoremap <silent><buffer> ]} :<C-U>call <SID>move_around(v:count1, "endblock", "W", v:false) <CR> +vnoremap <silent><buffer> ]} :<C-U>call <SID>move_around(v:count1, "endblock", "W", v:true) <CR> + +" Other useful mappings +if get(g:, 'context_mappings', 1) + let s:tp_regex = '?^$\|^\s*\\\(item\|start\|stop\|blank\|\%(sub\)*section\|chapter\|\%(sub\)*subject\|title\|part\)' + + fun! s:tp() + call cursor(search(s:tp_regex, 'bcW') + 1, 1) + normal! V + call cursor(search(s:tp_regex, 'W') - 1, 1) + endf + + " Reflow paragraphs with commands like gqtp ("gq TeX paragraph") + onoremap <silent><buffer> tp :<c-u>call <sid>tp()<cr> + " Select TeX paragraph + vnoremap <silent><buffer> tp <esc>:<c-u>call <sid>tp()<cr> + + " $...$ text object + onoremap <silent><buffer> i$ :<c-u>normal! T$vt$<cr> + onoremap <silent><buffer> a$ :<c-u>normal! F$vf$<cr> + vnoremap <buffer> i$ T$ot$ + vnoremap <buffer> a$ F$of$ +endif + +" Commands for asynchronous typesetting +command! -buffer -nargs=? -complete=file ConTeXt call context#typeset(<q-args>) +command! -nargs=0 ConTeXtJobStatus call context#job_status() +command! -nargs=0 ConTeXtStopJobs call context#stop_jobs() + +let &cpo = s:cpo_save +unlet s:cpo_save + +endif diff --git a/ftplugin/docker-compose.vim b/ftplugin/docker-compose.vim index 82896b05..e80041e2 100644 --- a/ftplugin/docker-compose.vim +++ b/ftplugin/docker-compose.vim @@ -1,4 +1,4 @@ -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dockerfile') == -1 +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'docker-compose') == -1 " Define comment string setlocal commentstring=#\ %s diff --git a/ftplugin/dockerfile.vim b/ftplugin/dockerfile.vim new file mode 100644 index 00000000..3780119a --- /dev/null +++ b/ftplugin/dockerfile.vim @@ -0,0 +1,20 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dockerfile') == -1 + +" Vim filetype plugin +" Language: Dockerfile +" Maintainer: Honza Pokorny <http://honza.ca> +" Last Change: 2014 Aug 29 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Don't load another plugin for this buffer +let b:did_ftplugin = 1 + +let b:undo_ftplugin = "setl commentstring<" + +setlocal commentstring=#\ %s + +endif diff --git a/ftplugin/man.vim b/ftplugin/man.vim new file mode 100644 index 00000000..300129c2 --- /dev/null +++ b/ftplugin/man.vim @@ -0,0 +1,254 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'man') == -1 + +" Vim filetype plugin file +" Language: man +" Maintainer: Jason Franklin <vim@justemail.net> +" Maintainer: SungHyun Nam <goweol@gmail.com> +" Last Change: 2020 Jun 01 + +" To make the ":Man" command available before editing a manual page, source +" this script from your startup vimrc file. + +" If 'filetype' isn't "man", we must have been called to only define ":Man". +if &filetype == "man" + + " Only do this when not done yet for this buffer + if exists("b:did_ftplugin") + finish + endif + let b:did_ftplugin = 1 +endif + +let s:cpo_save = &cpo +set cpo-=C + +if &filetype == "man" + " allow dot and dash in manual page name. + setlocal iskeyword+=\.,- + let b:undo_ftplugin = "setlocal iskeyword<" + + " Add mappings, unless the user didn't want this. + if !exists("no_plugin_maps") && !exists("no_man_maps") + if !hasmapto('<Plug>ManBS') + nmap <buffer> <LocalLeader>h <Plug>ManBS + let b:undo_ftplugin = b:undo_ftplugin + \ . '|silent! nunmap <buffer> <LocalLeader>h' + endif + nnoremap <buffer> <Plug>ManBS :%s/.\b//g<CR>:setl nomod<CR>'' + + nnoremap <buffer> <silent> <c-]> :call <SID>PreGetPage(v:count)<CR> + nnoremap <buffer> <silent> <c-t> :call <SID>PopPage()<CR> + nnoremap <buffer> <silent> q :q<CR> + + " Add undo commands for the maps + let b:undo_ftplugin = b:undo_ftplugin + \ . '|silent! nunmap <buffer> <Plug>ManBS' + \ . '|silent! nunmap <buffer> <c-]>' + \ . '|silent! nunmap <buffer> <c-t>' + \ . '|silent! nunmap <buffer> q' + endif + + if exists('g:ft_man_folding_enable') && (g:ft_man_folding_enable == 1) + setlocal foldmethod=indent foldnestmax=1 foldenable + let b:undo_ftplugin = b:undo_ftplugin + \ . '|silent! setl fdm< fdn< fen<' + endif + +endif + +if exists(":Man") != 2 + com -nargs=+ -complete=shellcmd Man call s:GetPage(<q-mods>, <f-args>) + nmap <Leader>K :call <SID>PreGetPage(0)<CR> + nmap <Plug>ManPreGetPage :call <SID>PreGetPage(0)<CR> +endif + +" Define functions only once. +if !exists("s:man_tag_depth") + +let s:man_tag_depth = 0 + +let s:man_sect_arg = "" +let s:man_find_arg = "-w" +try + if !has("win32") && $OSTYPE !~ 'cygwin\|linux' && system('uname -s') =~ "SunOS" && system('uname -r') =~ "^5" + let s:man_sect_arg = "-s" + let s:man_find_arg = "-l" + endif +catch /E145:/ + " Ignore the error in restricted mode +endtry + +func <SID>PreGetPage(cnt) + if a:cnt == 0 + let old_isk = &iskeyword + if &ft == 'man' + setl iskeyword+=(,) + endif + let str = expand("<cword>") + let &l:iskeyword = old_isk + let page = substitute(str, '(*\(\k\+\).*', '\1', '') + let sect = substitute(str, '\(\k\+\)(\([^()]*\)).*', '\2', '') + if match(sect, '^[0-9 ]\+$') == -1 + let sect = "" + endif + if sect == page + let sect = "" + endif + else + let sect = a:cnt + let page = expand("<cword>") + endif + call s:GetPage('', sect, page) +endfunc + +func <SID>GetCmdArg(sect, page) + if a:sect == '' + return a:page + endif + return s:man_sect_arg.' '.a:sect.' '.a:page +endfunc + +func <SID>FindPage(sect, page) + let where = system("man ".s:man_find_arg.' '.s:GetCmdArg(a:sect, a:page)) + if where !~ "^/" + if matchstr(where, " [^ ]*$") !~ "^ /" + return 0 + endif + endif + return 1 +endfunc + +func <SID>GetPage(cmdmods, ...) + if a:0 >= 2 + let sect = a:1 + let page = a:2 + elseif a:0 >= 1 + let sect = "" + let page = a:1 + else + return + endif + + " To support: nmap K :Man <cword> + if page == '<cword>' + let page = expand('<cword>') + endif + + if !exists('g:ft_man_no_sect_fallback') || (g:ft_man_no_sect_fallback == 0) + if sect != "" && s:FindPage(sect, page) == 0 + let sect = "" + endif + endif + if s:FindPage(sect, page) == 0 + let msg = 'man.vim: no manual entry for "' . page . '"' + if !empty(sect) + let msg .= ' in section ' . sect + endif + echomsg msg + return + endif + exec "let s:man_tag_buf_".s:man_tag_depth." = ".bufnr("%") + exec "let s:man_tag_lin_".s:man_tag_depth." = ".line(".") + exec "let s:man_tag_col_".s:man_tag_depth." = ".col(".") + let s:man_tag_depth = s:man_tag_depth + 1 + + let open_cmd = 'edit' + + " Use an existing "man" window if it exists, otherwise open a new one. + if &filetype != "man" + let thiswin = winnr() + exe "norm! \<C-W>b" + if winnr() > 1 + exe "norm! " . thiswin . "\<C-W>w" + while 1 + if &filetype == "man" + break + endif + exe "norm! \<C-W>w" + if thiswin == winnr() + break + endif + endwhile + endif + if &filetype != "man" + if exists("g:ft_man_open_mode") + if g:ft_man_open_mode == 'vert' + let open_cmd = 'vsplit' + elseif g:ft_man_open_mode == 'tab' + let open_cmd = 'tabedit' + else + let open_cmd = 'split' + endif + else + let open_cmd = a:cmdmods . ' split' + endif + endif + endif + + silent execute open_cmd . " $HOME/" . page . '.' . sect . '~' + + " Avoid warning for editing the dummy file twice + setl buftype=nofile noswapfile + + setl fdc=0 ma nofen nonu nornu + %delete _ + let unsetwidth = 0 + if empty($MANWIDTH) + let $MANWIDTH = winwidth(0) + let unsetwidth = 1 + endif + + " Ensure Vim is not recursively invoked (man-db does this) when doing ctrl-[ + " on a man page reference by unsetting MANPAGER. + " Some versions of env(1) do not support the '-u' option, and in such case + " we set MANPAGER=cat. + if !exists('s:env_has_u') + call system('env -u x true') + let s:env_has_u = (v:shell_error == 0) + endif + let env_cmd = s:env_has_u ? 'env -u MANPAGER' : 'env MANPAGER=cat' + let env_cmd .= ' GROFF_NO_SGR=1' + let man_cmd = env_cmd . ' man ' . s:GetCmdArg(sect, page) . ' | col -b' + silent exec "r !" . man_cmd + + if unsetwidth + let $MANWIDTH = '' + endif + " Remove blank lines from top and bottom. + while line('$') > 1 && getline(1) =~ '^\s*$' + 1delete _ + endwhile + while line('$') > 1 && getline('$') =~ '^\s*$' + $delete _ + endwhile + 1 + setl ft=man nomod + setl bufhidden=hide + setl nobuflisted + setl noma +endfunc + +func <SID>PopPage() + if s:man_tag_depth > 0 + let s:man_tag_depth = s:man_tag_depth - 1 + exec "let s:man_tag_buf=s:man_tag_buf_".s:man_tag_depth + exec "let s:man_tag_lin=s:man_tag_lin_".s:man_tag_depth + exec "let s:man_tag_col=s:man_tag_col_".s:man_tag_depth + exec s:man_tag_buf."b" + exec s:man_tag_lin + exec "norm! ".s:man_tag_col."|" + exec "unlet s:man_tag_buf_".s:man_tag_depth + exec "unlet s:man_tag_lin_".s:man_tag_depth + exec "unlet s:man_tag_col_".s:man_tag_depth + unlet s:man_tag_buf s:man_tag_lin s:man_tag_col + endif +endfunc + +endif + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: set sw=2 ts=8 noet: + +endif diff --git a/indent/context.vim b/indent/context.vim new file mode 100644 index 00000000..16ec0829 --- /dev/null +++ b/indent/context.vim @@ -0,0 +1,40 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'context') == -1 + +" ConTeXt indent file +" Language: ConTeXt typesetting engine +" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> +" Last Change: 2016 Oct 15 + +if exists("b:did_indent") + finish +endif + +if !get(b:, 'context_metapost', get(g:, 'context_metapost', 1)) + finish +endif + +" Load MetaPost indentation script +runtime! indent/mp.vim + +let s:keepcpo= &cpo +set cpo&vim + +setlocal indentexpr=GetConTeXtIndent() + +let b:undo_indent = "setl indentexpr<" + +function! GetConTeXtIndent() + " Use MetaPost rules inside MetaPost graphic environments + if len(synstack(v:lnum, 1)) > 0 && + \ synIDattr(synstack(v:lnum, 1)[0], "name") ==# 'contextMPGraphic' + return GetMetaPostIndent() + endif + return -1 +endfunc + +let &cpo = s:keepcpo +unlet s:keepcpo + +" vim:sw=2 + +endif diff --git a/packages.yaml b/packages.yaml index a58497f2..fc6a702d 100644 --- a/packages.yaml +++ b/packages.yaml @@ -498,7 +498,7 @@ filetypes: extensions: - sdl --- -name: dockerfile +name: docker-compose remote: ekalinin/Dockerfile.vim glob: '**/docker-compose.vim' filetypes: @@ -1227,6 +1227,7 @@ filetypes: linguist: PHP extra_extensions: - phtml + - php9 --- name: blade remote: jwalton512/vim-blade @@ -1417,7 +1418,7 @@ filetypes: - cap - opal extra_filenames: - - Rantfile + - '[Rr]antfile' - ".autotest" - Cheffile - KitchenSink @@ -2228,7 +2229,7 @@ glob: "**/debchangelog.vim" filetypes: - name: debchangelog patterns: - - pattern: changelog.Debian,changelog.dch,NEWS.Debian,NEWS.dch + - pattern: changelog.Debian,changelog.dch,NEWS.Debian,NEWS.dch,*/debian/changelog --- name: chill remote: vim/vim:runtime @@ -5506,3 +5507,35 @@ filetypes: - name: xf86conf patterns: - pattern: "XF86Config-4*,XF86Config*,*/xorg.conf.d/*.conf,xorg.conf,xorg.conf-4" +--- +name: man +remote: vim/vim:runtime +glob: "**/man.vim" +filetypes: +- name: man + linguist: Roff Manpage +--- +name: xpm +remote: vim/vim:runtime +glob: "**/xpm.vim" +filetypes: +- name: xpm + linguist: X PixMap +--- +name: xpm2 +remote: vim/vim:runtime +glob: "**/xpm2.vim" +filetypes: +- name: xpm2 + patterns: + - pattern: '*.xpm2' + description: X PixMap 2 +--- +name: context +remote: vim/vim:runtime +glob: "**/context.vim" +filetypes: +- name: context + patterns: + - pattern: '*.mkii,*.mkiv,*.mkvi' + description: ConTeXt diff --git a/syntax/context.vim b/syntax/context.vim new file mode 100644 index 00000000..433287df --- /dev/null +++ b/syntax/context.vim @@ -0,0 +1,145 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'context') == -1 + +" Vim syntax file +" Language: ConTeXt typesetting engine +" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> +" Former Maintainers: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2016 Oct 16 + +if exists("b:current_syntax") + finish +endif + +runtime! syntax/plaintex.vim +unlet b:current_syntax + +let s:cpo_save = &cpo +set cpo&vim + +" Dictionary of (filetype, group) pairs to highlight between \startGROUP \stopGROUP. +let s:context_include = get(b:, 'context_include', get(g:, 'context_include', {'xml': 'XML'})) + +" For backward compatibility (g:context_include used to be a List) +if type(s:context_include) ==# type([]) + let g:context_metapost = (index(s:context_include, 'mp') != -1) + let s:context_include = filter( + \ {'c': 'C', 'javascript': 'JS', 'ruby': 'Ruby', 'xml': 'XML'}, + \ { k,_ -> index(s:context_include, k) != -1 } + \ ) +endif + +syn iskeyword @,48-57,a-z,A-Z,192-255 + +syn spell toplevel + +" ConTeXt options, i.e., [...] blocks +syn region contextOptions matchgroup=contextDelimiter start='\[' end=']\|\ze\\stop' skip='\\\[\|\\\]' contains=ALLBUT,contextBeginEndLua,@Spell + +" Highlight braces +syn match contextDelimiter '[{}]' + +" Comments +syn match contextComment '\\\@<!\%(\\\\\)*\zs%.*$' display contains=initexTodo +syn match contextComment '^\s*%[CDM].*$' display contains=initexTodo + +syn match contextBlockDelim '\\\%(start\|stop\)\a\+' contains=@NoSpell + +syn region contextEscaped matchgroup=contextPreProc start='\\type\%(\s*\|\n\)*\z([^A-Za-z%]\)' end='\z1' +syn region contextEscaped matchgroup=contextPreProc start='\\type\=\%(\s\|\n\)*{' end='}' +syn region contextEscaped matchgroup=contextPreProc start='\\type\=\%(\s*\|\n\)*<<' end='>>' +syn region contextEscaped matchgroup=contextPreProc + \ start='\\start\z(\a*\%(typing\|typen\)\)' + \ end='\\stop\z1' contains=plaintexComment keepend +syn region contextEscaped matchgroup=contextPreProc start='\\\h\+Type\%(\s\|\n\)*{' end='}' +syn region contextEscaped matchgroup=contextPreProc start='\\Typed\h\+\%(\s\|\n\)*{' end='}' + +syn match contextBuiltin display contains=@NoSpell + \ '\\\%(unprotect\|protect\|unexpanded\)\>' + +syn match contextPreProc '^\s*\\\%(start\|stop\)\=\%(component\|environment\|project\|product\)\>' + \ contains=@NoSpell + +if get(b:, 'context_metapost', get(g:, 'context_metapost', 1)) + let b:mp_metafun_macros = 1 " Highlight MetaFun keywords + syn include @mpTop syntax/mp.vim + unlet b:current_syntax + + syn region contextMPGraphic matchgroup=contextBlockDelim + \ start='\\start\z(MP\%(clip\|code\|definitions\|drawing\|environment\|extensions\|inclusions\|initializations\|page\|\)\)\>.*$' + \ end='\\stop\z1' + \ contains=@mpTop,@NoSpell + syn region contextMPGraphic matchgroup=contextBlockDelim + \ start='\\start\z(\%(\%[re]usable\|use\|unique\|static\)MPgraphic\|staticMPfigure\|uniqueMPpagegraphic\)\>.*$' + \ end='\\stop\z1' + \ contains=@mpTop,@NoSpell +endif + +if get(b:, 'context_lua', get(g:, 'context_lua', 1)) + syn include @luaTop syntax/lua.vim + unlet b:current_syntax + + syn region contextLuaCode matchgroup=contextBlockDelim + \ start='\\startluacode\>' + \ end='\\stopluacode\>' keepend + \ contains=@luaTop,@NoSpell + + syn match contextDirectLua "\\\%(directlua\|ctxlua\)\>\%(\s*%.*$\)\=" + \ nextgroup=contextBeginEndLua skipwhite skipempty + \ contains=initexComment + syn region contextBeginEndLua matchgroup=contextSpecial + \ start="{" end="}" skip="\\[{}]" + \ contained contains=@luaTop,@NoSpell +endif + +for synname in keys(s:context_include) + execute 'syn include @' . synname . 'Top' 'syntax/' . synname . '.vim' + unlet b:current_syntax + execute 'syn region context' . s:context_include[synname] . 'Code' + \ 'matchgroup=contextBlockDelim' + \ 'start=+\\start' . s:context_include[synname] . '+' + \ 'end=+\\stop' . s:context_include[synname] . '+' + \ 'contains=@' . synname . 'Top,@NoSpell' +endfor + +syn match contextSectioning '\\\%(start\|stop\)\=\%(\%(sub\)*section\|\%(sub\)*subject\|chapter\|part\|component\|product\|title\)\>' + \ contains=@NoSpell + +syn match contextSpecial '\\crlf\>\|\\par\>\|-\{2,3}\||[<>/]\=|' + \ contains=@NoSpell +syn match contextSpecial /\\[`'"]/ +syn match contextSpecial +\\char\%(\d\{1,3}\|'\o\{1,3}\|"\x\{1,2}\)\>+ + \ contains=@NoSpell +syn match contextSpecial '\^\^.' +syn match contextSpecial '`\%(\\.\|\^\^.\|.\)' + +syn match contextStyle '\\\%(em\|ss\|hw\|cg\|mf\)\>' + \ contains=@NoSpell +syn match contextFont '\\\%(CAP\|Cap\|cap\|Caps\|kap\|nocap\)\>' + \ contains=@NoSpell +syn match contextFont '\\\%(Word\|WORD\|Words\|WORDS\)\>' + \ contains=@NoSpell +syn match contextFont '\\\%(vi\{1,3}\|ix\|xi\{0,2}\)\>' + \ contains=@NoSpell +syn match contextFont '\\\%(tf\|b[si]\|s[cl]\|os\)\%(xx\|[xabcd]\)\=\>' + \ contains=@NoSpell + +hi def link contextOptions Typedef +hi def link contextComment Comment +hi def link contextBlockDelim Keyword +hi def link contextBuiltin Keyword +hi def link contextDelimiter Delimiter +hi def link contextEscaped String +hi def link contextPreProc PreProc +hi def link contextSectioning PreProc +hi def link contextSpecial Special +hi def link contextType Type +hi def link contextStyle contextType +hi def link contextFont contextType +hi def link contextDirectLua Keyword + +let b:current_syntax = "context" + +let &cpo = s:cpo_save +unlet s:cpo_save + +endif diff --git a/syntax/docker-compose.vim b/syntax/docker-compose.vim index 92121065..33582ec8 100644 --- a/syntax/docker-compose.vim +++ b/syntax/docker-compose.vim @@ -1,4 +1,4 @@ -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dockerfile') == -1 +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'docker-compose') == -1 " Vim syntax file " Language: Dockerfile diff --git a/syntax/dockerfile.vim b/syntax/dockerfile.vim new file mode 100644 index 00000000..35ed34da --- /dev/null +++ b/syntax/dockerfile.vim @@ -0,0 +1,49 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dockerfile') == -1 + +" dockerfile.vim - Syntax highlighting for Dockerfiles +" Maintainer: Honza Pokorny <https://honza.ca> +" Last Change: 2020 Feb 11 +" License: BSD + +" https://docs.docker.com/engine/reference/builder/ + +if exists("b:current_syntax") + finish +endif + +syntax include @JSON syntax/json.vim +unlet b:current_syntax + +syntax include @Shell syntax/sh.vim +unlet b:current_syntax + +syntax case ignore +syntax match dockerfileLinePrefix /\v^\s*(ONBUILD\s+)?\ze\S/ contains=dockerfileKeyword nextgroup=dockerfileInstruction skipwhite +syntax region dockerfileFrom matchgroup=dockerfileKeyword start=/\v^\s*(FROM)\ze(\s|$)/ skip=/\v\\\_./ end=/\v((^|\s)AS(\s|$)|$)/ contains=dockerfileOption + +syntax keyword dockerfileKeyword contained ADD ARG CMD COPY ENTRYPOINT ENV EXPOSE HEALTHCHECK LABEL MAINTAINER ONBUILD RUN SHELL STOPSIGNAL USER VOLUME WORKDIR +syntax match dockerfileOption contained /\v(^|\s)\zs--\S+/ + +syntax match dockerfileInstruction contained /\v<(\S+)>(\s+--\S+)*/ contains=dockerfileKeyword,dockerfileOption skipwhite nextgroup=dockerfileValue +syntax match dockerfileInstruction contained /\v<(ADD|COPY)>(\s+--\S+)*/ contains=dockerfileKeyword,dockerfileOption skipwhite nextgroup=dockerfileJSON +syntax match dockerfileInstruction contained /\v<(HEALTHCHECK)>(\s+--\S+)*/ contains=dockerfileKeyword,dockerfileOption skipwhite nextgroup=dockerfileInstruction +syntax match dockerfileInstruction contained /\v<(CMD|ENTRYPOINT|RUN)>/ contains=dockerfileKeyword skipwhite nextgroup=dockerfileShell +syntax match dockerfileInstruction contained /\v<(CMD|ENTRYPOINT|RUN)>\ze\s+\[/ contains=dockerfileKeyword skipwhite nextgroup=dockerfileJSON +syntax match dockerfileInstruction contained /\v<(SHELL|VOLUME)>/ contains=dockerfileKeyword skipwhite nextgroup=dockerfileJSON + +syntax region dockerfileString contained start=/\v"/ skip=/\v\\./ end=/\v"/ +syntax region dockerfileJSON contained keepend start=/\v\[/ skip=/\v\\\_./ end=/\v$/ contains=@JSON +syntax region dockerfileShell contained keepend start=/\v/ skip=/\v\\\_./ end=/\v$/ contains=@Shell +syntax region dockerfileValue contained keepend start=/\v/ skip=/\v\\\_./ end=/\v$/ contains=dockerfileString + +syntax region dockerfileComment start=/\v^\s*#/ end=/\v$/ +set commentstring=#\ %s + +hi def link dockerfileString String +hi def link dockerfileKeyword Keyword +hi def link dockerfileComment Comment +hi def link dockerfileOption Special + +let b:current_syntax = "dockerfile" + +endif diff --git a/syntax/man.vim b/syntax/man.vim new file mode 100644 index 00000000..c607f0e4 --- /dev/null +++ b/syntax/man.vim @@ -0,0 +1,60 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'man') == -1 + +" Vim syntax file +" Language: Man page +" Maintainer: Jason Franklin <vim@justemail.net> +" Previous Maintainer: SungHyun Nam <goweol@gmail.com> +" Previous Maintainer: Gautam H. Mudunuri <gmudunur@informatica.com> +" Version Info: +" Last Change: 2020 Sep 19 + +" Additional highlighting by Johannes Tanzler <johannes.tanzler@aon.at>: +" * manSubHeading +" * manSynopsis (only for sections 2 and 3) + +" quit when a syntax file was already loaded +if exists("b:current_syntax") + finish +endif + +" Get the CTRL-H syntax to handle backspaced text +runtime! syntax/ctrlh.vim + +syn case ignore + +syn match manReference "\f\+([1-9][a-z]\=)" +syn match manSectionHeading "^\a.*$" +syn match manSubHeading "^\s\{3\}\a.*$" +syn match manOptionDesc "^\s*[+-][a-z0-9]\S*" +syn match manLongOptionDesc "^\s*--[a-z0-9-]\S*" +" syn match manHistory "^[a-z].*last change.*$" + +syn match manHeader '\%1l.*' +exe 'syn match manFooter ''\%' . line('$') . 'l.*''' + +if getline(1) =~ '^[a-zA-Z_]\+([23])' + syntax include @cCode <sfile>:p:h/c.vim + syn match manCFuncDefinition display "\<\h\w*\>\s*("me=e-1 contained + syn region manSynopsis start="^SYNOPSIS"hs=s+8 end="^\u\+\s*$"me=e-12 keepend contains=manSectionHeading,@cCode,manCFuncDefinition +endif + + +" Define the default highlighting. +" Only when an item doesn't have highlighting yet + +hi def link manHeader Title +hi def link manFooter PreProc + +hi def link manSectionHeading Statement +hi def link manOptionDesc Constant +hi def link manLongOptionDesc Constant +hi def link manReference PreProc +hi def link manSubHeading Function +hi def link manCFuncDefinition Function + + +let b:current_syntax = "man" + +" vim:ts=8 sts=2 sw=2: + +endif diff --git a/syntax/xpm.vim b/syntax/xpm.vim new file mode 100644 index 00000000..7e741cad --- /dev/null +++ b/syntax/xpm.vim @@ -0,0 +1,142 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'xpm') == -1 + +" Vim syntax file +" Language: X Pixmap +" Maintainer: Ronald Schild <rs@scutum.de> +" Last Change: 2017 Feb 01 +" Version: 5.4n.1 +" Jemma Nelson added termguicolors support + +" quit when a syntax file was already loaded +if exists("b:current_syntax") + finish +endif + +syn keyword xpmType char +syn keyword xpmStorageClass static +syn keyword xpmTodo TODO FIXME XXX contained +syn region xpmComment start="/\*" end="\*/" contains=xpmTodo +syn region xpmPixelString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@xpmColors + +if has("gui_running") || has("termguicolors") && &termguicolors + +let color = "" +let chars = "" +let colors = 0 +let cpp = 0 +let n = 0 +let i = 1 + +while i <= line("$") " scanning all lines + + let s = matchstr(getline(i), '".\{-1,}"') + if s != "" " does line contain a string? + + if n == 0 " first string is the Values string + + " get the 3rd value: colors = number of colors + let colors = substitute(s, '"\s*\d\+\s\+\d\+\s\+\(\d\+\).*"', '\1', '') + " get the 4th value: cpp = number of character per pixel + let cpp = substitute(s, '"\s*\d\+\s\+\d\+\s\+\d\+\s\+\(\d\+\).*"', '\1', '') + if cpp =~ '[^0-9]' + break " if cpp is not made of digits there must be something wrong + endif + + " Highlight the Values string as normal string (no pixel string). + " Only when there is no slash, it would terminate the pattern. + if s !~ '/' + exe 'syn match xpmValues /' . s . '/' + endif + hi link xpmValues String + + let n = 1 " n = color index + + elseif n <= colors " string is a color specification + + " get chars = <cpp> length string representing the pixels + " (first incl. the following whitespace) + let chars = substitute(s, '"\(.\{'.cpp.'}\s\).*"', '\1', '') + + " now get color, first try 'c' key if any (color visual) + let color = substitute(s, '".*\sc\s\+\(.\{-}\)\s*\(\(g4\=\|[ms]\)\s.*\)*\s*"', '\1', '') + if color == s + " no 'c' key, try 'g' key (grayscale with more than 4 levels) + let color = substitute(s, '".*\sg\s\+\(.\{-}\)\s*\(\(g4\|[ms]\)\s.*\)*\s*"', '\1', '') + if color == s + " next try: 'g4' key (4-level grayscale) + let color = substitute(s, '".*\sg4\s\+\(.\{-}\)\s*\([ms]\s.*\)*\s*"', '\1', '') + if color == s + " finally try 'm' key (mono visual) + let color = substitute(s, '".*\sm\s\+\(.\{-}\)\s*\(s\s.*\)*\s*"', '\1', '') + if color == s + let color = "" + endif + endif + endif + endif + + " Vim cannot handle RGB codes with more than 6 hex digits + if color =~ '#\x\{10,}$' + let color = substitute(color, '\(\x\x\)\x\x', '\1', 'g') + elseif color =~ '#\x\{7,}$' + let color = substitute(color, '\(\x\x\)\x', '\1', 'g') + " nor with 3 digits + elseif color =~ '#\x\{3}$' + let color = substitute(color, '\(\x\)\(\x\)\(\x\)', '0\10\20\3', '') + endif + + " escape meta characters in patterns + let s = escape(s, '/\*^$.~[]') + let chars = escape(chars, '/\*^$.~[]') + + " now create syntax items + " highlight the color string as normal string (no pixel string) + exe 'syn match xpmCol'.n.'Def /'.s.'/ contains=xpmCol'.n.'inDef' + exe 'hi link xpmCol'.n.'Def String' + + " but highlight the first whitespace after chars in its color + exe 'syn match xpmCol'.n.'inDef /"'.chars.'/hs=s+'.(cpp+1).' contained' + exe 'hi link xpmCol'.n.'inDef xpmColor'.n + + " remove the following whitespace from chars + let chars = substitute(chars, '.$', '', '') + + " and create the syntax item contained in the pixel strings + exe 'syn match xpmColor'.n.' /'.chars.'/ contained' + exe 'syn cluster xpmColors add=xpmColor'.n + + " if no color or color = "None" show background + if color == "" || substitute(color, '.*', '\L&', '') == 'none' + exe 'hi xpmColor'.n.' guifg=bg' + exe 'hi xpmColor'.n.' guibg=NONE' + elseif color !~ "'" + exe 'hi xpmColor'.n." guifg='".color."'" + exe 'hi xpmColor'.n." guibg='".color."'" + endif + let n = n + 1 + else + break " no more color string + endif + endif + let i = i + 1 +endwhile + +unlet color chars colors cpp n i s + +endif " has("gui_running") || has("termguicolors") && &termguicolors + +" Define the default highlighting. +" Only when an item doesn't have highlighting yet + +hi def link xpmType Type +hi def link xpmStorageClass StorageClass +hi def link xpmTodo Todo +hi def link xpmComment Comment +hi def link xpmPixelString String + + +let b:current_syntax = "xpm" + +" vim: ts=8:sw=3:noet: + +endif diff --git a/syntax/xpm2.vim b/syntax/xpm2.vim new file mode 100644 index 00000000..b1eebba9 --- /dev/null +++ b/syntax/xpm2.vim @@ -0,0 +1,157 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'xpm2') == -1 + +" Vim syntax file +" Language: X Pixmap v2 +" Maintainer: Steve Wall (hitched97@velnet.com) +" Last Change: 2017 Feb 01 +" (Dominique Pelle added @Spell) +" Version: 5.8 +" Jemma Nelson added termguicolors support +" +" Made from xpm.vim by Ronald Schild <rs@scutum.de> + +" quit when a syntax file was already loaded +if exists("b:current_syntax") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +syn region xpm2PixelString start="^" end="$" contains=@xpm2Colors +syn keyword xpm2Todo TODO FIXME XXX contained +syn match xpm2Comment "\!.*$" contains=@Spell,xpm2Todo + + +command -nargs=+ Hi hi def <args> + +if has("gui_running") || has("termguicolors") && &termguicolors + + let color = "" + let chars = "" + let colors = 0 + let cpp = 0 + let n = 0 + let i = 1 + + while i <= line("$") " scanning all lines + + let s = getline(i) + if match(s,"\!.*$") != -1 + let s = matchstr(s, "^[^\!]*") + endif + if s != "" " does line contain a string? + + if n == 0 " first string is the Values string + + " get the 3rd value: colors = number of colors + let colors = substitute(s, '\s*\d\+\s\+\d\+\s\+\(\d\+\).*', '\1', '') + " get the 4th value: cpp = number of character per pixel + let cpp = substitute(s, '\s*\d\+\s\+\d\+\s\+\d\+\s\+\(\d\+\).*', '\1', '') + if cpp =~ '[^0-9]' + break " if cpp is not made of digits there must be something wrong + endif + + " Highlight the Values string as normal string (no pixel string). + " Only when there is no slash, it would terminate the pattern. + if s !~ '/' + exe 'syn match xpm2Values /' . s . '/' + endif + hi def link xpm2Values Statement + + let n = 1 " n = color index + + elseif n <= colors " string is a color specification + + " get chars = <cpp> length string representing the pixels + " (first incl. the following whitespace) + let chars = substitute(s, '\(.\{'.cpp.'}\s\+\).*', '\1', '') + + " now get color, first try 'c' key if any (color visual) + let color = substitute(s, '.*\sc\s\+\(.\{-}\)\s*\(\(g4\=\|[ms]\)\s.*\)*\s*', '\1', '') + if color == s + " no 'c' key, try 'g' key (grayscale with more than 4 levels) + let color = substitute(s, '.*\sg\s\+\(.\{-}\)\s*\(\(g4\|[ms]\)\s.*\)*\s*', '\1', '') + if color == s + " next try: 'g4' key (4-level grayscale) + let color = substitute(s, '.*\sg4\s\+\(.\{-}\)\s*\([ms]\s.*\)*\s*', '\1', '') + if color == s + " finally try 'm' key (mono visual) + let color = substitute(s, '.*\sm\s\+\(.\{-}\)\s*\(s\s.*\)*\s*', '\1', '') + if color == s + let color = "" + endif + endif + endif + endif + + " Vim cannot handle RGB codes with more than 6 hex digits + if color =~ '#\x\{10,}$' + let color = substitute(color, '\(\x\x\)\x\x', '\1', 'g') + elseif color =~ '#\x\{7,}$' + let color = substitute(color, '\(\x\x\)\x', '\1', 'g') + " nor with 3 digits + elseif color =~ '#\x\{3}$' + let color = substitute(color, '\(\x\)\(\x\)\(\x\)', '0\10\20\3', '') + endif + + " escape meta characters in patterns + let s = escape(s, '/\*^$.~[]') + let chars = escape(chars, '/\*^$.~[]') + + " change whitespace to "\s\+" + let s = substitute(s, "[ \t][ \t]*", "\\\\s\\\\+", "g") + let chars = substitute(chars, "[ \t][ \t]*", "\\\\s\\\\+", "g") + + " now create syntax items + " highlight the color string as normal string (no pixel string) + exe 'syn match xpm2Col'.n.'Def /'.s.'/ contains=xpm2Col'.n.'inDef' + exe 'hi def link xpm2Col'.n.'Def Constant' + + " but highlight the first whitespace after chars in its color + exe 'syn match xpm2Col'.n.'inDef /^'.chars.'/hs=s+'.(cpp).' contained' + exe 'hi def link xpm2Col'.n.'inDef xpm2Color'.n + + " remove the following whitespace from chars + let chars = substitute(chars, '\\s\\+$', '', '') + + " and create the syntax item contained in the pixel strings + exe 'syn match xpm2Color'.n.' /'.chars.'/ contained' + exe 'syn cluster xpm2Colors add=xpm2Color'.n + + " if no color or color = "None" show background + if color == "" || substitute(color, '.*', '\L&', '') == 'none' + exe 'Hi xpm2Color'.n.' guifg=bg guibg=NONE' + elseif color !~ "'" + exe 'Hi xpm2Color'.n." guifg='".color."' guibg='".color."'" + endif + let n = n + 1 + else + break " no more color string + endif + endif + let i = i + 1 + endwhile + + unlet color chars colors cpp n i s + +endif " has("gui_running") || has("termguicolors") && &termguicolors + +" Define the default highlighting. +" Only when an item doesn't have highlighting yet +" The default highlighting. +hi def link xpm2Type Type +hi def link xpm2StorageClass StorageClass +hi def link xpm2Todo Todo +hi def link xpm2Comment Comment +hi def link xpm2PixelString String + +delcommand Hi + +let b:current_syntax = "xpm2" + +let &cpo = s:cpo_save +unlet s:cpo_save +" vim: ts=8:sw=2:noet: + +endif diff --git a/tests/filetypes.vim b/tests/filetypes.vim index 51fdb3dc..e9a88536 100644 --- a/tests/filetypes.vim +++ b/tests/filetypes.vim @@ -296,6 +296,7 @@ call TestFiletype('coco') call TestFiletype('cf') call TestFiletype('config') call TestFiletype('cuda') +call TestFiletype('dockerfile') call TestFiletype('dcd') call TestFiletype('eterm') call TestFiletype('lynx') @@ -637,6 +638,10 @@ call TestFiletype('svn') call TestFiletype('text') call TestFiletype('pullrequest') call TestFiletype('xf86conf') +call TestFiletype('man') +call TestFiletype('xpm') +call TestFiletype('xpm2') +call TestFiletype('context') " DO NOT EDIT CODE ABOVE, IT IS GENERATED WITH MAKEFILE |