Squashed 'vim/bundle/hashicorp-tools/' content from commit 76c076659
git-subtree-dir: vim/bundle/hashicorp-tools git-subtree-split: 76c076659f4c32b8b95e797fafe748daa7792d16main
commit
b1aadf6780
@ -0,0 +1,11 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
@ -0,0 +1 @@
|
|||||||
|
/doc/tags
|
@ -0,0 +1,45 @@
|
|||||||
|
# Contributor Code of Conduct
|
||||||
|
|
||||||
|
As contributors and maintainers of this project, and in the interest of
|
||||||
|
fostering an open and welcoming community, we pledge to respect all people who
|
||||||
|
contribute through reporting issues, posting feature requests, updating
|
||||||
|
documentation, submitting pull requests or patches, and other activities.
|
||||||
|
|
||||||
|
We are committed to making participation in this project a harassment-free
|
||||||
|
experience for everyone, regardless of level of experience, gender, gender
|
||||||
|
identity and expression, sexual orientation, disability, personal appearance,
|
||||||
|
body size, race, ethnicity, age, religion, or nationality.
|
||||||
|
|
||||||
|
Examples of unacceptable behavior by participants include:
|
||||||
|
|
||||||
|
- The use of sexualized language or imagery
|
||||||
|
|
||||||
|
- Personal attacks
|
||||||
|
|
||||||
|
- Trolling or insulting/derogatory comments
|
||||||
|
|
||||||
|
- Public or private harassment
|
||||||
|
|
||||||
|
- Publishing other's private information, such as physical or electronic
|
||||||
|
addresses, without explicit permission
|
||||||
|
|
||||||
|
- Other unethical or unprofessional conduct.
|
||||||
|
|
||||||
|
Project maintainers have the right and responsibility to remove, edit, or reject
|
||||||
|
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||||
|
not aligned to this Code of Conduct. By adopting this Code of Conduct, project
|
||||||
|
maintainers commit themselves to fairly and consistently applying these
|
||||||
|
principles to every aspect of managing this project. Project maintainers who do
|
||||||
|
not follow or enforce the Code of Conduct may be permanently removed from the
|
||||||
|
project team.
|
||||||
|
|
||||||
|
This code of conduct applies both within project spaces and in public spaces
|
||||||
|
when an individual is representing the project or its community.
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
|
reported by opening an issue or contacting one or more of the project
|
||||||
|
maintainers.
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor
|
||||||
|
Covenant](http://contributor-covenant.org), version 1.2.0, available at
|
||||||
|
<http://contributor-covenant.org/version/1/2/0/>
|
@ -0,0 +1,35 @@
|
|||||||
|
# Contributing To My Vim Plugins
|
||||||
|
|
||||||
|
I'm not a Vim wizard by any means, nor am I too proud to accept
|
||||||
|
contributions that improve my code, so if you think you have a problem,
|
||||||
|
improvement, or other contribution towards the betterment of Vim-kind,
|
||||||
|
please file an issue or, where appropriate, a pull request.
|
||||||
|
|
||||||
|
Before filing an issue, please read this article by my friends and
|
||||||
|
former colleagues at Viget:
|
||||||
|
|
||||||
|
<https://viget.com/extend/tips-for-writing-better-bug-reports>
|
||||||
|
|
||||||
|
Keep in mind that I'm not paid to write Vim plugins, so I'm doing this
|
||||||
|
in my spare time, which means it might take me a while to respond. If
|
||||||
|
you're not satisfied with my response to your problem with my free (as
|
||||||
|
in beer and in speech) software, I will give you triple your $0.00 back.
|
||||||
|
|
||||||
|
When filing a pull request, please explain what you're changing and why.
|
||||||
|
Please limit your changes to the specific thing you're fixing; it's
|
||||||
|
probably easiest for both of us if you isolate your change in a topic
|
||||||
|
branch that I can merge without pulling in other stuff. Please do not
|
||||||
|
update CHANGELOG, versions, etc.; I'll take care of that. I'll also add
|
||||||
|
you to the Credits list with my thanks.
|
||||||
|
|
||||||
|
All of my Vim plugins use the ISC license. If you submit a pull request,
|
||||||
|
I'll assume you are OK with any code you add being placed under that
|
||||||
|
same ISC license. If this is not the case for any reason, please let me
|
||||||
|
know why you can't tolerate the ISC license. I am 99.99% likely to
|
||||||
|
reject your change in that case, but I'll let you have your say.
|
||||||
|
|
||||||
|
This project is intended to be a safe, welcoming space for collaboration, and
|
||||||
|
contributors are expected to adhere to the [Contributor
|
||||||
|
Covenant](http://contributor-covenant.org) code of conduct.
|
||||||
|
|
||||||
|
Thanks for contributing!
|
@ -0,0 +1,13 @@
|
|||||||
|
Copyright (c) 2013-2015 Mark Cornick <mark@markcornick.com>
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any purpose
|
||||||
|
with or without fee is hereby granted, provided that the above copyright notice
|
||||||
|
and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED 'AS IS' AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||||
|
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||||
|
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||||
|
THIS SOFTWARE.
|
@ -0,0 +1,48 @@
|
|||||||
|
# Call For Maintainers
|
||||||
|
|
||||||
|
This plugin, along with others like it, is now maintained by the
|
||||||
|
[HashiVim](http://hashivim.github.io/) organization, which is looking for
|
||||||
|
additional maintainers and contributors. See the HashiVim home page for
|
||||||
|
further information.
|
||||||
|
|
||||||
|
# vim-hashicorp-tools
|
||||||
|
|
||||||
|
This plugin combines all of my Vim plugins supporting the various
|
||||||
|
[Hashicorp](https://hashicorp.com) tools into one plugin, for people who
|
||||||
|
are likely to use more than one or two of them and want a one-stop shop.
|
||||||
|
The individual plugins are:
|
||||||
|
|
||||||
|
- [vim-consul](https://github.com/hashivim/vim-consul)
|
||||||
|
- [vim-nomadproject](https://github.com/hashivim/vim-nomadproject)
|
||||||
|
- [vim-ottoproject](https://github.com/hashivim/vim-ottoproject)
|
||||||
|
- [vim-packer](https://github.com/hashivim/vim-packer)
|
||||||
|
- [vim-terraform](https://github.com/hashivim/vim-terraform)
|
||||||
|
- [vim-vagrant](https://github.com/hashivim/vim-vagrant)
|
||||||
|
- [vim-vaultproject](https://github.com/hashivim/vim-vaultproject)
|
||||||
|
|
||||||
|
Please see the individual repositories above for further information
|
||||||
|
on each one. This repository is created by brute-force combining the
|
||||||
|
others with the `assemble.sh` script, so please file any issues or pull
|
||||||
|
requests against the individual repos, not this one. Thanks.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
With [pathogen.vim](https://github.com/tpope/vim-pathogen) just do:
|
||||||
|
|
||||||
|
cd ~/.vim/bundle
|
||||||
|
git clone https://github.com/hashivim/vim-hashicorp-tools.git
|
||||||
|
|
||||||
|
If you prefer to use something besides pathogen, go ahead.
|
||||||
|
|
||||||
|
## Credits
|
||||||
|
|
||||||
|
See individual repositories for credits for the code contained within
|
||||||
|
them. The code to assemble them in this repo was written by Mark Cornick
|
||||||
|
<https://www.markcornick.com/>. Licensed under the ISC license.
|
||||||
|
|
||||||
|
Hashicorp is a trademark of Hashicorp. The capital of Djibouti is
|
||||||
|
Djibouti.
|
||||||
|
|
||||||
|
This project is intended to be a safe, welcoming space for collaboration, and
|
||||||
|
contributors are expected to adhere to the [Contributor
|
||||||
|
Covenant](http://contributor-covenant.org) code of conduct.
|
@ -0,0 +1,81 @@
|
|||||||
|
if !exists('g:terraform_align')
|
||||||
|
let g:terraform_align = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists('g:terraform_remap_spacebar')
|
||||||
|
let g:terraform_remap_spacebar = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists('g:terraform_fold_sections')
|
||||||
|
let g:terraform_fold_sections = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
if g:terraform_align && exists(':Tabularize')
|
||||||
|
inoremap <buffer> <silent> = =<Esc>:call <SID>terraformalign()<CR>a
|
||||||
|
function! s:terraformalign()
|
||||||
|
let p = '^.*=[^>]*$'
|
||||||
|
if exists(':Tabularize') && getline('.') =~# '^.*=' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
|
||||||
|
let column = strlen(substitute(getline('.')[0:col('.')],'[^=]','','g'))
|
||||||
|
let position = strlen(matchstr(getline('.')[0:col('.')],'.*=\s*\zs.*'))
|
||||||
|
Tabularize/=/l1
|
||||||
|
normal! 0
|
||||||
|
call search(repeat('[^=]*=',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
endif
|
||||||
|
|
||||||
|
if g:terraform_fold_sections
|
||||||
|
function! TerraformFolds()
|
||||||
|
let thisline = getline(v:lnum)
|
||||||
|
if match(thisline, '^resource') >= 0
|
||||||
|
return ">1"
|
||||||
|
elseif match(thisline, '^provider') >= 0
|
||||||
|
return ">1"
|
||||||
|
elseif match(thisline, '^module') >= 0
|
||||||
|
return ">1"
|
||||||
|
elseif match(thisline, '^variable') >= 0
|
||||||
|
return ">1"
|
||||||
|
elseif match(thisline, '^output') >= 0
|
||||||
|
return ">1"
|
||||||
|
elseif match(thisline, '^data') >= 0
|
||||||
|
return ">1"
|
||||||
|
elseif match(thisline, '^terraform') >= 0
|
||||||
|
return ">1"
|
||||||
|
elseif match(thisline, '^locals') >= 0
|
||||||
|
return ">1"
|
||||||
|
else
|
||||||
|
return "="
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
setlocal foldmethod=expr
|
||||||
|
setlocal foldexpr=TerraformFolds()
|
||||||
|
setlocal foldlevel=1
|
||||||
|
|
||||||
|
function! TerraformFoldText()
|
||||||
|
let foldsize = (v:foldend-v:foldstart)
|
||||||
|
return getline(v:foldstart).' ('.foldsize.' lines)'
|
||||||
|
endfunction
|
||||||
|
setlocal foldtext=TerraformFoldText()
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Re-map the space bar to fold and unfold
|
||||||
|
if get(g:, "terraform_remap_spacebar", 1)
|
||||||
|
"inoremap <space> <C-O>za
|
||||||
|
nnoremap <space> za
|
||||||
|
onoremap <space> <C-C>za
|
||||||
|
vnoremap <space> zf
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Match the identation put in place by Hashicorp and :TerraformFmt, https://github.com/hashivim/vim-terraform/issues/21
|
||||||
|
if get(g:, "terraform_align", 1)
|
||||||
|
setlocal tabstop=2
|
||||||
|
setlocal softtabstop=2
|
||||||
|
setlocal shiftwidth=2
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Set the commentstring
|
||||||
|
if exists('g:terraform_commentstring')
|
||||||
|
let &l:commentstring=g:terraform_commentstring
|
||||||
|
else
|
||||||
|
setlocal commentstring=#%s
|
||||||
|
endif
|
@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# WHAT: This script assembles the vim-hashicorp-tools plugin from git checkouts
|
||||||
|
# of the constituent plugins, which are assumed to exist in the same
|
||||||
|
# directory as vim-hashicorp-tools.
|
||||||
|
|
||||||
|
BLD=$(tput bold)
|
||||||
|
RST=$(tput sgr0)
|
||||||
|
|
||||||
|
for REPO in consul nomadproject ottoproject packer terraform vagrant vaultproject; do
|
||||||
|
# Clone all the repositories just incase we didn't have them
|
||||||
|
if [ ! -d "../vim-${REPO}" ]; then
|
||||||
|
echo "${BLD}INFO: Cloning vim-${REPO}${RST}"
|
||||||
|
git clone git@github.com:hashivim/vim-${REPO} ../vim-${REPO}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# We only want to assemble off of master
|
||||||
|
if [ $(cd ../vim-${REPO} && git rev-parse --abbrev-ref HEAD) != "master" ]; then
|
||||||
|
echo "${BLD}WARN: Repository vim-${REPO} did not have the master branch checked out. To get that branchs changes back, run \`stash pop\`.${RST}"
|
||||||
|
git stash
|
||||||
|
git checkout master
|
||||||
|
git pull
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Hashicorp tools ASSEMBLE!
|
||||||
|
echo "${BLD}INFO: Assembling ../vim-${REPO} into this repository.${RST}"
|
||||||
|
rsync --archive \
|
||||||
|
--exclude=.git \
|
||||||
|
--exclude=*.md \
|
||||||
|
--exclude=LICENSE \
|
||||||
|
--exclude=*.rb \
|
||||||
|
--exclude=*.sh \
|
||||||
|
--exclude=.travis.yml \
|
||||||
|
--exclude=Makefile \
|
||||||
|
--exclude=test/ \
|
||||||
|
--exclude=vader.vim/ \
|
||||||
|
--exclude=terraform-providers/ \
|
||||||
|
../vim-${REPO}/ .
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "${BLD}INFO: Done!${RST}"
|
||||||
|
git status
|
@ -0,0 +1,14 @@
|
|||||||
|
*consul.txt* basic vim/consul integration
|
||||||
|
|
||||||
|
Author: HashiVim <https://github.com/hashivim>
|
||||||
|
License: ISC license
|
||||||
|
Repo: https://github.com/hashivim/vim-consul
|
||||||
|
|
||||||
|
COMMANDS *consul*
|
||||||
|
|
||||||
|
This command is only available if consul is in your PATH.
|
||||||
|
|
||||||
|
*consul-:consul*
|
||||||
|
:Consul [args] Invoke an arbitrary consul command.
|
||||||
|
|
||||||
|
vim:tw=78:et:ft=help:norl:
|
@ -0,0 +1,14 @@
|
|||||||
|
*nomadproject.txt* basic vim/nomad integration
|
||||||
|
|
||||||
|
Author: HashiVim <https://github.com/hashivim>
|
||||||
|
License: ISC license
|
||||||
|
Repo: https://github.com/hashivim/vim-nomadproject
|
||||||
|
|
||||||
|
COMMANDS *nomadproject*
|
||||||
|
|
||||||
|
This command is only available if nomad is in your PATH.
|
||||||
|
|
||||||
|
*nomadproject-:nomad
|
||||||
|
:Nomad [args] Invoke an arbitrary nomad command.
|
||||||
|
|
||||||
|
vim:tw=78:et:ft=help:norl:
|
@ -0,0 +1,14 @@
|
|||||||
|
*ottoproject.txt* basic vim/otto integration
|
||||||
|
|
||||||
|
Author: HashiVim <https://github.com/hashivim>
|
||||||
|
License: ISC license
|
||||||
|
Repo: https://github.com/hashivim/vim-ottoproject
|
||||||
|
|
||||||
|
COMMANDS *ottoproject*
|
||||||
|
|
||||||
|
This command is only available if otto is in your PATH.
|
||||||
|
|
||||||
|
*ottoproject-:otto
|
||||||
|
:Otto [args] Invoke an arbitrary otto command.
|
||||||
|
|
||||||
|
vim:tw=78:et:ft=help:norl:
|
@ -0,0 +1,14 @@
|
|||||||
|
*packer.txt* basic vim/packer integration
|
||||||
|
|
||||||
|
Author: HashiVim <https://github.com/hashivim>
|
||||||
|
License: ISC license
|
||||||
|
Repo: https://github.com/hashivim/vim-packer
|
||||||
|
|
||||||
|
COMMANDS *packer*
|
||||||
|
|
||||||
|
This command is only available if packer is in your PATH.
|
||||||
|
|
||||||
|
*packer-:packer*
|
||||||
|
:Packer [args] Invoke an arbitrary packer command.
|
||||||
|
|
||||||
|
vim:tw=78:et:ft=help:norl:
|
@ -0,0 +1,14 @@
|
|||||||
|
*terraform.txt* basic vim/terraform integration
|
||||||
|
|
||||||
|
Author: HashiVim <https://github.com/hashivim>
|
||||||
|
License: ISC license
|
||||||
|
Repo: https://github.com/hashivim/vim-terraform
|
||||||
|
|
||||||
|
COMMANDS *terraform*
|
||||||
|
|
||||||
|
This command is only available if terraform is in your PATH.
|
||||||
|
|
||||||
|
*terraform-:terraform*
|
||||||
|
:Terraform [args] Invoke an arbitrary terraform command.
|
||||||
|
|
||||||
|
vim:tw=78:et:ft=help:norl:
|
@ -0,0 +1,14 @@
|
|||||||
|
*vagrant.txt* basic vim/vagrant integration
|
||||||
|
|
||||||
|
Author: HashiVim <https://github.com/hashivim>
|
||||||
|
License: ISC license
|
||||||
|
Repo: https://github.com/hashivim/vim-vagrant
|
||||||
|
|
||||||
|
COMMANDS *vagrant*
|
||||||
|
|
||||||
|
This command is only available if vagrant is in your PATH.
|
||||||
|
|
||||||
|
*vagrant-:Vagrant*
|
||||||
|
:Vagrant [args] Invoke an arbitrary vagrant command.
|
||||||
|
|
||||||
|
vim:tw=78:et:ft=help:norl:
|
@ -0,0 +1,14 @@
|
|||||||
|
*vaultproject.txt* basic vim/vault integration
|
||||||
|
|
||||||
|
Author: HashiVim <https://github.com/hashivim>
|
||||||
|
License: ISC license
|
||||||
|
Repo: https://github.com/hashivim/vim-vaultproject
|
||||||
|
|
||||||
|
COMMANDS *vaultproject*
|
||||||
|
|
||||||
|
This command is only available if vault is in your PATH.
|
||||||
|
|
||||||
|
*vaultproject-:vault
|
||||||
|
:Vault [args] Invoke an arbitrary vault command.
|
||||||
|
|
||||||
|
vim:tw=78:et:ft=help:norl:
|
@ -0,0 +1,4 @@
|
|||||||
|
au BufRead,BufNewFile *.tf setlocal filetype=terraform
|
||||||
|
au BufRead,BufNewFile *.tfvars setlocal filetype=terraform
|
||||||
|
au BufRead,BufNewFile *.tfstate setlocal filetype=json
|
||||||
|
au BufRead,BufNewFile *.tfstate.backup setlocal filetype=json
|
@ -0,0 +1 @@
|
|||||||
|
au BufRead,BufNewFile Vagrantfile set filetype=ruby
|
@ -0,0 +1,69 @@
|
|||||||
|
" terraform.vim - basic vim/terraform integration
|
||||||
|
" Maintainer: HashiVim <https://github.com/hashivim>
|
||||||
|
|
||||||
|
if exists("g:loaded_terraform") || v:version < 700 || &cp || !executable('terraform')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let g:loaded_terraform = 1
|
||||||
|
|
||||||
|
if !exists("g:terraform_fmt_on_save")
|
||||||
|
let g:terraform_fmt_on_save = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! s:commands(A, L, P)
|
||||||
|
return join([
|
||||||
|
\ "apply",
|
||||||
|
\ "console",
|
||||||
|
\ "destroy",
|
||||||
|
\ "env",
|
||||||
|
\ "fmt",
|
||||||
|
\ "get",
|
||||||
|
\ "graph",
|
||||||
|
\ "import",
|
||||||
|
\ "init",
|
||||||
|
\ "output",
|
||||||
|
\ "plan",
|
||||||
|
\ "providers",
|
||||||
|
\ "push",
|
||||||
|
\ "refresh",
|
||||||
|
\ "show",
|
||||||
|
\ "taint",
|
||||||
|
\ "untaint",
|
||||||
|
\ "validate",
|
||||||
|
\ "version",
|
||||||
|
\ "workspace",
|
||||||
|
\ "debug",
|
||||||
|
\ "force-unlock",
|
||||||
|
\ "state"
|
||||||
|
\ ], "\n")
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Adapted from vim-hclfmt:
|
||||||
|
" https://github.com/fatih/vim-hclfmt/blob/master/autoload/fmt.vim
|
||||||
|
function! terraform#fmt()
|
||||||
|
let l:curw = winsaveview()
|
||||||
|
let l:tmpfile = tempname()
|
||||||
|
call writefile(getline(1, "$"), l:tmpfile)
|
||||||
|
let output = system("terraform fmt -write " . l:tmpfile)
|
||||||
|
if v:shell_error == 0
|
||||||
|
try | silent undojoin | catch | endtry
|
||||||
|
call rename(l:tmpfile, resolve(expand("%")))
|
||||||
|
silent edit!
|
||||||
|
let &syntax = &syntax
|
||||||
|
else
|
||||||
|
echo output
|
||||||
|
call delete(l:tmpfile)
|
||||||
|
endif
|
||||||
|
call winrestview(l:curw)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
augroup terraform
|
||||||
|
autocmd!
|
||||||
|
autocmd BufEnter *
|
||||||
|
\ command! -nargs=+ -complete=custom,s:commands Terraform execute '!terraform '.<q-args>. ' -no-color'
|
||||||
|
autocmd BufEnter * command! -nargs=0 TerraformFmt call terraform#fmt()
|
||||||
|
if get(g:, "terraform_fmt_on_save", 1)
|
||||||
|
autocmd BufWritePre *.tf call terraform#fmt()
|
||||||
|
autocmd BufWritePre *.tfvars call terraform#fmt()
|
||||||
|
endif
|
||||||
|
augroup END
|
@ -0,0 +1,45 @@
|
|||||||
|
" Only load this file if no other indent file was loaded
|
||||||
|
if exists("b:did_indent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_indent = 1
|
||||||
|
|
||||||
|
setlocal nolisp
|
||||||
|
setlocal autoindent sw=2 ts=2
|
||||||
|
setlocal indentexpr=TerraformIndent(v:lnum)
|
||||||
|
setlocal indentkeys+=<:>,0=},0=)
|
||||||
|
|
||||||
|
if exists("*TerraformIndent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! TerraformIndent(lnum)
|
||||||
|
" Beginning of the file should have no indent
|
||||||
|
if a:lnum == 0
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Previous non-blank line should continue the indent level
|
||||||
|
let prevlnum = prevnonblank(a:lnum-1)
|
||||||
|
|
||||||
|
" Previous line without comments should continue the indent level
|
||||||
|
let prevline = substitute(getline(prevlnum), '//.*$', '', '')
|
||||||
|
let previndent = indent(prevlnum)
|
||||||
|
let thisindent = previndent
|
||||||
|
|
||||||
|
" Config block starting with [ { ( should increase the indent level
|
||||||
|
if prevline =~ '[\[{\(]\s*$'
|
||||||
|
let thisindent += &sw
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Current line without comments should continue the indent level
|
||||||
|
let thisline = substitute(getline(a:lnum), '//.*$', '', '')
|
||||||
|
|
||||||
|
" Config block ending with ) } ] should get the indentation
|
||||||
|
" level from the initial config block
|
||||||
|
if thisline =~ '^\s*[\)}\]]'
|
||||||
|
let thisindent -= &sw
|
||||||
|
endif
|
||||||
|
|
||||||
|
return thisindent
|
||||||
|
endfunction
|
@ -0,0 +1,45 @@
|
|||||||
|
" consul.vim - basic vim/consul integration
|
||||||
|
" Maintainer: HashiVim <https://github.com/hashivim>
|
||||||
|
|
||||||
|
if exists("g:loaded_consul") || v:version < 700 || &cp || !executable('consul')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let g:loaded_consul = 1
|
||||||
|
|
||||||
|
function! s:commands(A, L, P)
|
||||||
|
return join([
|
||||||
|
\ "agent",
|
||||||
|
\ "catalog",
|
||||||
|
\ "connect",
|
||||||
|
\ "event",
|
||||||
|
\ "exec",
|
||||||
|
\ "force-leave",
|
||||||
|
\ "info",
|
||||||
|
\ "intention",
|
||||||
|
\ "join",
|
||||||
|
\ "keygen",
|
||||||
|
\ "keyring",
|
||||||
|
\ "kv",
|
||||||
|
\ "leave",
|
||||||
|
\ "lock",
|
||||||
|
\ "maint",
|
||||||
|
\ "members",
|
||||||
|
\ "monitor",
|
||||||
|
\ "operator",
|
||||||
|
\ "reload",
|
||||||
|
\ "rtt",
|
||||||
|
\ "services",
|
||||||
|
\ "snapshot",
|
||||||
|
\ "validate",
|
||||||
|
\ "version",
|
||||||
|
\ "watch"
|
||||||
|
\ ], "\n")
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
augroup consul
|
||||||
|
autocmd!
|
||||||
|
autocmd VimEnter *
|
||||||
|
\ command! -nargs=+ -complete=custom,s:commands Consul execute '!consul '.<q-args>
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
" vim:set et sw=2:
|
@ -0,0 +1,38 @@
|
|||||||
|
" nomadproject.vim - basic vim/nomad integration
|
||||||
|
" Maintainer: HashiVim <https://github.com/hashivim>
|
||||||
|
|
||||||
|
if exists("g:loaded_nomadproject") || v:version < 700 || &cp || !executable('nomad')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let g:loaded_nomadproject = 1
|
||||||
|
|
||||||
|
function! s:commands(A, L, P)
|
||||||
|
return join([
|
||||||
|
\ "run",
|
||||||
|
\ "stop",
|
||||||
|
\ "status",
|
||||||
|
\ "alloc",
|
||||||
|
\ "job",
|
||||||
|
\ "node",
|
||||||
|
\ "agent",
|
||||||
|
\ "acl",
|
||||||
|
\ "agent-info",
|
||||||
|
\ "deployment",
|
||||||
|
\ "eval",
|
||||||
|
\ "namespace",
|
||||||
|
\ "operator",
|
||||||
|
\ "quota",
|
||||||
|
\ "sentinel",
|
||||||
|
\ "server",
|
||||||
|
\ "ui",
|
||||||
|
\ "version"
|
||||||
|
\ ], "\n")
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
augroup nomadproject
|
||||||
|
autocmd!
|
||||||
|
autocmd VimEnter *
|
||||||
|
\ command! -nargs=+ -complete=custom,s:commands Nomad execute '!nomad '.<q-args>
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
" vim:set et sw=2:
|
@ -0,0 +1,27 @@
|
|||||||
|
" ottoproject.vim - basic vim/otto integration
|
||||||
|
" Maintainer: HashiVim <https://github.com/hashivim>
|
||||||
|
|
||||||
|
if exists("g:loaded_ottoproject") || v:version < 700 || &cp || !executable('otto')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let g:loaded_ottoproject = 1
|
||||||
|
|
||||||
|
function! s:commands(A, L, P)
|
||||||
|
return join([
|
||||||
|
\ "build",
|
||||||
|
\ "compile",
|
||||||
|
\ "deploy",
|
||||||
|
\ "dev",
|
||||||
|
\ "infra",
|
||||||
|
\ "status",
|
||||||
|
\ "version"
|
||||||
|
\ ], "\n")
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
augroup ottoproject
|
||||||
|
autocmd!
|
||||||
|
autocmd VimEnter *
|
||||||
|
\ command! -nargs=+ -complete=custom,s:commands Otto execute '!otto '.<q-args>
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
" vim:set et sw=2:
|
@ -0,0 +1,25 @@
|
|||||||
|
" packer.vim - basic vim/packer integration
|
||||||
|
" Maintainer: HashiVim <https://github.com/hashivim>
|
||||||
|
|
||||||
|
if exists("g:loaded_packer") || v:version < 700 || &cp || !executable('packer')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let g:loaded_packer = 1
|
||||||
|
|
||||||
|
function! s:commands(A, L, P)
|
||||||
|
return join([
|
||||||
|
\ "build",
|
||||||
|
\ "fix",
|
||||||
|
\ "inspect",
|
||||||
|
\ "validate",
|
||||||
|
\ "version"
|
||||||
|
\ ], "\n")
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
augroup packer
|
||||||
|
autocmd!
|
||||||
|
autocmd VimEnter *
|
||||||
|
\ command! -nargs=+ -complete=custom,s:commands Packer execute '!packer '.<q-args>
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
" vim:set et sw=2:
|
@ -0,0 +1,69 @@
|
|||||||
|
" terraform.vim - basic vim/terraform integration
|
||||||
|
" Maintainer: HashiVim <https://github.com/hashivim>
|
||||||
|
|
||||||
|
if exists("g:loaded_terraform") || v:version < 700 || &cp || !executable('terraform')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let g:loaded_terraform = 1
|
||||||
|
|
||||||
|
if !exists("g:terraform_fmt_on_save")
|
||||||
|
let g:terraform_fmt_on_save = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! s:commands(A, L, P)
|
||||||
|
return join([
|
||||||
|
\ "apply",
|
||||||
|
\ "console",
|
||||||
|
\ "destroy",
|
||||||
|
\ "env",
|
||||||
|
\ "fmt",
|
||||||
|
\ "get",
|
||||||
|
\ "graph",
|
||||||
|
\ "import",
|
||||||
|
\ "init",
|
||||||
|
\ "output",
|
||||||
|
\ "plan",
|
||||||
|
\ "providers",
|
||||||
|
\ "push",
|
||||||
|
\ "refresh",
|
||||||
|
\ "show",
|
||||||
|
\ "taint",
|
||||||
|
\ "untaint",
|
||||||
|
\ "validate",
|
||||||
|
\ "version",
|
||||||
|
\ "workspace",
|
||||||
|
\ "debug",
|
||||||
|
\ "force-unlock",
|
||||||
|
\ "state"
|
||||||
|
\ ], "\n")
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Adapted from vim-hclfmt:
|
||||||
|
" https://github.com/fatih/vim-hclfmt/blob/master/autoload/fmt.vim
|
||||||
|
function! terraform#fmt()
|
||||||
|
let l:curw = winsaveview()
|
||||||
|
let l:tmpfile = tempname()
|
||||||
|
call writefile(getline(1, "$"), l:tmpfile)
|
||||||
|
let output = system("terraform fmt -write " . l:tmpfile)
|
||||||
|
if v:shell_error == 0
|
||||||
|
try | silent undojoin | catch | endtry
|
||||||
|
call rename(l:tmpfile, resolve(expand("%")))
|
||||||
|
silent edit!
|
||||||
|
let &syntax = &syntax
|
||||||
|
else
|
||||||
|
echo output
|
||||||
|
call delete(l:tmpfile)
|
||||||
|
endif
|
||||||
|
call winrestview(l:curw)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
augroup terraform
|
||||||
|
autocmd!
|
||||||
|
autocmd VimEnter *
|
||||||
|
\ command! -nargs=+ -complete=custom,s:commands Terraform execute '!terraform '.<q-args>. ' -no-color'
|
||||||
|
autocmd VimEnter * command! -nargs=0 TerraformFmt call terraform#fmt()
|
||||||
|
if get(g:, "terraform_fmt_on_save", 1)
|
||||||
|
autocmd BufWritePre *.tf call terraform#fmt()
|
||||||
|
autocmd BufWritePre *.tfvars call terraform#fmt()
|
||||||
|
endif
|
||||||
|
augroup END
|
@ -0,0 +1,57 @@
|
|||||||
|
" vagrant.vim - basic vim/vagrant integration
|
||||||
|
" Maintainer: HashiVim <https://github.com/hashivim>
|
||||||
|
|
||||||
|
if exists("g:loaded_vagrant") || v:version < 700 || &cp || !executable('vagrant')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let g:loaded_vagrant = 1
|
||||||
|
|
||||||
|
function! s:commands(A, L, P)
|
||||||
|
return join([
|
||||||
|
\ "box",
|
||||||
|
\ "cap",
|
||||||
|
\ "cloud",
|
||||||
|
\ "destroy",
|
||||||
|
\ "docker-exec",
|
||||||
|
\ "docker-logs",
|
||||||
|
\ "docker-run",
|
||||||
|
\ "global-status",
|
||||||
|
\ "halt",
|
||||||
|
\ "help",
|
||||||
|
\ "hostmanager",
|
||||||
|
\ "init",
|
||||||
|
\ "list-commands",
|
||||||
|
\ "login",
|
||||||
|
\ "package",
|
||||||
|
\ "plugin",
|
||||||
|
\ "port",
|
||||||
|
\ "powershell",
|
||||||
|
\ "provider",
|
||||||
|
\ "provision",
|
||||||
|
\ "push",
|
||||||
|
\ "rdp",
|
||||||
|
\ "reload",
|
||||||
|
\ "resume",
|
||||||
|
\ "rsync",
|
||||||
|
\ "rsync-auto",
|
||||||
|
\ "snapshot",
|
||||||
|
\ "ssh",
|
||||||
|
\ "ssh-config",
|
||||||
|
\ "status",
|
||||||
|
\ "suspend",
|
||||||
|
\ "up",
|
||||||
|
\ "upload",
|
||||||
|
\ "validate",
|
||||||
|
\ "version",
|
||||||
|
\ "winrm",
|
||||||
|
\ "winrm-config"
|
||||||
|
\ ], "\n")
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
augroup vagrant
|
||||||
|
autocmd!
|
||||||
|
autocmd VimEnter *
|
||||||
|
\ command! -nargs=+ -complete=custom,s:commands Vagrant execute '!vagrant '.<q-args>
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
" vim:set et sw=2:
|
@ -0,0 +1,41 @@
|
|||||||
|
" vaultproject.vim - basic vim/vault integration
|
||||||
|
" Maintainer: HashiVim <https://github.com/hashivim>
|
||||||
|
|
||||||
|
if exists("g:loaded_vaultproject") || v:version < 700 || &cp || !executable('vault')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let g:loaded_vaultproject = 1
|
||||||
|
|
||||||
|
function! s:commands(A, L, P)
|
||||||
|
return join([
|
||||||
|
\ "read",
|
||||||
|
\ "write",
|
||||||
|
\ "delete",
|
||||||
|
\ "list",
|
||||||
|
\ "login",
|
||||||
|
\ "agent",
|
||||||
|
\ "server",
|
||||||
|
\ "status",
|
||||||
|
\ "unwrap",
|
||||||
|
\ "audit",
|
||||||
|
\ "auth",
|
||||||
|
\ "kv",
|
||||||
|
\ "lease",
|
||||||
|
\ "namespace",
|
||||||
|
\ "operator",
|
||||||
|
\ "path-help",
|
||||||
|
\ "plugin",
|
||||||
|
\ "policy",
|
||||||
|
\ "secrets",
|
||||||
|
\ "ssh",
|
||||||
|
\ "token"
|
||||||
|
\ ], "\n")
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
augroup vaultproject
|
||||||
|
autocmd!
|
||||||
|
autocmd VimEnter *
|
||||||
|
\ command! -nargs=+ -complete=custom,s:commands Vault execute '!vault '.<q-args>
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
" vim:set et sw=2:
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue