├── .editorconfig ├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── assemble.sh ├── autoload └── terraform.vim ├── doc ├── consul.txt ├── nomadproject.txt ├── ottoproject.txt ├── packer.txt ├── terraform.txt ├── vagrant.txt └── vaultproject.txt ├── ftdetect ├── terraform.vim └── vagrant.vim ├── ftplugin └── terraform.vim ├── indent └── terraform.vim ├── plugin ├── consul.vim ├── nomadproject.vim ├── ottoproject.vim ├── packer.vim ├── vagrant.vim └── vaultproject.vim └── syntax └── terraform.vim /.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 | -------------------------------------------------------------------------------- /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) 2013-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 | # Call For Maintainers 2 | 3 | This plugin, along with others like it, is now maintained by the 4 | [HashiVim](http://hashivim.github.io/) organization, which is looking for 5 | additional maintainers and contributors. See the HashiVim home page for 6 | further information. 7 | 8 | # vim-hashicorp-tools 9 | 10 | This plugin combines all of my Vim plugins supporting the various 11 | [Hashicorp](https://hashicorp.com) tools into one plugin, for people who 12 | are likely to use more than one or two of them and want a one-stop shop. 13 | The individual plugins are: 14 | 15 | - [vim-consul](https://github.com/hashivim/vim-consul) 16 | - [vim-nomadproject](https://github.com/hashivim/vim-nomadproject) 17 | - [vim-ottoproject](https://github.com/hashivim/vim-ottoproject) 18 | - [vim-packer](https://github.com/hashivim/vim-packer) 19 | - [vim-terraform](https://github.com/hashivim/vim-terraform) 20 | - [vim-vagrant](https://github.com/hashivim/vim-vagrant) 21 | - [vim-vaultproject](https://github.com/hashivim/vim-vaultproject) 22 | 23 | Please see the individual repositories above for further information 24 | on each one. This repository is created by brute-force combining the 25 | others with the `assemble.sh` script, so please file any issues or pull 26 | requests against the individual repos, not this one. Thanks. 27 | 28 | ## Installation 29 | 30 | With [pathogen.vim](https://github.com/tpope/vim-pathogen) just do: 31 | 32 | cd ~/.vim/bundle 33 | git clone https://github.com/hashivim/vim-hashicorp-tools.git 34 | 35 | If you prefer to use something besides pathogen, go ahead. 36 | 37 | ## Credits 38 | 39 | See individual repositories for credits for the code contained within 40 | them. The code to assemble them in this repo was written by Mark Cornick 41 | . Licensed under the ISC license. 42 | 43 | Hashicorp is a trademark of Hashicorp. The capital of Djibouti is 44 | Djibouti. 45 | 46 | This project is intended to be a safe, welcoming space for collaboration, and 47 | contributors are expected to adhere to the [Contributor 48 | Covenant](http://contributor-covenant.org) code of conduct. 49 | -------------------------------------------------------------------------------- /assemble.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # WHAT: This script assembles the vim-hashicorp-tools plugin from git checkouts 3 | # of the constituent plugins, which are assumed to exist in the same 4 | # directory as vim-hashicorp-tools. 5 | 6 | BLD=$(tput bold) 7 | RST=$(tput sgr0) 8 | 9 | for REPO in consul nomadproject ottoproject packer terraform vagrant vaultproject; do 10 | # Clone all the repositories just incase we didn't have them 11 | if [ ! -d "../vim-${REPO}" ]; then 12 | echo "${BLD}INFO: Cloning vim-${REPO}${RST}" 13 | git clone git@github.com:hashivim/vim-${REPO} ../vim-${REPO} 14 | fi 15 | 16 | # We only want to assemble off of master 17 | if [ $(cd ../vim-${REPO} && git rev-parse --abbrev-ref HEAD) != "master" ]; then 18 | echo "${BLD}WARN: Repository vim-${REPO} did not have the master branch checked out. To get that branchs changes back, run \`stash pop\`.${RST}" 19 | git stash 20 | git checkout master 21 | git pull 22 | fi 23 | 24 | # Hashicorp tools ASSEMBLE! 25 | echo "${BLD}INFO: Assembling ../vim-${REPO} into this repository.${RST}" 26 | rsync --archive \ 27 | --exclude=.git \ 28 | --exclude=*.md \ 29 | --exclude=LICENSE \ 30 | --exclude=*.rb \ 31 | --exclude=*.sh \ 32 | --exclude=.travis.yml \ 33 | --exclude=Makefile \ 34 | --exclude=test/ \ 35 | --exclude=vader.vim/ \ 36 | --exclude=terraform-providers/ \ 37 | ../vim-${REPO}/ . 38 | done 39 | 40 | echo "${BLD}INFO: Done!${RST}" 41 | git status 42 | -------------------------------------------------------------------------------- /autoload/terraform.vim: -------------------------------------------------------------------------------- 1 | let s:cpo_save = &cpoptions 2 | set cpoptions&vim 3 | 4 | " Ensure no conflict with arguments from the environment 5 | let $TF_CLI_ARGS_fmt='' 6 | 7 | function! terraform#fmt() abort 8 | " Save the view. 9 | let curw = winsaveview() 10 | 11 | " Make a fake change so that the undo point is right. 12 | normal! ix 13 | normal! "_x 14 | 15 | " Execute `terraform fmt`, redirecting stderr to a temporary file. 16 | let tmpfile = tempname() 17 | let shellredir_save = &shellredir 18 | let &shellredir = '>%s 2>'.tmpfile 19 | silent execute '%!'.g:terraform_binary_path.' fmt -no-color -' 20 | let &shellredir = shellredir_save 21 | 22 | " If there was an error, undo any changes and show stderr. 23 | if v:shell_error != 0 24 | silent undo 25 | let output = readfile(tmpfile) 26 | echo join(output, "\n") 27 | endif 28 | 29 | " Delete the temporary file, and restore the view. 30 | call delete(tmpfile) 31 | call winrestview(curw) 32 | endfunction 33 | 34 | function! terraform#align() abort 35 | let p = '^.*=[^>]*$' 36 | if exists(':Tabularize') && getline('.') =~# '^.*=' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p) 37 | let column = strlen(substitute(getline('.')[0:col('.')],'[^=]','','g')) 38 | let position = strlen(matchstr(getline('.')[0:col('.')],'.*=\s*\zs.*')) 39 | Tabularize/=/l1 40 | normal! 0 41 | call search(repeat('[^=]*=',column).'\s\{-\}'.repeat('.',position),'ce',line('.')) 42 | endif 43 | endfunction 44 | 45 | function! terraform#commands(ArgLead, CmdLine, CursorPos) abort 46 | let commands = [ 47 | \ 'init', 48 | \ 'validate', 49 | \ 'plan', 50 | \ 'apply', 51 | \ 'destroy', 52 | \ 'console', 53 | \ 'fmt', 54 | \ 'force-unlock', 55 | \ 'get', 56 | \ 'graph', 57 | \ 'import', 58 | \ 'login', 59 | \ 'logout', 60 | \ 'output', 61 | \ 'providers', 62 | \ 'refresh', 63 | \ 'show', 64 | \ 'state', 65 | \ 'taint', 66 | \ 'untaint', 67 | \ 'version', 68 | \ 'workspace' 69 | \ ] 70 | return join(commands, "\n") 71 | endfunction 72 | 73 | let &cpoptions = s:cpo_save 74 | unlet s:cpo_save 75 | -------------------------------------------------------------------------------- /doc/consul.txt: -------------------------------------------------------------------------------- 1 | *consul.txt* basic vim/consul integration 2 | 3 | Author: HashiVim 4 | License: ISC license 5 | Repo: https://github.com/hashivim/vim-consul 6 | 7 | COMMANDS *consul* 8 | 9 | This command is only available if consul is in your PATH. 10 | 11 | *consul-:consul* 12 | :Consul [args] Invoke an arbitrary consul command. 13 | 14 | vim:tw=78:et:ft=help:norl: 15 | -------------------------------------------------------------------------------- /doc/nomadproject.txt: -------------------------------------------------------------------------------- 1 | *nomadproject.txt* basic vim/nomad integration 2 | 3 | Author: HashiVim 4 | License: ISC license 5 | Repo: https://github.com/hashivim/vim-nomadproject 6 | 7 | COMMANDS *nomadproject* 8 | 9 | This command is only available if nomad is in your PATH. 10 | 11 | *nomadproject-:nomad 12 | :Nomad [args] Invoke an arbitrary nomad command. 13 | 14 | vim:tw=78:et:ft=help:norl: 15 | -------------------------------------------------------------------------------- /doc/ottoproject.txt: -------------------------------------------------------------------------------- 1 | *ottoproject.txt* basic vim/otto integration 2 | 3 | Author: HashiVim 4 | License: ISC license 5 | Repo: https://github.com/hashivim/vim-ottoproject 6 | 7 | COMMANDS *ottoproject* 8 | 9 | This command is only available if otto is in your PATH. 10 | 11 | *ottoproject-:otto 12 | :Otto [args] Invoke an arbitrary otto command. 13 | 14 | vim:tw=78:et:ft=help:norl: 15 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /doc/terraform.txt: -------------------------------------------------------------------------------- 1 | *terraform.txt* basic vim/terraform integration 2 | 3 | Author: HashiVim 4 | License: ISC license 5 | Repo: https://github.com/hashivim/vim-terraform 6 | 7 | 8 | Type |gO| to see the table of contents. 9 | ============================================================================== 10 | COMMANDS *terraform-commands* 11 | 12 | These commands are only available if terraform is in your PATH. 13 | 14 | *:Terraform* 15 | `:Terraform` [args] Invoke an arbitrary terraform command. 16 | 17 | *:TerraformFmt* 18 | `:TerraformFmt` Invoke `terraform fmt` on a current buffer. 19 | 20 | ============================================================================== 21 | SETTINGS *terraform-settings* 22 | 23 | *g:terraform_align* 24 | Allow vim-terraform to align settings automatically with Tabularize. 25 | Default: 0 26 | 27 | *g:terraform_binary_path* 28 | Allow vim-terraform to use a custom path for the terraform binary. 29 | Default: terraform 30 | 31 | *g:terraform_fmt_on_save* 32 | Allow vim-terraform to automatically format *.tf and *.tfvars files with 33 | terraform fmt. You can also do this manually with the `:TerraformFmt` command. 34 | Default: 0 35 | 36 | *g:terraform_fold_sections* 37 | Allow vim-terraform to automatically fold (hide until unfolded) sections of 38 | terraform code. 39 | Default: 0 40 | 41 | vim:tw=78:et:ft=help:norl: 42 | -------------------------------------------------------------------------------- /doc/vagrant.txt: -------------------------------------------------------------------------------- 1 | *vagrant.txt* basic vim/vagrant integration 2 | 3 | Author: HashiVim 4 | License: ISC license 5 | Repo: https://github.com/hashivim/vim-vagrant 6 | 7 | COMMANDS *vagrant* 8 | 9 | This command is only available if vagrant is in your PATH. 10 | 11 | *vagrant-:Vagrant* 12 | :Vagrant [args] Invoke an arbitrary vagrant command. 13 | 14 | vim:tw=78:et:ft=help:norl: 15 | -------------------------------------------------------------------------------- /doc/vaultproject.txt: -------------------------------------------------------------------------------- 1 | *vaultproject.txt* basic vim/vault integration 2 | 3 | Author: HashiVim 4 | License: ISC license 5 | Repo: https://github.com/hashivim/vim-vaultproject 6 | 7 | COMMANDS *vaultproject* 8 | 9 | This command is only available if vault is in your PATH. 10 | 11 | *vaultproject-:vault 12 | :Vault [args] Invoke an arbitrary vault command. 13 | 14 | vim:tw=78:et:ft=help:norl: 15 | -------------------------------------------------------------------------------- /ftdetect/terraform.vim: -------------------------------------------------------------------------------- 1 | " By default, Vim associates .tf files with TinyFugue - tell it not to. 2 | silent! autocmd! filetypedetect BufRead,BufNewFile *.tf 3 | autocmd BufRead,BufNewFile *.tf,*.tfvars,.terraformrc,terraform.rc set filetype=terraform 4 | autocmd BufRead,BufNewFile *.tfstate,*.tfstate.backup set filetype=json 5 | -------------------------------------------------------------------------------- /ftdetect/vagrant.vim: -------------------------------------------------------------------------------- 1 | au BufRead,BufNewFile Vagrantfile set filetype=ruby 2 | -------------------------------------------------------------------------------- /ftplugin/terraform.vim: -------------------------------------------------------------------------------- 1 | " terraform.vim - basic vim/terraform integration 2 | " Maintainer: HashiVim 3 | 4 | if exists('b:did_ftplugin') || v:version < 700 || &compatible 5 | finish 6 | endif 7 | let b:did_ftplugin = 1 8 | 9 | let s:cpo_save = &cpoptions 10 | set cpoptions&vim 11 | 12 | " j is a relatively recent addition; silence warnings when setting it. 13 | setlocal formatoptions-=t formatoptions+=croql 14 | silent! setlocal formatoptions+=j 15 | let b:undo_ftplugin = 'setlocal formatoptions<' 16 | 17 | if !has('patch-7.4.1142') 18 | " Include hyphens as keyword characters so that a keyword appearing as 19 | " part of a longer name doesn't get partially highlighted. 20 | setlocal iskeyword+=- 21 | let b:undo_ftplugin .= ' iskeyword<' 22 | endif 23 | 24 | if get(g:, 'terraform_fold_sections', 0) 25 | setlocal foldmethod=syntax 26 | let b:undo_ftplugin .= ' foldmethod<' 27 | endif 28 | 29 | " Set the commentstring 30 | setlocal commentstring=#%s 31 | let b:undo_ftplugin .= ' commentstring<' 32 | 33 | if get(g:, 'terraform_align', 0) && exists(':Tabularize') 34 | inoremap = =:call terraform#align()a 35 | let b:undo_ftplugin .= '|iunmap =' 36 | endif 37 | 38 | let &cpoptions = s:cpo_save 39 | unlet s:cpo_save 40 | 41 | if !exists('g:terraform_binary_path') 42 | let g:terraform_binary_path='terraform' 43 | endif 44 | 45 | if !executable(g:terraform_binary_path) 46 | finish 47 | endif 48 | 49 | let s:cpo_save = &cpoptions 50 | set cpoptions&vim 51 | 52 | command! -nargs=+ -complete=custom,terraform#commands -buffer Terraform 53 | \ execute '!'.g:terraform_binary_path.' '..' -no-color' 54 | 55 | command! -nargs=0 -buffer TerraformFmt call terraform#fmt() 56 | let b:undo_ftplugin .= '|delcommand Terraform|delcommand TerraformFmt' 57 | 58 | if get(g:, 'terraform_fmt_on_save', 0) 59 | augroup vim.terraform.fmt 60 | autocmd! 61 | autocmd BufWritePre *.tf call terraform#fmt() 62 | autocmd BufWritePre *.tfvars call terraform#fmt() 63 | augroup END 64 | endif 65 | 66 | let &cpoptions = s:cpo_save 67 | unlet s:cpo_save 68 | -------------------------------------------------------------------------------- /indent/terraform.vim: -------------------------------------------------------------------------------- 1 | " Only load this file if no other indent file was loaded 2 | if exists('b:did_indent') 3 | finish 4 | endif 5 | let b:did_indent = 1 6 | 7 | let s:cpo_save = &cpoptions 8 | set cpoptions&vim 9 | 10 | setlocal nolisp 11 | setlocal autoindent shiftwidth=2 tabstop=2 softtabstop=2 expandtab 12 | setlocal indentexpr=TerraformIndent(v:lnum) 13 | setlocal indentkeys+=<:>,0=},0=) 14 | let b:undo_indent = 'setlocal lisp< autoindent< shiftwidth< tabstop< softtabstop<' 15 | \ . ' expandtab< indentexpr< indentkeys<' 16 | 17 | let &cpoptions = s:cpo_save 18 | unlet s:cpo_save 19 | 20 | if exists('*TerraformIndent') 21 | finish 22 | endif 23 | 24 | let s:cpo_save = &cpoptions 25 | set cpoptions&vim 26 | 27 | function! TerraformIndent(lnum) 28 | " Beginning of the file should have no indent 29 | if a:lnum == 0 30 | return 0 31 | endif 32 | 33 | " Usual case is to continue at the same indent as the previous non-blank line. 34 | let prevlnum = prevnonblank(a:lnum-1) 35 | let thisindent = indent(prevlnum) 36 | 37 | " If that previous line is a non-comment ending in [ { (, increase the 38 | " indent level. 39 | let prevline = getline(prevlnum) 40 | if prevline !~# '^\s*\(#\|//\)' && prevline =~# '[\[{\(]\s*$' 41 | let thisindent += &shiftwidth 42 | endif 43 | 44 | " If the current line ends a block, decrease the indent level. 45 | let thisline = getline(a:lnum) 46 | if thisline =~# '^\s*[\)}\]]' 47 | let thisindent -= &shiftwidth 48 | endif 49 | 50 | " If the previous line starts a block comment /*, increase by one 51 | if prevline =~# '/\*' 52 | let thisindent += 1 53 | endif 54 | 55 | " If the previous line ends a block comment */, decrease by one 56 | if prevline =~# '\*/' 57 | let thisindent -= 1 58 | endif 59 | 60 | return thisindent 61 | endfunction 62 | 63 | let &cpoptions = s:cpo_save 64 | unlet s:cpo_save 65 | -------------------------------------------------------------------------------- /plugin/consul.vim: -------------------------------------------------------------------------------- 1 | " consul.vim - basic vim/consul integration 2 | " Maintainer: HashiVim 3 | 4 | if exists("g:loaded_consul") || v:version < 700 || &cp || !executable('consul') 5 | finish 6 | endif 7 | let g:loaded_consul = 1 8 | 9 | function! s:commands(A, L, P) 10 | return join([ 11 | \ "agent", 12 | \ "catalog", 13 | \ "connect", 14 | \ "event", 15 | \ "exec", 16 | \ "force-leave", 17 | \ "info", 18 | \ "intention", 19 | \ "join", 20 | \ "keygen", 21 | \ "keyring", 22 | \ "kv", 23 | \ "leave", 24 | \ "lock", 25 | \ "maint", 26 | \ "members", 27 | \ "monitor", 28 | \ "operator", 29 | \ "reload", 30 | \ "rtt", 31 | \ "services", 32 | \ "snapshot", 33 | \ "validate", 34 | \ "version", 35 | \ "watch" 36 | \ ], "\n") 37 | endfunction 38 | 39 | augroup consul 40 | autocmd! 41 | autocmd VimEnter * 42 | \ command! -nargs=+ -complete=custom,s:commands Consul execute '!consul '. 43 | augroup END 44 | 45 | " vim:set et sw=2: 46 | -------------------------------------------------------------------------------- /plugin/nomadproject.vim: -------------------------------------------------------------------------------- 1 | " nomadproject.vim - basic vim/nomad integration 2 | " Maintainer: HashiVim 3 | 4 | if exists("g:loaded_nomadproject") || v:version < 700 || &cp || !executable('nomad') 5 | finish 6 | endif 7 | let g:loaded_nomadproject = 1 8 | 9 | function! s:commands(A, L, P) 10 | return join([ 11 | \ "run", 12 | \ "stop", 13 | \ "status", 14 | \ "alloc", 15 | \ "job", 16 | \ "node", 17 | \ "agent", 18 | \ "acl", 19 | \ "agent-info", 20 | \ "deployment", 21 | \ "eval", 22 | \ "namespace", 23 | \ "operator", 24 | \ "quota", 25 | \ "sentinel", 26 | \ "server", 27 | \ "ui", 28 | \ "version" 29 | \ ], "\n") 30 | endfunction 31 | 32 | augroup nomadproject 33 | autocmd! 34 | autocmd VimEnter * 35 | \ command! -nargs=+ -complete=custom,s:commands Nomad execute '!nomad '. 36 | augroup END 37 | 38 | " vim:set et sw=2: 39 | -------------------------------------------------------------------------------- /plugin/ottoproject.vim: -------------------------------------------------------------------------------- 1 | " ottoproject.vim - basic vim/otto integration 2 | " Maintainer: HashiVim 3 | 4 | if exists("g:loaded_ottoproject") || v:version < 700 || &cp || !executable('otto') 5 | finish 6 | endif 7 | let g:loaded_ottoproject = 1 8 | 9 | function! s:commands(A, L, P) 10 | return join([ 11 | \ "build", 12 | \ "compile", 13 | \ "deploy", 14 | \ "dev", 15 | \ "infra", 16 | \ "status", 17 | \ "version" 18 | \ ], "\n") 19 | endfunction 20 | 21 | augroup ottoproject 22 | autocmd! 23 | autocmd VimEnter * 24 | \ command! -nargs=+ -complete=custom,s:commands Otto execute '!otto '. 25 | augroup END 26 | 27 | " vim:set et sw=2: 28 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /plugin/vagrant.vim: -------------------------------------------------------------------------------- 1 | " vagrant.vim - basic vim/vagrant integration 2 | " Maintainer: HashiVim 3 | 4 | if exists("g:loaded_vagrant") || v:version < 700 || &cp || !executable('vagrant') 5 | finish 6 | endif 7 | let g:loaded_vagrant = 1 8 | 9 | function! s:commands(A, L, P) 10 | return join([ 11 | \ "box", 12 | \ "cap", 13 | \ "cloud", 14 | \ "destroy", 15 | \ "docker-exec", 16 | \ "docker-logs", 17 | \ "docker-run", 18 | \ "global-status", 19 | \ "halt", 20 | \ "help", 21 | \ "hostmanager", 22 | \ "init", 23 | \ "list-commands", 24 | \ "login", 25 | \ "package", 26 | \ "plugin", 27 | \ "port", 28 | \ "powershell", 29 | \ "provider", 30 | \ "provision", 31 | \ "push", 32 | \ "rdp", 33 | \ "reload", 34 | \ "resume", 35 | \ "rsync", 36 | \ "rsync-auto", 37 | \ "snapshot", 38 | \ "ssh", 39 | \ "ssh-config", 40 | \ "status", 41 | \ "suspend", 42 | \ "up", 43 | \ "upload", 44 | \ "validate", 45 | \ "version", 46 | \ "winrm", 47 | \ "winrm-config" 48 | \ ], "\n") 49 | endfunction 50 | 51 | augroup vagrant 52 | autocmd! 53 | autocmd VimEnter * 54 | \ command! -nargs=+ -complete=custom,s:commands Vagrant execute '!vagrant '. 55 | augroup END 56 | 57 | " vim:set et sw=2: 58 | -------------------------------------------------------------------------------- /plugin/vaultproject.vim: -------------------------------------------------------------------------------- 1 | " vaultproject.vim - basic vim/vault integration 2 | " Maintainer: HashiVim 3 | 4 | if exists("g:loaded_vaultproject") || v:version < 700 || &cp || !executable('vault') 5 | finish 6 | endif 7 | let g:loaded_vaultproject = 1 8 | 9 | function! s:commands(A, L, P) 10 | return join([ 11 | \ "read", 12 | \ "write", 13 | \ "delete", 14 | \ "list", 15 | \ "login", 16 | \ "agent", 17 | \ "server", 18 | \ "status", 19 | \ "unwrap", 20 | \ "audit", 21 | \ "auth", 22 | \ "kv", 23 | \ "lease", 24 | \ "namespace", 25 | \ "operator", 26 | \ "path-help", 27 | \ "plugin", 28 | \ "policy", 29 | \ "print", 30 | \ "secrets", 31 | \ "ssh", 32 | \ "token" 33 | \ ], "\n") 34 | endfunction 35 | 36 | augroup vaultproject 37 | autocmd! 38 | autocmd VimEnter * 39 | \ command! -nargs=+ -complete=custom,s:commands Vault execute '!vault '. 40 | augroup END 41 | 42 | " vim:set et sw=2: 43 | -------------------------------------------------------------------------------- /syntax/terraform.vim: -------------------------------------------------------------------------------- 1 | " Forked from Larry Gilbert's syntax file 2 | " github.com/L2G/vim-syntax-terraform 3 | 4 | if exists('b:current_syntax') 5 | finish 6 | endif 7 | 8 | let s:cpo_save = &cpo 9 | set cpo&vim 10 | 11 | " Identifiers are made up of alphanumeric characters, underscores, and 12 | " hyphens. 13 | if has('patch-7.4.1142') 14 | syn iskeyword a-z,A-Z,48-57,_,- 15 | endif 16 | 17 | syn case match 18 | 19 | " A block is introduced by a type, some number of labels - which are either 20 | " strings or identifiers - and an opening curly brace. Match the type. 21 | syn match terraBlockIntroduction /^\s*\zs\K\k*\ze\s\+\(\("\K\k*"\|\K\k*\)\s\+\)*{/ contains=terraBlockType 22 | syn keyword terraBlockType contained data locals module output provider resource terraform variable 23 | 24 | syn keyword terraValueBool true false on off yes no 25 | 26 | syn keyword terraTodo contained TODO FIXME XXX BUG TF-UPGRADE-TODO 27 | syn region terraComment start="/\*" end="\*/" contains=terraTodo,@Spell 28 | syn region terraComment start="#" end="$" contains=terraTodo,@Spell 29 | syn region terraComment start="//" end="$" contains=terraTodo,@Spell 30 | 31 | """ misc. 32 | syn match terraValueDec "\<[0-9]\+\([kKmMgG]b\?\)\?\>" 33 | syn match terraValueHexaDec "\<0x[0-9a-f]\+\([kKmMgG]b\?\)\?\>" 34 | syn match terraBraces "[\[\]]" 35 | 36 | """ skip \" and \\ in strings. 37 | syn region terraValueString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=terraStringInterp 38 | syn region terraStringInterp matchgroup=terraBraces start=/\${/ end=/}/ contained contains=ALL 39 | syn region terraHereDocText start=/<<-\?\z([a-z0-9A-Z]\+\)/ end=/^\s*\z1/ contains=terraStringInterp 40 | 41 | "" Functions. 42 | syn match terraFunction "[a-z0-9]\+(\@=" 43 | 44 | """ HCL2 45 | syn keyword terraRepeat for in 46 | syn keyword terraConditional if 47 | syn keyword terraType string bool number object tuple list map set any 48 | syn keyword terraValueNull null 49 | 50 | " enable block folding 51 | syn region terraBlockBody matchgroup=terraBraces start="{" end="}" fold transparent 52 | 53 | hi def link terraComment Comment 54 | hi def link terraTodo Todo 55 | hi def link terraBraces Delimiter 56 | hi def link terraBlockType Structure 57 | hi def link terraValueBool Boolean 58 | hi def link terraValueDec Number 59 | hi def link terraValueHexaDec Number 60 | hi def link terraValueString String 61 | hi def link terraHereDocText String 62 | hi def link terraFunction Function 63 | hi def link terraRepeat Repeat 64 | hi def link terraConditional Conditional 65 | hi def link terraType Type 66 | hi def link terraValueNull Constant 67 | 68 | let b:current_syntax = 'terraform' 69 | 70 | let &cpo = s:cpo_save 71 | unlet s:cpo_save 72 | --------------------------------------------------------------------------------