.vimrc 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. set nocompatible " be iMproved, required
  2. filetype off " required
  3. syntax on
  4. set encoding=utf-8
  5. set ruler " Show us our row and column
  6. let g:python3_host_prog = '/usr/bin/python3'
  7. " Accomodate a dark background
  8. set background=dark
  9. if empty(glob('~/.vim/autoload/plug.vim'))
  10. silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
  11. \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  12. autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
  13. endif
  14. call plug#begin('~/.vim/plugged')
  15. " (Optinal) for Tag Sidebar
  16. " Plug 'majutsushi/tagbar'
  17. "Plug 'hashivim/vim-terraform'
  18. "Plug 'vim-syntastic/syntastic'
  19. "Plug 'juliosueiras/vim-terraform-completion'
  20. call plug#end()
  21. " Syntastic Config
  22. set statusline+=%#warningmsg#
  23. set statusline+=%{SyntasticStatuslineFlag()}
  24. set statusline+=%*
  25. let g:syntastic_always_populate_loc_list = 1
  26. let g:syntastic_auto_loc_list = 1
  27. let g:syntastic_check_on_open = 1
  28. let g:syntastic_check_on_wq = 0
  29. " (Optional)Remove Info(Preview) window
  30. set completeopt-=preview
  31. " (Optional)Hide Info(Preview) window after completions
  32. autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
  33. autocmd InsertLeave * if pumvisible() == 0|pclose|endif
  34. " (Optional) Enable terraform plan to be include in filter
  35. let g:syntastic_terraform_tffilter_plan = 1
  36. " (Optional) Default: 0, enable(1)/disable(0) plugin's keymapping
  37. let g:terraform_completion_keys = 1
  38. " (Optional) Default: 1, enable(1)/disable(0) terraform module registry completion
  39. let g:terraform_registry_module_completion = 0
  40. let g:pymode_python = 'python3'
  41. let g:pymode_options_max_line_length = 110
  42. let g:pymode_lint_options_pep8 = {'max_line_length': g:pymode_options_max_line_length}
  43. let g:pymode_options_colorcolumn = 1
  44. " set the runtime path to include Vundle and initialize
  45. set rtp+=~/.vim/bundle/Vundle.vim
  46. call vundle#begin()
  47. " alternatively, pass a path where Vundle should install plugins
  48. "call vundle#begin('~/some/path/here')
  49. " let Vundle manage Vundle, required
  50. Plugin 'gmarik/Vundle.vim'
  51. " The following are examples of different formats supported.
  52. " Keep Plugin commands between vundle#begin/end.
  53. " plugin on GitHub repo
  54. "Plugin 'tpope/vim-fugitive'
  55. " plugin from http://vim-scripts.org/vim/scripts.html
  56. "Plugin 'L9'
  57. " Git plugin not hosted on GitHub
  58. "Plugin 'git://git.wincent.com/command-t.git'
  59. " git repos on your local machine (i.e. when working on your own plugin)
  60. "Plugin 'file:///home/gmarik/path/to/plugin'
  61. " The sparkup vim script is in a subdirectory of this repo called vim.
  62. " Pass the path to set the runtimepath properly.
  63. "Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
  64. " Avoid a name conflict with L9
  65. "n 'fatih/vim-go'Plugin 'user/L9', {'name': 'newL9'}
  66. " Go Plugin:
  67. "Plugin 'fatih/vim-go'
  68. Plugin 'vim-scripts/indentpython.vim'
  69. Plugin 'hashivim/vim-terraform'
  70. Plugin 'vim-syntastic/syntastic'
  71. "Plugin 'juliosueiras/vim-terraform-completion'
  72. Plugin 'saltstack/salt-vim'
  73. Plugin 'psf/black'
  74. Plugin 'vim-autoformat/vim-autoformat'
  75. "Plugin 'pearofducks/ansible-vim'
  76. "Plugin 'mrk21/yaml-vim'
  77. au BufWrite * :Autoformat
  78. " All of your Plugins must be added before the following line
  79. call vundle#end() " required
  80. filetype plugin indent on " required
  81. " To ignore plugin indent changes, instead use:
  82. "filetype plugin on
  83. "
  84. " Brief help
  85. " :PluginList - lists configured plugins
  86. " :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
  87. " :PluginSearch foo - searches for foo; append `!` to refresh local cache
  88. " :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
  89. "
  90. " see :h vundle for more details or wiki for FAQ
  91. " Put your non-Plugin stuff after this line
  92. set tabstop=2
  93. set shiftwidth=2
  94. set expandtab
  95. " Fix auto-indentation for YAML files
  96. "augroup yaml_fix
  97. " autocmd!
  98. " autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab indentkeys-=0# indentkeys-=<:>
  99. "augroup END
  100. "autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab indentkeys-=0# indentkeys-=<:> foldmethod
  101. " Python PEP-8
  102. au BufNewFile,BufRead *.py
  103. \ set tabstop=4 |
  104. \ set softtabstop=4 |
  105. \ set shiftwidth=4 |
  106. \ set expandtab |
  107. \ set autoindent |
  108. \ set foldmethod=syntax |
  109. \ set fileformat=unix
  110. au BufNewFile,BufRead *.json
  111. \ set filetype=json |
  112. \ set foldmethod=syntax
  113. " But not for most files
  114. au BufNewFile,BufRead *.js, *.html, *.css
  115. \ set tabstop=2 |
  116. \ set softtabstop=2 |
  117. \ set shiftwidth=2
  118. au BufNewFile,BufRead *.sls
  119. \ set filetype=sls
  120. au FileType gitcommit setlocal nowrap
  121. au FileType go set expandtab!
  122. "au BufRead,BufNewFile *.yml, *.yaml set filetype=yaml.ansible
  123. "au BufNewFile,BufRead *.hcl, *.tf
  124. " \ set filetype=terraform
  125. "au BufNewFile,BufRead *.md, *.MD
  126. " \ set filetype=markdown
  127. " Flag bad whitespace
  128. " I hate this because it highlights while i'm writing
  129. "highlight BadWhitespace ctermfg=16 ctermbg=253 guifg=#000000 guibg=#F8F8F0
  130. "au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /[^\s]\s\+$/
  131. let g:terraform_fold_sections=1
  132. let g:terraform_align=1
  133. let g:terraform_fmt_on_save=1
  134. let g:syntastic_python_python_exec = 'python3'
  135. let g:syntastic_python_checkers = ['python']
  136. let g:syntastic_sh_checkers = ['shellcheck']
  137. augroup black_on_save
  138. autocmd!
  139. autocmd BufWritePre *.py Black
  140. augroup end
  141. au BufRead * normal zR
  142. " Ignore some markdown checks
  143. " MD012 - Multiple consecutive blank lines
  144. " MD013 - Line length in markdown
  145. " MD026 - Trailing punctuation in header
  146. " MD029 - Ordered lists. It wants everything with 1., 1., 1.,
  147. " MD034 - Bare URL in markdown
  148. " We hate line length checks
  149. let g:syntastic_quiet_messages = {
  150. \ "regex": '\(MD012\|MD013\|MD026\|MD029\|MD034|[Ll]ine [Ll]ength\)'
  151. \ }