set nocompatible " be iMproved, required filetype off " required syntax on set encoding=utf-8 set ruler " Show us our row and column let g:python3_host_prog = '/usr/bin/python3' " Accomodate a dark background set background=dark if empty(glob('~/.vim/autoload/plug.vim')) silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim autocmd VimEnter * PlugInstall --sync | source $MYVIMRC endif call plug#begin('~/.vim/plugged') " (Optinal) for Tag Sidebar " Plug 'majutsushi/tagbar' "Plug 'hashivim/vim-terraform' "Plug 'vim-syntastic/syntastic' "Plug 'juliosueiras/vim-terraform-completion' call plug#end() " Syntastic Config set statusline+=%#warningmsg# set statusline+=%{SyntasticStatuslineFlag()} set statusline+=%* let g:syntastic_always_populate_loc_list = 1 let g:syntastic_auto_loc_list = 1 let g:syntastic_check_on_open = 1 let g:syntastic_check_on_wq = 0 " (Optional)Remove Info(Preview) window set completeopt-=preview " (Optional)Hide Info(Preview) window after completions autocmd CursorMovedI * if pumvisible() == 0|pclose|endif autocmd InsertLeave * if pumvisible() == 0|pclose|endif " (Optional) Enable terraform plan to be include in filter let g:syntastic_terraform_tffilter_plan = 1 " (Optional) Default: 0, enable(1)/disable(0) plugin's keymapping let g:terraform_completion_keys = 1 " (Optional) Default: 1, enable(1)/disable(0) terraform module registry completion let g:terraform_registry_module_completion = 0 let g:pymode_python = 'python3' let g:pymode_options_max_line_length = 110 let g:pymode_lint_options_pep8 = {'max_line_length': g:pymode_options_max_line_length} let g:pymode_options_colorcolumn = 1 " set the runtime path to include Vundle and initialize set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() " alternatively, pass a path where Vundle should install plugins "call vundle#begin('~/some/path/here') " let Vundle manage Vundle, required Plugin 'gmarik/Vundle.vim' " The following are examples of different formats supported. " Keep Plugin commands between vundle#begin/end. " plugin on GitHub repo "Plugin 'tpope/vim-fugitive' " plugin from http://vim-scripts.org/vim/scripts.html "Plugin 'L9' " Git plugin not hosted on GitHub "Plugin 'git://git.wincent.com/command-t.git' " git repos on your local machine (i.e. when working on your own plugin) "Plugin 'file:///home/gmarik/path/to/plugin' " The sparkup vim script is in a subdirectory of this repo called vim. " Pass the path to set the runtimepath properly. "Plugin 'rstacruz/sparkup', {'rtp': 'vim/'} " Avoid a name conflict with L9 "n 'fatih/vim-go'Plugin 'user/L9', {'name': 'newL9'} " Go Plugin: "Plugin 'fatih/vim-go' Plugin 'vim-scripts/indentpython.vim' Plugin 'hashivim/vim-terraform' Plugin 'vim-syntastic/syntastic' "Plugin 'juliosueiras/vim-terraform-completion' Plugin 'saltstack/salt-vim' Plugin 'psf/black' Plugin 'vim-autoformat/vim-autoformat' "Plugin 'pearofducks/ansible-vim' "Plugin 'mrk21/yaml-vim' au BufWrite * :Autoformat " All of your Plugins must be added before the following line call vundle#end() " required filetype plugin indent on " required " To ignore plugin indent changes, instead use: "filetype plugin on " " Brief help " :PluginList - lists configured plugins " :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate " :PluginSearch foo - searches for foo; append `!` to refresh local cache " :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal " " see :h vundle for more details or wiki for FAQ " Put your non-Plugin stuff after this line set tabstop=2 set shiftwidth=2 set expandtab " Fix auto-indentation for YAML files "augroup yaml_fix " autocmd! " autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab indentkeys-=0# indentkeys-=<:> "augroup END "autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab indentkeys-=0# indentkeys-=<:> foldmethod " Python PEP-8 au BufNewFile,BufRead *.py \ set tabstop=4 | \ set softtabstop=4 | \ set shiftwidth=4 | \ set expandtab | \ set autoindent | \ set foldmethod=syntax | \ set fileformat=unix au BufNewFile,BufRead *.json \ set filetype=json | \ set foldmethod=syntax " But not for most files au BufNewFile,BufRead *.js, *.html, *.css \ set tabstop=2 | \ set softtabstop=2 | \ set shiftwidth=2 au BufNewFile,BufRead *.sls \ set filetype=sls au FileType gitcommit setlocal nowrap au FileType go set expandtab! "au BufRead,BufNewFile *.yml, *.yaml set filetype=yaml.ansible "au BufNewFile,BufRead *.hcl, *.tf " \ set filetype=terraform "au BufNewFile,BufRead *.md, *.MD " \ set filetype=markdown " Flag bad whitespace " I hate this because it highlights while i'm writing "highlight BadWhitespace ctermfg=16 ctermbg=253 guifg=#000000 guibg=#F8F8F0 "au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /[^\s]\s\+$/ let g:terraform_fold_sections=1 let g:terraform_align=1 let g:terraform_fmt_on_save=1 let g:syntastic_python_python_exec = 'python3' let g:syntastic_python_checkers = ['python'] let g:syntastic_sh_checkers = ['shellcheck'] augroup black_on_save autocmd! autocmd BufWritePre *.py Black augroup end au BufRead * normal zR " Ignore some markdown checks " MD012 - Multiple consecutive blank lines " MD013 - Line length in markdown " MD026 - Trailing punctuation in header " MD029 - Ordered lists. It wants everything with 1., 1., 1., " MD034 - Bare URL in markdown " We hate line length checks let g:syntastic_quiet_messages = { \ "regex": '\(MD012\|MD013\|MD026\|MD029\|MD034|[Ll]ine [Ll]ength\)' \ }