.vimrc 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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 = '/opt/homebrew/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. " set the runtime path to include Vundle and initialize
  42. set rtp+=~/.vim/bundle/Vundle.vim
  43. call vundle#begin()
  44. " alternatively, pass a path where Vundle should install plugins
  45. "call vundle#begin('~/some/path/here')
  46. " let Vundle manage Vundle, required
  47. Plugin 'gmarik/Vundle.vim'
  48. " The following are examples of different formats supported.
  49. " Keep Plugin commands between vundle#begin/end.
  50. " plugin on GitHub repo
  51. "Plugin 'tpope/vim-fugitive'
  52. " plugin from http://vim-scripts.org/vim/scripts.html
  53. "Plugin 'L9'
  54. " Git plugin not hosted on GitHub
  55. "Plugin 'git://git.wincent.com/command-t.git'
  56. " git repos on your local machine (i.e. when working on your own plugin)
  57. "Plugin 'file:///home/gmarik/path/to/plugin'
  58. " The sparkup vim script is in a subdirectory of this repo called vim.
  59. " Pass the path to set the runtimepath properly.
  60. "Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
  61. " Avoid a name conflict with L9
  62. "n 'fatih/vim-go'Plugin 'user/L9', {'name': 'newL9'}
  63. " Go Plugin:
  64. "Plugin 'fatih/vim-go'
  65. Plugin 'vim-scripts/indentpython.vim'
  66. Plugin 'hashivim/vim-terraform'
  67. Plugin 'vim-syntastic/syntastic'
  68. "Plugin 'juliosueiras/vim-terraform-completion'
  69. Plugin 'saltstack/salt-vim'
  70. Plugin 'psf/black'
  71. " All of your Plugins must be added before the following line
  72. call vundle#end() " required
  73. filetype plugin indent on " required
  74. " To ignore plugin indent changes, instead use:
  75. "filetype plugin on
  76. "
  77. " Brief help
  78. " :PluginList - lists configured plugins
  79. " :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
  80. " :PluginSearch foo - searches for foo; append `!` to refresh local cache
  81. " :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
  82. "
  83. " see :h vundle for more details or wiki for FAQ
  84. " Put your non-Plugin stuff after this line
  85. set tabstop=2
  86. set shiftwidth=2
  87. set expandtab
  88. " Python PEP-8
  89. au BufNewFile,BufRead *.py
  90. \ set tabstop=4 |
  91. \ set softtabstop=4 |
  92. \ set shiftwidth=4 |
  93. \ set expandtab |
  94. \ set autoindent |
  95. \ set foldmethod=syntax |
  96. \ set fileformat=unix
  97. au BufNewFile,BufRead *.json
  98. \ set filetype=json |
  99. \ set foldmethod=syntax
  100. " But not for most files
  101. au BufNewFile,BufRead *.js, *.html, *.css
  102. \ set tabstop=2 |
  103. \ set softtabstop=2 |
  104. \ set shiftwidth=2
  105. au BufNewFile,BufRead *.sls
  106. \ set filetype=sls
  107. au FileType gitcommit setlocal nowrap
  108. au FileType go set expandtab!
  109. "au BufNewFile,BufRead *.hcl, *.tf
  110. " \ set filetype=terraform
  111. "au BufNewFile,BufRead *.md, *.MD
  112. " \ set filetype=markdown
  113. " Flag bad whitespace
  114. " I hate this because it highlights while i'm writing
  115. "highlight BadWhitespace ctermfg=16 ctermbg=253 guifg=#000000 guibg=#F8F8F0
  116. "au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /[^\s]\s\+$/
  117. let g:terraform_fold_sections=1
  118. let g:terraform_align=1
  119. let g:terraform_fmt_on_save=1
  120. let g:syntastic_python_python_exec = 'python3'
  121. let g:syntastic_python_checkers = ['python']
  122. let g:syntastic_sh_checkers = ['shellcheck']
  123. augroup black_on_save
  124. autocmd!
  125. autocmd BufWritePre *.py Black
  126. augroup end
  127. au BufRead * normal zR