.vimrc 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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. au BufWrite * :Autoformat
  76. " All of your Plugins must be added before the following line
  77. call vundle#end() " required
  78. filetype plugin indent on " required
  79. " To ignore plugin indent changes, instead use:
  80. "filetype plugin on
  81. "
  82. " Brief help
  83. " :PluginList - lists configured plugins
  84. " :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
  85. " :PluginSearch foo - searches for foo; append `!` to refresh local cache
  86. " :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
  87. "
  88. " see :h vundle for more details or wiki for FAQ
  89. " Put your non-Plugin stuff after this line
  90. set tabstop=2
  91. set shiftwidth=2
  92. set expandtab
  93. " Python PEP-8
  94. au BufNewFile,BufRead *.py
  95. \ set tabstop=4 |
  96. \ set softtabstop=4 |
  97. \ set shiftwidth=4 |
  98. \ set expandtab |
  99. \ set autoindent |
  100. \ set foldmethod=syntax |
  101. \ set fileformat=unix
  102. au BufNewFile,BufRead *.json
  103. \ set filetype=json |
  104. \ set foldmethod=syntax
  105. " But not for most files
  106. au BufNewFile,BufRead *.js, *.html, *.css
  107. \ set tabstop=2 |
  108. \ set softtabstop=2 |
  109. \ set shiftwidth=2
  110. au BufNewFile,BufRead *.sls
  111. \ set filetype=sls
  112. au FileType gitcommit setlocal nowrap
  113. au FileType go set expandtab!
  114. "au BufNewFile,BufRead *.hcl, *.tf
  115. " \ set filetype=terraform
  116. "au BufNewFile,BufRead *.md, *.MD
  117. " \ set filetype=markdown
  118. " Flag bad whitespace
  119. " I hate this because it highlights while i'm writing
  120. "highlight BadWhitespace ctermfg=16 ctermbg=253 guifg=#000000 guibg=#F8F8F0
  121. "au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /[^\s]\s\+$/
  122. let g:terraform_fold_sections=1
  123. let g:terraform_align=1
  124. let g:terraform_fmt_on_save=1
  125. let g:syntastic_python_python_exec = 'python3'
  126. let g:syntastic_python_checkers = ['python']
  127. let g:syntastic_sh_checkers = ['shellcheck']
  128. augroup black_on_save
  129. autocmd!
  130. autocmd BufWritePre *.py Black
  131. augroup end
  132. au BufRead * normal zR
  133. " Ignore some markdown checks
  134. " MD012 - Multiple consecutive blank lines
  135. " MD013 - Line length in markdown
  136. " MD026 - Trailing punctuation in header
  137. " MD029 - Ordered lists. It wants everything with 1., 1., 1.,
  138. " MD034 - Bare URL in markdown
  139. " We hate line length checks
  140. let g:syntastic_quiet_messages = {
  141. \ "regex": '\(MD012\|MD013\|MD026\|MD029\|MD034|[Ll]ine [Ll]ength\)'
  142. \ }