Last active
December 19, 2019 16:05
-
-
Save johnelliott/255f88afd1138b01a562acb7ecf6ccb1 to your computer and use it in GitHub Desktop.
.vimrc.coworker.vim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unlet! skip_defaults_vim | |
if (filereadable($VIMRUNTIME .'/defaults.vim')) | |
source $VIMRUNTIME/defaults.vim | |
elseif (filereadable($VIMRUNTIME .'/vimrc_example.vim')) | |
source $VIMRUNTIME/vimrc_example.vim | |
endif | |
set noswapfile nobackup nojoinspaces gdefault ignorecase wildignorecase showcmd | |
set tabstop=4 expandtab softtabstop=2 shiftwidth=2 | |
set undodir=~/.vim/undo clipboard=unnamed | |
if &term =~ '^screen' | |
" tmux knows the extended mouse mode | |
"se ttym=xterm2 | |
"set mouse-=v | |
elseif has("mouse_sgr") | |
" tmux knows the extended mouse mode | |
set ttymouse=sgr | |
endif | |
if executable('rg') | |
set grepprg=rg\ --vimgrep\ $* | |
elseif executable('ag') | |
set grepprg=ag\ --vimgrep\ $* | |
endif | |
nnoremap <space>1 :call UseEslint()<CR>:ALELint<CR>:echom 'eslint'<CR> | |
nnoremap <space>2 :call UseStandard()<CR>:ALELint<CR>:echom 'standard'<CR> | |
nnoremap <space>3 :call UseSemiStandard()<CR>:ALELint<CR>:echom 'semistandard'<CR> | |
augroup javascript | |
autocmd! | |
autocmd bufnewfile,bufread *.gltf,.graphqlrc,.stylelintrc,.babelrc,.firebaserc,.eslintrc,.nycrc set ft=json | |
autocmd filetype json,rust,javascript,javascript.jsx,typescript setl ls=2 nu | |
autocmd filetype javascript,javascript.jsx,typescript nn <buffer> <space>l "lyiwoconsole.log('l', l);0 | |
autocmd bufnewfile,bufread *.test.js let b:ale_fix_on_save=0 | |
if executable('mdn') | |
autocmd filetype javascript,javascript.jsx setl kp=mdn | |
endif | |
aug end | |
let g:ale_set_balloons=1 | |
let g:sql_type_default = 'pgsql' | |
" | |
"javascript | |
let g:jsx_ext_required = 0 " Highlight .js as .jsx | |
"linter setup | |
let g:ale_set_balloons=1 | |
let g:ale_fix_on_save = 1 | |
let g:ale_linters = { 'javascript': ['eslint'], 'css': ['stylelint'], 'html': ['stylelint'] } | |
let g:ale_fixers = { 'javascript': ['eslint'], 'css': ['stylelint'], 'html': ['stylelint'] } | |
func! UseEslint() | |
let eslintrc = findfile('.eslintrc', '.;') | |
if eslintrc != '' | |
let g:ale_linters.scss = ['stylelint'] | |
let g:ale_linters.css = ['stylelint'] | |
let g:ale_linters.javascript = ['eslint'] | |
let g:ale_linters.jsx = ['stylelint', 'eslint'] | |
let g:ale_linters['javascript.jsx'] = ['stylelint', 'eslint'] | |
let g:ale_fixers.scss = ['stylelint'] | |
let g:ale_fixers.css = ['stylelint'] | |
let g:ale_fixers.javascript = ['eslint', 'prettier'] | |
let g:ale_fixers['javascript.jsx'] = ['eslint', 'prettier'] | |
let g:ale_fixers.jsx = ['eslint', 'prettier'] | |
endif | |
endfunc | |
func! StandardLinters() | |
let g:ale_linters.scss = ['stylelint'] | |
let g:ale_linters.css = ['stylelint'] | |
let g:ale_linters.javascript = ['standard'] | |
let g:ale_linters.jsx = ['stylelint', 'standard'] | |
let g:ale_linters['javascript.jsx'] = ['stylelint', 'standard'] | |
let g:ale_fixers.scss = ['stylelint'] | |
let g:ale_fixers.css = ['stylelint'] | |
let g:ale_fixers.javascript = ['standard'] | |
let g:ale_fixers['javascript.jsx'] = ['standard'] | |
let g:ale_fixers.jsx = ['standard'] | |
endfunc | |
func! UseSemiStandard() | |
let node_modules = finddir('node_modules', '.;') | |
if len(node_modules) | |
let exec = node_modules . '/.bin/semistandard' | |
if executable(exec) | |
let g:ale_javascript_standard_executable = exec | |
let g:ale_javascript_eslint_use_global = 1 | |
call StandardLinters() | |
endif | |
endif | |
endfunc | |
func! UseStandard() | |
let node_modules = finddir('node_modules', '.;') | |
if len(node_modules) | |
let exec = node_modules . '/.bin/standard' | |
if executable(exec) | |
let g:ale_javascript_standard_executable = exec | |
let g:ale_javascript_eslint_use_global = 1 | |
call StandardLinters() | |
endif | |
endif | |
endfunc | |
if !empty(glob('~/.vim/autoload/plug.vim')) | |
call plug#begin() " https://github.com/junegunn/vim-plug | |
" Extensions | |
Plug 'airblade/vim-gitgutter' | |
Plug 'editorconfig/editorconfig-vim' | |
if executable('fzf') | |
Plug 'junegunn/fzf.vim' | |
Plug '/usr/local/opt/fzf' | |
endif | |
sil! Plug 'w0rp/ale' | |
" Languages | |
Plug 'Glench/Vim-Jinja2-Syntax' | |
Plug 'cakebaker/scss-syntax.vim', { 'for': ['scss', 'scss.css'] } | |
Plug 'cespare/vim-toml' | |
Plug 'chr4/nginx.vim' | |
Plug 'digitaltoad/vim-pug', | |
Plug 'ekalinin/Dockerfile.vim' | |
Plug 'jparise/vim-graphql' | |
Plug 'leafgarland/typescript-vim' | |
Plug 'lifepillar/pgsql.vim' | |
Plug 'moll/vim-node' | |
Plug 'mxw/vim-jsx', { 'for': ['javascript', 'javascript.jsx'] } | |
Plug 'pangloss/vim-javascript', { 'for': 'javascript' } | |
Plug 'stephenway/postcss.vim' | |
Plug 'andrewstuart/vim-kubernetes' | |
" Colorschemes | |
Plug 'NLKNguyen/papercolor-theme' | |
Plug 'chriskempson/vim-tomorrow-theme' | |
Plug 'jeffkreeftmeijer/vim-dim' | |
Plug 'morhetz/gruvbox' | |
Plug 'nanotech/jellybeans.vim' | |
Plug 'rakr/vim-one' | |
call plug#end() | |
endif | |
"call UseStandard() | |
"call UseSemiStandard() | |
call UseEslint() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment