apt install curl vim 
gem install rubocop

mkdir -p ~/.vim/autoload ~/.vim/bundle && curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
echo 'execute pathogen#infect()' >> ~/.vimrc

cd ~/.vim/bundle && git clone --depth=1 https://github.com/vim-syntastic/syntastic.git
echo "let g:syntastic_ruby_checkers = ['rubocop', 'mri']" >> ~/.vimrc

cat ~/.vimrc

set encoding=utf-8
set fileencoding=utf-8
set incsearch
set hlsearch 
colorscheme desert
syntax on
set nu
set number
set ts=2
set sw=2
filetype plugin indent on

"""""""""""""""""""""""""""""
"set autoread
"set foldmethod=marker
runtime! defaults.vim
let g:skip_defaults_vim = 1
set mouse=
set autoindent
" Load all plugins now.
" " Plugins need to be added to runtimepath before helptags can be generated.
packloadall
" " Load all of the helptags now, after plugins have been loaded.
" " All messages and errors will be ignored.
silent! helptags ALL
execute pathogen#infect()
let g:syntastic_ruby_checkers = ['rubocop', 'mri']

function! RubocopAutocorrect()
        set autoread
        write
  execute "!rubocop -a " . bufname("%")
  call SyntasticCheck()
        set noautoread
endfunction

let mapleader=","
map <silent> <Leader>c :call RubocopAutocorrect()<cr>

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
Minimalist
colorscheme desert
syntax on
set nu
set number
set ts=2
set sw=2
runtime! defaults.vim
let g:skip_defaults_vim = 1
set mouse=
set expandtab
map <F2> :retab <CR>
colorscheme desert
syntax on
set nu
set number
set ts=2
set sw=2
"set autoread
"set foldmethod=marker
runtime! defaults.vim
let g:skip_defaults_vim = 1
set mouse=

" Load all plugins now.
" " Plugins need to be added to runtimepath before helptags can be generated.
packloadall
" " Load all of the helptags now, after plugins have been loaded.
" " All messages and errors will be ignored.
silent! helptags ALL
execute pathogen#infect()
let g:syntastic_ruby_checkers = ['rubocop', 'mri']

function! RubocopAutocorrect()
        set autoread
        write
  execute "!rubocop -a " . bufname("%")
  call SyntasticCheck()
        set noautoread
endfunction

let mapleader=","
map <silent> <Leader>c :call RubocopAutocorrect()<cr>

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

.rubocop.yml

AllCops:
  DisplayCopNames: true
  DisplayStyleGuide: true
  ExtraDetails: false
  TargetRubyVersion: 2.6


#https://blog.dnsimple.com/2018/06/quick-tips-for-practical-rubocop-workflow/

AllCops:
  DisplayCopNames: true
  DisplayStyleGuide: true
  ExtraDetails: true
  TargetRubyVersion: 2.7
  NewCops: enable
  EnabledByDefault: true
  DefaultFormatter: progress
  UseCache: true



Style/Copyright:
  Enabled: false

Metrics/AbcSize:
  Max: 729

Metrics/BlockLength:
  Max: 270

Metrics/BlockNesting:
  Max: 6

Metrics/ClassLength:
  Max: 1766

Metrics/CyclomaticComplexity:
  Max: 138

Metrics/MethodLength:
  Max: 490

Metrics/ParameterLists:
  Max: 7

Metrics/PerceivedComplexity:
  Max: 157

Layout/LineLength:
  Max: 160
 
Style/MissingElse:
  Enabled: false

Style/DocumentationMethod:
  Enabled: false

Style/IpAddresses:
  Enabled: false