Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.67 KB | None | 0 0
  1. function! StrTrim(txt)
  2. return substitute(a:txt, '^\n*\s*\(.\{-}\)\n*\s*$', '\1', '')
  3. endfunction
  4.  
  5. " plugins
  6. call plug#begin('~/.vim/plugged')
  7.  
  8. " chrome
  9. Plug 'bling/vim-airline'
  10. Plug 'vim-airline/vim-airline-themes'
  11.  
  12. Plug 'bling/vim-bufferline'
  13. let g:airline#extensions#tabline#enabled = 1
  14. let g:airline#extensions#tabline#buffer_nr_show = 1
  15. let g:airline_powerline_fonts = 1
  16.  
  17. Plug 'mattn/webapi-vim'
  18. Plug 'mattn/gist-vim'
  19. Plug 'airblade/vim-gitgutter'
  20. au FileType gitcommit set tw=72 " auto-wrap git commits at col 72
  21.  
  22. Plug 'tmux-plugins/vim-tmux'
  23.  
  24. " color theme
  25. Plug 'dracula/vim'
  26. let g:airline_theme='dracula'
  27.  
  28. " Golang
  29. Plug 'Valloric/YouCompleteMe', {'for': 'go'}
  30. Plug 'fatih/vim-go'
  31. let g:go_fmt_command = "goimports"
  32. let g:go_metalinter_autosave = 1
  33. let g:go_metalinter_autosave_enabled = ['vet', 'golint']
  34. let g:go_auto_type_info = 1
  35. let g:go_auto_sameids = 1
  36. let g:go_gocode_unimported_packages = 1
  37. let g:go_highlight_functions = 1
  38. let g:go_highlight_methods = 1
  39. let g:go_highlight_fields = 1
  40. let g:go_highlight_types = 1
  41. let g:go_highlight_operators = 1
  42. let g:go_highlight_build_constraints = 1
  43. au FileType go autocmd BufWritePre <buffer> Fmt
  44. let g:syntastic_go_gofmt_s = 1
  45.  
  46. " Markdown
  47. Plug 'godlygeek/tabular'
  48. Plug 'plasticboy/vim-markdown'
  49. let g:vim_markdown_fenced_languages = ['bash=sh']
  50. au FileType markdown setlocal tw=80
  51.  
  52. Plug 'wannesm/wmgraphviz.vim'
  53. let g:WMGraphviz_output = 'svg'
  54.  
  55. Plug 'elzr/vim-json'
  56. au FileType json setlocal sw=2 ts=2 et
  57.  
  58. Plug 'vim-ruby/vim-ruby'
  59. au FileType ruby setlocal sw=2 ts=2 et
  60.  
  61. Plug 'docker/docker'
  62. au FileType dockerfile setlocal sw=8 ts=8 noet tw=80
  63.  
  64. Plug 'hashivim/vim-terraform'
  65. au FileType tf setlocal sw=2 ts=2 et
  66. let g:terraform_fmt_on_save = 1
  67.  
  68. " others
  69. Plug 'vim-syntastic/syntastic'
  70. Plug 'myint/syntastic-extras'
  71. let g:syntastic_javascript_eslint_exec = StrTrim(system('npm-which eslint'))
  72. let g:syntastic_javascript_eslint_args = ['--fix']
  73. let g:syntastic_cfg_checkers = ['cfg']
  74. let g:syntastic_make_checkers = ['gnumake']
  75. let g:syntastic_javascript_checkers = ['eslint']
  76. let g:syntastic_gitcommit_checkers = ['language_check']
  77. let g:syntastic_yaml_checkers = ['pyyaml']
  78.  
  79. " enable autoread to reload any files from files when checktime is called and
  80. " the file is changed
  81. set autoread
  82.  
  83. " add an autocmd after vim started to execute checktime for *.js files on write
  84. au VimEnter *.js au BufWritePost *.js checktime
  85.  
  86. " don't make me think
  87. Plug 'chiel92/vim-autoformat'
  88. au BufWrite *.json :Autoformat
  89. Plug 'tpope/vim-surround'
  90. Plug 'ciaranm/detectindent'
  91. Plug 'nathanaelkane/vim-indent-guides'
  92. Plug 'roman/golden-ratio'
  93. Plug 'scrooloose/nerdcommenter'
  94. filetype plugin on
  95. Plug 'terryma/vim-multiple-cursors'
  96. let g:multi_cursor_start_key='<C-n>'
  97. let g:multi_cursor_start_word_key='g<C-n>'
  98. call plug#end()
  99.  
  100. syntax on
  101. color dracula
  102.  
  103. " red for anything past col 80
  104. hi OverLength ctermfg=124
  105. match OverLength /\%81v.\+/
  106. " line numbers with styling
  107. set number
  108. set relativenumber
  109. set cursorline
  110. hi CursorLineNr ctermbg=none
  111. hi LineNr ctermbg=none
  112. hi GitGutterAdd ctermbg=none ctermfg=2
  113. hi GitGutterChange ctermbg=none ctermfg=3
  114. hi GitGutterDelete ctermbg=none ctermfg=1
  115. hi GitGutterChangeDelete ctermbg=none ctermfg=1
  116. set noshowmode
  117. set backspace=2
  118. set laststatus=2
  119. set ignorecase
  120. set incsearch
  121. set hlsearch
  122. set clipboard=unnamed " use system pasteboard
  123.  
  124. au BufWritePre <buffer> :%s/\s\+$//e " remove trailing whitespace on save
  125. filetype plugin indent on
  126. set sw=2 ts=2 et " globally use 2-spacewidth expanded tabs
  127. au FileType sshconfig setlocal sw=4 ts=4 noet
  128.  
  129. set spell spelllang=en_us
  130.  
  131. " sane paste
  132. let &t_SI .= "\<Esc>[?2004h"
  133. let &t_EI .= "\<Esc>[?2004l"
  134. inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
  135. function! XTermPasteBegin()
  136. set pastetoggle=<Esc>[201~
  137. set paste
  138. return ""
  139. endfunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement