pax_global_header00006660000000000000000000000064133731601530014514gustar00rootroot0000000000000052 comment=4793b074ddbfc05ed0189e19de343870611e4bdc vim-puppet-4~20181115+git4793b074/000075500000000000000000000000001337316015300160515ustar00rootroot00000000000000vim-puppet-4~20181115+git4793b074/.gitignore000064400000000000000000000000131337316015300200330ustar00rootroot00000000000000/vader.vim vim-puppet-4~20181115+git4793b074/.travis.yml000075500000000000000000000007051337316015300201670ustar00rootroot00000000000000language: vim matrix: include: # travis build-in vim version, 7.x - env: TESTVIM=vim # nightly build neovim version - env: TESTVIM=nvim install: - | set -e pushd /tmp if [ "$TESTVIM" = nvim ]; then eval "$(curl -Ss https://raw.githubusercontent.com/neovim/bot-ci/master/scripts/travis-setup.sh) nightly-x64" gem install neovim pip install --user neovim fi popd script: - test/run-tests.sh vim-puppet-4~20181115+git4793b074/LICENSE000064400000000000000000000261141337316015300170620ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright 2018 Tim Sharpe Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. vim-puppet-4~20181115+git4793b074/README.md000064400000000000000000000032611337316015300173320ustar00rootroot00000000000000vim-puppet ========== [![Build Status](https://secure.travis-ci.org/rodjek/vim-puppet.png)](http://travis-ci.org/rodjek/vim-puppet) Make vim more Puppet friendly! Provides -------- * Formatting based on the latest Puppetlabs Style Guide * Syntax highlighting compatible with puppet 4.x * Automatic => alignment * If you don't like that, add `let g:puppet_align_hashes = 0` to your vimrc. * Ctags support * Doesn't require a bloated JRE * Doesn't take minutes to open Additional useful plugins ------------------------- * [syntastic](https://github.com/scrooloose/syntastic) plugin for automatic syntax checking while in vim. * [vim-snippets](https://github.com/honza/vim-snippets) is a library of snippets for multiple languages, including Puppet. Works with both [snipmate](https://github.com/garbas/vim-snipmate) and [ultisnips](https://github.com/SirVer/ultisnips). * [Tagbar](https://github.com/majutsushi/tagbar) plugin for Ctags support. Installation ------------ If you're using [pathogen](https://github.com/tpope/vim-pathogen) to manage your vim modules (and if you're not, why aren't you), you can simply add this as a submodule in your `~/.vim/bundle/` directory. My entire home directory is a git repository, so for me it's simply a case of $ git submodule add -f git://github.com/rodjek/vim-puppet.git .vim/bundle/puppet If you're not using pathogen, you can just manually place the files in the appropriate places under `~/.vim/` Testing ------- Testing is based on vader.vim testing framework, see: https://github.com/junegunn/vader.vim . To run full test suit use `./test/run-tests.sh`, this will also download vader.vim plugin to project's folder. vim-puppet-4~20181115+git4793b074/after/000075500000000000000000000000001337316015300171525ustar00rootroot00000000000000vim-puppet-4~20181115+git4793b074/after/ftplugin/000075500000000000000000000000001337316015300210025ustar00rootroot00000000000000vim-puppet-4~20181115+git4793b074/after/ftplugin/puppet.vim000064400000000000000000000003011337316015300230260ustar00rootroot00000000000000if !exists('g:puppet_align_hashes') let g:puppet_align_hashes = 1 endif if g:puppet_align_hashes inoremap => =>:call puppet#align#AlignHashrockets()$a endif vim-puppet-4~20181115+git4793b074/after/plugin/000075500000000000000000000000001337316015300204505ustar00rootroot00000000000000vim-puppet-4~20181115+git4793b074/after/plugin/gutentags.vim000064400000000000000000000004571337316015300231740ustar00rootroot00000000000000if !exists('g:gutentags_enabled' && g:gutentags_dont_load != 0 ) finish endif call add(g:gutentags_project_info, {'type': 'puppet', 'file': 'Puppetfile'}) let s:ctags_options = puppet#ctags#OptionFile() call add(g:gutentags_ctags_extra_args, '--options=' . s:ctags_options) unlet s:ctags_options vim-puppet-4~20181115+git4793b074/autoload/000075500000000000000000000000001337316015300176615ustar00rootroot00000000000000vim-puppet-4~20181115+git4793b074/autoload/puppet/000075500000000000000000000000001337316015300211765ustar00rootroot00000000000000vim-puppet-4~20181115+git4793b074/autoload/puppet/align.vim000064400000000000000000000037521337316015300230140ustar00rootroot00000000000000function! puppet#align#IndentLevel(lnum) return indent(a:lnum) / &shiftwidth endfunction function! puppet#align#LinesInBlock(lnum) let lines = [] let indent_level = puppet#align#IndentLevel(a:lnum) let marker = a:lnum - 1 while marker >= 1 let line_text = getline(marker) let line_indent = puppet#align#IndentLevel(marker) if line_text =~? '\v\S' if line_indent < indent_level break elseif line_indent == indent_level call add(lines, marker) endif endif let marker -= 1 endwhile let marker = a:lnum while marker <= line('$') let line_text = getline(marker) let line_indent = puppet#align#IndentLevel(marker) if line_text =~? '\v\S' if line_indent < indent_level break elseif line_indent == indent_level call add(lines, marker) endif endif let marker += 1 endwhile return lines endfunction "" " Format lines with hashrocket (=>) " @param a:1 a line where function should search for first hashrocket " expression, if param is not given, line with active cursor is used function! puppet#align#AlignHashrockets(...) abort let l:lnum = get(a:, 1, line('.')) let lines_in_block = puppet#align#LinesInBlock(l:lnum) let max_left_len = 0 let indent_str = printf('%' . indent(l:lnum) . 's', '') for line_num in lines_in_block let data = matchlist(getline(line_num), '^\s*\(.\{-}\S\)\s*=>\s*\(.*\)$') if !empty(data) let max_left_len = max([max_left_len, strlen(data[1])]) endif endfor for line_num in lines_in_block let data = matchlist(getline(line_num), '^\s*\(.\{-}\S\)\s*=>\s*\(.*\)$') if !empty(data) let new_line = printf('%s%-' . max_left_len . 's => %s', indent_str, data[1], data[2]) call setline(line_num, new_line) endif endfor endfunction vim-puppet-4~20181115+git4793b074/autoload/puppet/ctags.vim000064400000000000000000000015241337316015300230160ustar00rootroot00000000000000 if !exists('s:ctags_type') let s:ctags_type = 0 endif let s:ctags_options_dir = expand(':p:h:h:h') . '/ctags/' " Return full path to option file for ctags application function! puppet#ctags#OptionFile() if puppet#ctags#Type() == 'universal' let l:ctags_options = 'puppet_u.ctags' else let l:ctags_options = 'puppet.ctags' endif return s:ctags_options_dir . l:ctags_options endfunction " Return type of installed ctags application, " can be 'universal' or 'exuberant' function! puppet#ctags#Type() if !s:ctags_type let l:version = system('ctags --version') if l:version =~ 'Universal Ctags' let s:ctags_type = 'universal' elseif l:version =~ 'Exuberant Ctags' let s:ctags_type = 'exuberant' else echoerr 'Unknown version of Ctags' endif endif return s:ctags_type endfunction vim-puppet-4~20181115+git4793b074/autoload/puppet/format.vim000064400000000000000000000033641337316015300232110ustar00rootroot00000000000000" " Simple format using puppet's l:indents and align hashrockets function function! puppet#format#Format() abort let l:start_lnum = v:lnum let l:end_lnum = v:lnum + v:count - 1 call puppet#format#Indention(l:start_lnum, l:end_lnum) call puppet#format#Hashrocket(l:start_lnum, l:end_lnum) call puppet#format#Fallback(l:start_lnum, l:end_lnum) endfunction "" " Format hashrockets expressions in every line in range start_lnum and " end_lnum, both ends included " " TODO way of using AlignHashrockets function is ineffective, because it " formats same lines again and again, find better way to do it function! puppet#format#Hashrocket(start_lnum, end_lnum) abort let l:lnum = a:start_lnum while l:lnum <= a:end_lnum call puppet#align#AlignHashrockets(l:lnum) let l:lnum += 1 endwhile endfunction "" " Format indention in every line in range start_lnum and end_lnum, both ends " included " function! puppet#format#Indention(start_lnum, end_lnum) abort execute 'normal! ' . a:start_lnum . 'gg=' . a:end_lnum . 'gg' endfunction "" " Use internal vim default autoformat method for every line in range, only " lines which exeed &widthline are formated " function! puppet#format#Fallback(start_lnum, end_lnum) abort " I'm using it to check if autoformat expand range let l:eof_lnum = line('$') let l:lnum = a:start_lnum let l:end_lnum = a:end_lnum while l:lnum <= l:end_lnum if strlen(getline(l:lnum)) > &textwidth call cursor(l:lnum) execute 'normal! gww' " Checking if autoformat expand number of lines if yes, I will extend " range too if l:eof_lnum < line('$') let l:end_lnum += line('$') - l:eof_lnum let l:eof_lnum = line('$') endif endif let l:lnum += 1 endwhile endfunction vim-puppet-4~20181115+git4793b074/ctags/000075500000000000000000000000001337316015300171525ustar00rootroot00000000000000vim-puppet-4~20181115+git4793b074/ctags/puppet.ctags000064400000000000000000000016121337316015300215120ustar00rootroot00000000000000--langdef=puppet --langmap=puppet:.pp --regex-puppet=/^[[:space:]]*class[[:space:]]*([a-z][a-zA-Z0-9_:\-]+)/\1/c,class/ --regex-puppet=/^[[:space:]]*site[[:space:]]*([a-zA-Z0-9_\-]+)/\1/s,site/ --regex-puppet=/^[[:space:]]*node[[:space:]]*[\'|\"]*([a-zA-Z0-9_\.\-]+)[\'|\"]*/\1/n,node/ --regex-puppet=/^[[:space:]]*define[[:space:]]*([a-z][a-zA-Z0-9_:\-]+)/\1/d,definition/ --regex-puppet=/^[[:space:]]*(include|require)[[:space:]]*([a-zA-Z0-9_:]+)/\1 \2/i,include/ --regex-puppet=/^[[:space:]]*([\$][a-zA-Z0-9_:]+)[[:space:]]*=/\1/v,variable/ --regex-puppet=/^[[:space:]]*[~|\-]?>?[[:space:]]*([a-z][a-zA-Z0-9_:]+)[[:space:]]*\{ *(.*):/\1[\2]/r,resource/ --regex-puppet=/([A-Z][a-zA-Z0-9_:]+)[[:space:]]*\{/\1/f,default/ --regex-puppet=/^[[:space:]]*type[[:space:]]*([A-Z][a-zA-Z0-9_:]*)[[:space:]]*=/\1/t,type/ --regex-puppet=/^[[:space:]]*function[[:space:]]*([a-zA-Z0-9_:]*)[[:space:]]*/\1/u,function/ vim-puppet-4~20181115+git4793b074/ctags/puppet_u.ctags000064400000000000000000000020371337316015300220400ustar00rootroot00000000000000--langdef=puppet --map-puppet=+.pp --regex-puppet=/^[[:space:]]*node[[:space:]]*[\'|\"]*([a-zA-Z0-9_\.\-]+)[\'|\"]*/\1/n,node/{scope=set} --regex-puppet=/^[[:space:]]*class[[:space:]]*([a-z][a-zA-Z0-9_:\-]+)[[:space:]]*\{*/\1/c,class,classes/{scope=set} --regex-puppet=/^[[:space:]]*define[[:space:]]*([a-z][a-zA-Z0-9_:\-]+)/\1/d,definition/{scope=set} --regex-puppet=/^[[:space:]]*(include|require)[[:space:]]*([a-zA-Z0-9_:]+)/\1 \2/i,include,includes/{scope=ref} --regex-puppet=/^[[:space:]]*[~|\-]?>?[[:space:]]*([a-z][a-zA-Z0-9_:]+)[[:space:]]*\{[[:space:]]*(.*):/\1[\2]/r,resource/{scope=ref} --regex-puppet=/^[[:space:]]*([\$][a-zA-Z0-9_:]+)[[:space:]]*=/\1/v,variable/{scope=ref} --regex-puppet=/([A-Z][a-zA-Z0-9_:]+)[[:space:]]*\{/\1/f,default/ --regex-puppet=/^[[:space:]]*site[[:space:]]*([a-zA-Z0-9_\-]+)/\1/s,site/ --regex-puppet=/^[[:space:]]*type[[:space:]]*([A-Z][a-zA-Z0-9_:]*)[[:space:]]*=/\1/t,type/ --regex-puppet=/^[[:space:]]*function[[:space:]]*([a-zA-Z0-9_:]*)[[:space:]]*/\1/u,function/ vim-puppet-4~20181115+git4793b074/ftdetect/000075500000000000000000000000001337316015300176535ustar00rootroot00000000000000vim-puppet-4~20181115+git4793b074/ftdetect/puppet.vim000064400000000000000000000001421337316015300217020ustar00rootroot00000000000000au! BufRead,BufNewFile *.pp setfiletype puppet au! BufRead,BufNewFile Puppetfile setfiletype ruby vim-puppet-4~20181115+git4793b074/ftplugin/000075500000000000000000000000001337316015300177015ustar00rootroot00000000000000vim-puppet-4~20181115+git4793b074/ftplugin/puppet.vim000064400000000000000000000002111337316015300217250ustar00rootroot00000000000000setl ts=2 setl sts=2 setl sw=2 setl et setl keywordprg=puppet\ describe\ --providers setl iskeyword=-,:,@,48-57,_,192-255 setl cms=#\ %s vim-puppet-4~20181115+git4793b074/ftplugin/puppet_tagbar.vim000064400000000000000000000016711337316015300232600ustar00rootroot00000000000000" Puppet set up for Tagbar plugin " (https://github.com/majutsushi/tagbar). if !exists(':Tagbar') finish endif let g:tagbar_type_puppet = { \ 'ctagstype': 'puppet', \ 'kinds': [ \ 'c:Classes', \ 's:Sites', \ 'n:Nodes', \ 'v:Variables', \ 'i:Includes', \ 'd:Definitions', \ 'r:Resources', \ 'f:Defaults', \ 't:Types', \ 'u:Functions', \], \} if puppet#ctags#Type() == 'universal' " There no sense to split objects by colon let g:tagbar_type_puppet.sro = '__' let g:tagbar_type_puppet.kind2scope = { \ 'd': 'definition', \ 'c': 'class', \ 'r': 'resource', \ 'i': 'include', \ 'v': 'variable', \} let g:tagbar_type_puppet.scope2kind = { \ 'definition' : 'd', \ 'class' : 'c', \ 'resource' : 'r', \ 'include' : 'i', \ 'variable' : 'v', \} endif let g:tagbar_type_puppet.deffile = puppet#ctags#OptionFile() vim-puppet-4~20181115+git4793b074/indent/000075500000000000000000000000001337316015300173325ustar00rootroot00000000000000vim-puppet-4~20181115+git4793b074/indent/puppet.vim000064400000000000000000000043031337316015300213640ustar00rootroot00000000000000" Vim indent file " Language: Puppet " Maintainer: Todd Zullinger " Last Change: 2009 Aug 19 " vim: set sw=4 sts=4: if exists("b:did_indent") finish endif let b:did_indent = 1 setlocal autoindent smartindent setlocal indentexpr=GetPuppetIndent() setlocal indentkeys+=0],0) setlocal formatexpr=puppet#format#Format() if exists("*GetPuppetIndent") finish endif " Check if a line is part of an include 'block', e.g.: " include foo, " bar, " baz function! s:PartOfInclude(lnum) let lnum = a:lnum while lnum let lnum = lnum - 1 let line = getline(lnum) if line !~ ',$' break endif if line =~ '^\s*include\s\+[^,]\+,$' return 1 endif endwhile return 0 endfunction function! s:OpenBrace(lnum) call cursor(a:lnum, 1) return searchpair('{\|\[\|(', '', '}\|\]\|)', 'nbW') endfunction "" " Get indent number for line, line can be given as params, otherwise function " use line where cursor is " @param a:1 (optional) line number in current buffer " @return integer function! GetPuppetIndent(...) let l:lnum = get(a:, 1, v:lnum) let pnum = prevnonblank(l:lnum - 1) if pnum == 0 return 0 endif let line = getline(l:lnum) let pline = getline(pnum) let ind = indent(pnum) if pline =~ '^\s*#' return ind endif if pline =~ '\({\|\[\|(\|:\)\s*\(#.*\)\?$' let ind += &sw elseif pline =~ ';$' && pline !~ '[^:]\+:.*[=+]>.*' let ind -= &sw elseif pline =~ '^\s*include\s\+.*,$' let ind += &sw endif if pline !~ ',$' && s:PartOfInclude(pnum) let ind -= &sw endif " Match } }, }; ] ]: ], ]; ) if line =~ '^\s*\(}\(,\|;\)\?$\|]:\|],\|}]\|];\?$\|)\)' let ind = indent(s:OpenBrace(v:lnum)) endif " Don't actually shift over for } else { if line =~ '^\s*}\s*els\(e\|if\).*{\s*$' let ind -= &sw endif " Don't indent resources that are one after another with a ->(ordering arrow) " file {'somefile': " ... " } -> " " package { 'mycoolpackage': " ... " } if line =~ '->$' let ind -= &sw endif return ind endfunction vim-puppet-4~20181115+git4793b074/syntax/000075500000000000000000000000001337316015300173775ustar00rootroot00000000000000vim-puppet-4~20181115+git4793b074/syntax/puppet.vim000064400000000000000000000215171337316015300214370ustar00rootroot00000000000000" puppet syntax file " Filename: puppet.vim " Language: puppet configuration file " Maintainer: Luke Kanies " URL: " Last Change: " Version: " " Copied from the cfengine, ruby, and perl syntax files " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded if version < 600 syntax clear elseif exists("b:current_syntax") finish endif " match class/definition/node declarations syn region puppetDefine start="^\s*\(class\|define\|node\)\s" end="{" contains=puppetDefType,puppetDefName,puppetDefArguments,puppetNodeRe,@NoSpell syn keyword puppetDefType class define node inherits contained syn region puppetDefArguments start="(" end=")" contained contains=puppetType,puppetArgument,puppetString,puppetComment,puppetMultilineComment syn match puppetArgument "\w\+" contained syn match puppetArgument "\$\w\+" contained syn match puppetArgument "'[^']+'" contained syn match puppetArgument '"[^"]+"' contained syn keyword puppetType Any Array Boolean Callable Catalogentry Collection Data Default Enum Float Hash Integer Numeric Optional Pattern Regexp Scalar String Struct Tuple Type Undef Variant syn match puppetDefName "\w\+" contained syn match puppetNodeRe "/.*/" contained " match 'foo' in 'class foo { ...' " match 'foo::bar' in 'class foo::bar { ...' " match 'Foo::Bar' in 'Foo::Bar["..."] "FIXME: "Foo-bar" doesn't get highlighted as expected, although "foo-bar" does. syn match puppetInstance "[A-Za-z0-9_-]\+\(::[A-Za-z0-9_-]\+\)*\s*{" contains=puppetTypeName,puppetTypeDefault,@NoSpell syn match puppetInstance "[A-Z][a-z_-]\+\(::[A-Z][a-z_-]\+\)*\s*[[{]" contains=puppetTypeName,puppetTypeDefault,@NoSpell syn match puppetInstance "[A-Z][a-z_-]\+\(::[A-Z][a-z_-]\+\)*\s*<\?<|" contains=puppetTypeName,puppetTypeDefault,@NoSpell syn match puppetTypeName "[a-z]\w*" contained syn match puppetTypeDefault "[A-Z]\w*" contained syn match puppetParam "\w\+\s*\(=\|+\)>" contains=puppetTypeRArrow,puppetParamName syn match puppetParamRArrow "\(=\|+\)>" contained syn match puppetParamName "\w\+" contained contains=@NoSpell syn match puppetVariable "$\(\(\(::\)\?\w\+\)\+\|{\(\(::\)\?\w\+\)\+}\)" syn match puppetParen "(" syn match puppetParen ")" syn match puppetBrace "{" syn match puppetBrace "}" syn match puppetBrack "\[" syn match puppetBrack "\]" syn match puppetBrack "<|" syn match puppetBrack "|>" " match 'present' in 'ensure => present' " match '2755' in 'mode => 2755' " don't match 'bar' in 'foo => bar' syn match puppetParam "\w\+\s*[=+]>\s*[a-z0-9]\+" contains=puppetParamString,puppetParamName syn match puppetParamString "[=+]>\s*\w\+" contains=puppetParamKeyword,puppetParamSpecial,puppetParamDigits contained syn keyword puppetParamKeyword present absent purged latest installed running stopped mounted unmounted role configured file directory link on_failure contained syn keyword puppetParamSpecial true false undef contained syn match puppetParamDigits "[0-9]\+" " match 'template' in 'content => template("...")' syn match puppetParam "\w\+\s*[=+]>\s*\w\+\s*(" contains=puppetFunction,puppetParamName " statements syn region puppetFunction start="^\s*\(alert\|crit\|debug\|emerg\|err\|fail\|include\|info\|notice\|realize\|require\|search\|tag\|warning\)\s*(" end=")" contained contains=puppetString " rvalues syn region puppetFunction start="^\s*\(defined\|file\|fqdn_rand\|generate\|inline_template\|regsubst\|sha1\|shellquote\|split\|sprintf\|tagged\|template\|versioncmp\)\s*(" end=")" contained contains=puppetString syn match puppetVariable "$[a-zA-Z0-9_:]\+" contains=@NoSpell syn match puppetVariable "${[a-zA-Z0-9_:'\[\]]\+}" contains=@NoSpell " match anything between simple/double quotes. " don't match variables if preceded by a backslash. syn region puppetString start=+'+ skip=+\\\\\|\\'+ end=+'+ syn region puppetString start=+@(\z\([^/)]*\)\(/[\\nts$uL]*\)\?)$+ end=+|-\? *\z1 *$+ syn region puppetString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=puppetVariable,puppetNotVariable syn region puppetString start=+@("\z\([^/)]*\)"\(/[\\nts$uL]*\)\?)$+ end=+|-\? *\z1 *$+ contains=puppetVariable,puppetNotVariable syn match puppetNotVariable "\\$\w\+" contained syn match puppetNotVariable "\\${\w\+}" contained " match keywords and control words except when used as a parameter syn match puppetKeyword "\(\\|\\|\\|\\|\\)\(\s*=>\)\@!" syn match puppetControl "\(\\|\\|\\|\\|\\|\\)\(\s*=>\)\@!" syn keyword puppetSpecial true false undef syn match puppetClass "[A-Za-z0-9_-]\+\(::[A-Za-z0-9_-]\+\)\+" contains=@NoSpell " Match the Regular Expression type " XXX: Puppet does not currently support a few features available in the " full Ruby Regexp class, namely, interpolation, lookbehind and named " sub-expressions. Matches for these features are included in the " commented-out versions of puppetRegexParen and puppetRegexSubName, " plus the supporting groups puppetRegexAngBrack and puppetRegexTick. syn region puppetRegex start="/" skip="\\/" end="/" contains=puppetRegexParen,puppetRegexBrace,puppetRegexOrpuppetRegexBrack,puppetRegexComment syn match puppetRegexParen "(\(?\([imx]\{0,4}:\|[=!]\)\)\?" contains=puppetRegexSpecChar,puppetRegexSubName contained "syn match puppetRegexParen "(\(?\([imxo]\{0,4}:\|['<][[:alnum:]]\+[>']\|" contained "syn match puppetRegexTick +'+ contained syn match puppetRegexOr "|" contained "syn match puppetRegexSubName "['<][[:alnum:]]\+[>']" contains=puppetRegexAngBrack,puppetRegexTick contained syn match puppetRegexSpecialChar "[?:imx]\|\(= 508 || !exists("did_puppet_syn_inits") if version < 508 let did_puppet_syn_inits = 1 command -nargs=+ HiLink hi link else command -nargs=+ HiLink hi def link endif HiLink puppetVariable Identifier HiLink puppetType Type HiLink puppetKeyword Keyword HiLink puppetComment Comment HiLink puppetMultilineComment Comment HiLink puppetString String HiLink puppetRegex Constant HiLink puppetRegexParen Delimiter HiLink puppetRegexBrace Delimiter HiLink puppetRegexBrack Delimiter HiLink puppetRegexAngBrack Delimiter HiLink puppetRegexTick Delimiter HiLink puppetRegexOr Delimiter HiLink puppetRegexSubName Identifier HiLink puppetRegexSpecChar SpecialChar HiLink puppetRegexComment Comment HiLink puppetParamKeyword Keyword HiLink puppetParamDigits String HiLink puppetNotVariable String HiLink puppetParamSpecial Boolean HiLink puppetSpecial Special HiLink puppetTodo Todo HiLink puppetBrack Delimiter HiLink puppetTypeBrack Delimiter HiLink puppetBrace Delimiter HiLink puppetTypeBrace Delimiter HiLink puppetParen Delimiter HiLink puppetDelimiter Delimiter HiLink puppetControl Statement HiLink puppetDefType Define HiLink puppetDefName Type HiLink puppetNodeRe Type HiLink puppetTypeName Statement HiLink puppetTypeDefault Type HiLink puppetParamName Identifier HiLink puppetArgument Identifier HiLink puppetFunction Function HiLink puppetClass Include delcommand HiLink endif let b:current_syntax = "puppet" vim-puppet-4~20181115+git4793b074/test/000075500000000000000000000000001337316015300170305ustar00rootroot00000000000000vim-puppet-4~20181115+git4793b074/test/format/000075500000000000000000000000001337316015300203205ustar00rootroot00000000000000vim-puppet-4~20181115+git4793b074/test/format/hashrocket.vader000064400000000000000000000013321337316015300234750ustar00rootroot00000000000000Given puppet (simple resource with autoformat while writing): file { 'foo': ensure => present, } Do (format resource): joforce=>true, Expect (formated resource): file { 'foo': ensure => present, force => true, } ------------------------------------------------------------------------------- Given puppet (simple resource with gq): # Long comment 123456789 123456789 123456789 123456789 123456789 123456789 123456789 file { 'foo': ensure => present, force => true, } Do (format resource): gqG Expect (formated resource): # Long comment 123456789 123456789 123456789 123456789 123456789 123456789 # 123456789 file { 'foo': ensure => present, force => true, } vim-puppet-4~20181115+git4793b074/test/indent/000075500000000000000000000000001337316015300203115ustar00rootroot00000000000000vim-puppet-4~20181115+git4793b074/test/indent/basic.vader000064400000000000000000000020251337316015300224140ustar00rootroot00000000000000Given puppet (class with includes): class foo::boo { include foo::moo include foo::moo::boo } Do (full text indent with '='): gg=G Expect puppet (indented class): class foo::boo { include foo::moo include foo::moo::boo } ------------------------------------------------------------------------------- Given puppet (class with includes): class foo::boo { include foo::moo include foo::moo::boo } Do (full text indent with 'gq' in Visual Mode): VGgq Expect puppet (indented class): class foo::boo { include foo::moo include foo::moo::boo } ------------------------------------------------------------------------------- Given puppet (class with includes and resources): class foo::boo { file { 'boo': ensure => present, } include foo::moo include foo::moo::boo } Do (full text indent by gq with motion): jgqi{ Expect puppet (indented class): class foo::boo { file { 'boo': ensure => present, } include foo::moo include foo::moo::boo } vim-puppet-4~20181115+git4793b074/test/init.vim000064400000000000000000000002371337316015300205120ustar00rootroot00000000000000" minimum vim configuration for test runner set nocompatible filetype off set rtp+=vader.vim set rtp+=. set rtp+=after filetype plugin indent on syntax enable vim-puppet-4~20181115+git4793b074/test/run-tests.sh000075500000000000000000000021041337316015300213300ustar00rootroot00000000000000#!/bin/bash # # Download dependencies for tests and run full test suit # Can use TESTVIM env variable to choose between vim and nvim (neovim) # Optional first script argument can be path to vader file (run only one suite) # set -x TEST_FILE=$1 SCRIPT_FOLDER=$(dirname "$(readlink -f "$0")") # TESTVIM env variable has precedence over installed programs # next in row is neovim and last one is vim if [ "$TESTVIM" == "vim" ]; then RUNVIM=vim elif [ "$TESTVIM" == "nvim" ] || [ -x "$(command -v nvim)" ]; then RUNVIM=nvim export VADER_OUTPUT_FILE=$(mktemp) trap "rm -f ${VADER_OUTPUT_FILE}" EXIT INT QUIT TERM elif [ -x "$(command -v vim)" ]; then RUNVIM=vim else echo 'Error: vim is not installed.' >&2 exit 1 fi cd "${SCRIPT_FOLDER}/.." if [ ! -d "vader.vim" ]; then git clone https://github.com/junegunn/vader.vim.git fi if [ -z $TEST_FILE ]; then TEST_SUITE='test/**/*.vader' else TEST_SUITE=$TEST_FILE fi "${RUNVIM}" -u test/init.vim -c "Vader! ${TEST_SUITE}" > /dev/null vader_exit=$? [ -n "${VADER_OUTPUT_FILE}" ] && cat "${VADER_OUTPUT_FILE}" exit $vader_exit vim-puppet-4~20181115+git4793b074/test/syntax/000075500000000000000000000000001337316015300203565ustar00rootroot00000000000000vim-puppet-4~20181115+git4793b074/test/syntax/variable.vader000064400000000000000000000014001337316015300231610ustar00rootroot00000000000000Given puppet (local variables): $foo $f Execute (syntax is good): AssertEqual SyntaxAt(1,2), 'puppetVariable' AssertEqual SyntaxAt(2,2), 'puppetVariable' ------------------------------------------------------------------------------- Given puppet (global scope variables): $::foo $::f Execute (syntax is good): AssertEqual SyntaxAt(1,2), 'puppetVariable' AssertEqual SyntaxAt(2,2), 'puppetVariable' ------------------------------------------------------------------------------- Given puppet (out of scope qualified name variables): $foo::boo::moo $::foo::boo::moo $::f00_::b_OO Execute (syntax is good): AssertEqual SyntaxAt(1,2), 'puppetVariable' AssertEqual SyntaxAt(2,2), 'puppetVariable' AssertEqual SyntaxAt(3,2), 'puppetVariable' vim-puppet-4~20181115+git4793b074/test/syntax/variable_in_string.vader000064400000000000000000000021761337316015300252500ustar00rootroot00000000000000Given puppet (top scope variable): $foo = "foo${::bar}baz" Execute (syntax is good): AssertEqual SyntaxAt(1,8), 'puppetString' AssertEqual SyntaxAt(1,12), 'puppetVariable' AssertEqual SyntaxAt(1,20), 'puppetString' ------------------------------------------------------------------------------- Given puppet (local variable): $foo = "foo${bar}baz" Execute (syntax is good): AssertEqual SyntaxAt(1,8), 'puppetString' AssertEqual SyntaxAt(1,12), 'puppetVariable' AssertEqual SyntaxAt(1,18), 'puppetString' ------------------------------------------------------------------------------- Given puppet (unenclosed local variable): $foo = "foo$bar baz" Execute (syntax is good): AssertEqual SyntaxAt(1,8), 'puppetString' AssertEqual SyntaxAt(1,12), 'puppetVariable' AssertEqual SyntaxAt(1,16), 'puppetString' ------------------------------------------------------------------------------- Given puppet (unenclosed top scope variable): $foo = "foo$::bar-baz" Execute (syntax is good): AssertEqual SyntaxAt(1,8), 'puppetString' AssertEqual SyntaxAt(1,12), 'puppetVariable' AssertEqual SyntaxAt(1,18), 'puppetString'