├── .editorconfig ├── .gitignore ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── doc └── packer.txt ├── plugin └── packer.vim ├── update_automagic.sh └── update_commands.rb /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [*.md] 11 | trim_trailing_whitespace = false 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /doc/tags 2 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # vim-packer CHANGELOG 2 | 3 | ## Version 1.0.0 (December 10, 2014) 4 | 5 | - Initial release 6 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Code of Conduct 2 | 3 | As contributors and maintainers of this project, and in the interest of 4 | fostering an open and welcoming community, we pledge to respect all people who 5 | contribute through reporting issues, posting feature requests, updating 6 | documentation, submitting pull requests or patches, and other activities. 7 | 8 | We are committed to making participation in this project a harassment-free 9 | experience for everyone, regardless of level of experience, gender, gender 10 | identity and expression, sexual orientation, disability, personal appearance, 11 | body size, race, ethnicity, age, religion, or nationality. 12 | 13 | Examples of unacceptable behavior by participants include: 14 | 15 | - The use of sexualized language or imagery 16 | 17 | - Personal attacks 18 | 19 | - Trolling or insulting/derogatory comments 20 | 21 | - Public or private harassment 22 | 23 | - Publishing other's private information, such as physical or electronic 24 | addresses, without explicit permission 25 | 26 | - Other unethical or unprofessional conduct. 27 | 28 | Project maintainers have the right and responsibility to remove, edit, or reject 29 | comments, commits, code, wiki edits, issues, and other contributions that are 30 | not aligned to this Code of Conduct. By adopting this Code of Conduct, project 31 | maintainers commit themselves to fairly and consistently applying these 32 | principles to every aspect of managing this project. Project maintainers who do 33 | not follow or enforce the Code of Conduct may be permanently removed from the 34 | project team. 35 | 36 | This code of conduct applies both within project spaces and in public spaces 37 | when an individual is representing the project or its community. 38 | 39 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 40 | reported by opening an issue or contacting one or more of the project 41 | maintainers. 42 | 43 | This Code of Conduct is adapted from the [Contributor 44 | Covenant](http://contributor-covenant.org), version 1.2.0, available at 45 | 46 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing To My Vim Plugins 2 | 3 | I'm not a Vim wizard by any means, nor am I too proud to accept 4 | contributions that improve my code, so if you think you have a problem, 5 | improvement, or other contribution towards the betterment of Vim-kind, 6 | please file an issue or, where appropriate, a pull request. 7 | 8 | Before filing an issue, please read this article by my friends and 9 | former colleagues at Viget: 10 | 11 | 12 | 13 | Keep in mind that I'm not paid to write Vim plugins, so I'm doing this 14 | in my spare time, which means it might take me a while to respond. If 15 | you're not satisfied with my response to your problem with my free (as 16 | in beer and in speech) software, I will give you triple your $0.00 back. 17 | 18 | When filing a pull request, please explain what you're changing and why. 19 | Please limit your changes to the specific thing you're fixing; it's 20 | probably easiest for both of us if you isolate your change in a topic 21 | branch that I can merge without pulling in other stuff. Please do not 22 | update CHANGELOG, versions, etc.; I'll take care of that. I'll also add 23 | you to the Credits list with my thanks. 24 | 25 | All of my Vim plugins use the ISC license. If you submit a pull request, 26 | I'll assume you are OK with any code you add being placed under that 27 | same ISC license. If this is not the case for any reason, please let me 28 | know why you can't tolerate the ISC license. I am 99.99% likely to 29 | reject your change in that case, but I'll let you have your say. 30 | 31 | This project is intended to be a safe, welcoming space for collaboration, and 32 | contributors are expected to adhere to the [Contributor 33 | Covenant](http://contributor-covenant.org) code of conduct. 34 | 35 | Thanks for contributing! 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014-2015 Mark Cornick 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any purpose 4 | with or without fee is hereby granted, provided that the above copyright notice 5 | and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED 'AS IS' AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 8 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 9 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 10 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 11 | OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 12 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 13 | THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![](https://img.shields.io/badge/Supports%20Packer%20Version-1.3.2-blue.svg)](https://github.com/hashicorp/packer/blob/v1.3.2/CHANGELOG.md) 2 | 3 | # Call For Maintainers 4 | 5 | This plugin, along with others like it, is now maintained by the 6 | [HashiVim](http://hashivim.github.io/) organization, which is looking for 7 | additional maintainers and contributors. See the HashiVim home page for 8 | further information. 9 | 10 | # vim-packer 11 | 12 | This plugin adds a `:Packer` command that runs packer, with tab 13 | completion of subcommands. 14 | 15 | ## Installation 16 | 17 | With [pathogen.vim](https://github.com/tpope/vim-pathogen) just do: 18 | 19 | cd ~/.vim/bundle 20 | git clone https://github.com/hashivim/vim-packer.git 21 | 22 | If you prefer to use something besides pathogen, go ahead. 23 | 24 | ## Credits 25 | 26 | Originally written by Mark Cornick by adapting my 27 | prior [vim-vagrant](https://github.com/hashivim/vagrant) plugin. Licensed under 28 | the ISC license. 29 | 30 | This project is intended to be a safe, welcoming space for collaboration, and 31 | contributors are expected to adhere to the [Contributor 32 | Covenant](http://contributor-covenant.org) code of conduct. 33 | -------------------------------------------------------------------------------- /doc/packer.txt: -------------------------------------------------------------------------------- 1 | *packer.txt* basic vim/packer integration 2 | 3 | Author: HashiVim 4 | License: ISC license 5 | Repo: https://github.com/hashivim/vim-packer 6 | 7 | COMMANDS *packer* 8 | 9 | This command is only available if packer is in your PATH. 10 | 11 | *packer-:packer* 12 | :Packer [args] Invoke an arbitrary packer command. 13 | 14 | vim:tw=78:et:ft=help:norl: 15 | -------------------------------------------------------------------------------- /plugin/packer.vim: -------------------------------------------------------------------------------- 1 | " packer.vim - basic vim/packer integration 2 | " Maintainer: HashiVim 3 | 4 | if exists("g:loaded_packer") || v:version < 700 || &cp || !executable('packer') 5 | finish 6 | endif 7 | let g:loaded_packer = 1 8 | 9 | function! s:commands(A, L, P) 10 | return join([ 11 | \ "build", 12 | \ "fix", 13 | \ "inspect", 14 | \ "validate", 15 | \ "version" 16 | \ ], "\n") 17 | endfunction 18 | 19 | augroup packer 20 | autocmd! 21 | autocmd VimEnter * 22 | \ command! -nargs=+ -complete=custom,s:commands Packer execute '!packer '. 23 | augroup END 24 | 25 | " vim:set et sw=2: 26 | -------------------------------------------------------------------------------- /update_automagic.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | VERSION=$1 3 | 4 | function usage { 5 | echo -e " 6 | USAGE EXAMPLES: 7 | 8 | ./$(basename $0) 0.8.7 9 | ./$(basename $0) 0.9.2 10 | " 11 | } 12 | 13 | if [ $# -ne 1 ]; then 14 | usage 15 | exit 1 16 | fi 17 | 18 | EXISTING_PACKER_VERSION=$(packer version | head -n1 | awk '{print $2}' | sed 's/v//g') 19 | 20 | if [ "${EXISTING_PACKER_VERSION}" != "${VERSION}" ]; then 21 | echo "-) You are trying to update this script for packer ${VERSION} while you have" 22 | echo " packer ${EXISTING_PACKER_VERSION} installed at $(which packer)." 23 | echo " Please update your local packer before using this script." 24 | exit 1 25 | fi 26 | 27 | echo "+) Acquiring packer-${VERSION}" 28 | wget https://github.com/mitchellh/packer/archive/v${VERSION}.tar.gz 29 | 30 | echo "+) Extracting packer-${VERSION}.tar.gz" 31 | tar zxf v${VERSION}.tar.gz 32 | 33 | echo "+) Running update_commands.rb" 34 | ./update_commands.rb 35 | 36 | echo "+) Updating the badge in the README.md" 37 | sed -i "/img.shields.io/c\[\![](https://img.shields.io/badge/Supports%20Packer%20Version-${VERSION}-blue.svg)](https://github.com/hashicorp/packer/blob/v${VERSION}/CHANGELOG.md)" README.md 38 | 39 | echo "+) Cleaning up after ourselves" 40 | rm -f v${VERSION}.tar.gz 41 | rm -rf packer-${VERSION} 42 | 43 | git status 44 | -------------------------------------------------------------------------------- /update_commands.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # Use this script to update the commands auto-completed in plugin/packer.vim. 4 | 5 | require 'open3' 6 | 7 | command_re = /^\s\s\s\s(\S+)/ 8 | plugin_file = 'plugin/packer.vim' 9 | 10 | # Create the list of commands. 11 | stdout, stderr, _status = Open3.capture3('packer list-commands') 12 | output = if stderr == '' 13 | stdout.split("\n") 14 | else 15 | stderr.split("\n") 16 | end 17 | commands = output.collect do |l| 18 | match = command_re.match(l) 19 | " \\ \"#{match[1]}\"" if match 20 | end.reject(&:nil?).join(",\n") 21 | 22 | # Read in the existing plugin file. 23 | plugin = File.open(plugin_file, 'r').readlines 24 | 25 | # Replace the terraResourceTypeBI lines with our new list. 26 | first = plugin.index { |l| /^ return join\(\[/.match(l) } + 1 27 | last = plugin.index { |l| /^ \\ \], "\\n"\)/.match(l) } 28 | plugin.slice!(first, last - first) 29 | commands.split("\n").reverse_each do |r| 30 | plugin.insert(first, r) 31 | end 32 | 33 | # Write the plugin file back out. 34 | File.open(plugin_file, 'w') do |f| 35 | f.puts plugin 36 | end 37 | --------------------------------------------------------------------------------