Skip to content

Instantly share code, notes, and snippets.

@brennancheung
Created June 29, 2019 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brennancheung/acd9268a1296a78305d214d463123d74 to your computer and use it in GitHub Desktop.
Save brennancheung/acd9268a1296a78305d214d463123d74 to your computer and use it in GitHub Desktop.
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'L9'
Plugin 'int3/vim-extradite'
Plugin 'scrooloose/syntastic'
Plugin 'scrooloose/nerdtree'
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'scrooloose/nerdcommenter'
Plugin 'kchmck/vim-coffee-script'
Plugin 'wavded/vim-stylus'
Plugin 'elzr/vim-json'
Plugin 'pangloss/vim-javascript', { 'for': 'javascript' }
Plugin 'digitaltoad/vim-jade.git'
Plugin 'bling/vim-bufferline'
Plugin 'airblade/vim-gitgutter'
Plugin 'godlygeek/tabular'
Plugin 'rking/ag.vim'
Plugin 'Shougo/vimproc.vim'
Plugin 'Shougo/neomru.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'nathanaelkane/vim-indent-guides'
Plugin 'SirVer/ultisnips'
Plugin 'Shougo/unite.vim'
Plugin 'terryma/vim-expand-region'
Plugin 'bling/vim-airline'
Plugin 'flazz/vim-colorschemes'
Plugin 'lambdatoast/elm.vim'
Plugin 'mattn/emmet-vim', { 'for': ['javascript.jsx', 'html', 'css'] }
Plugin 'nono/vim-handlebars'
Plugin 'mxw/vim-jsx'
Plugin 'jiangmiao/auto-pairs'
Plugin 'sickill/vim-pasta'
Plugin 'MarcWeber/vim-addon-mw-utils'
Plugin 'tomtom/tlib_vim'
Plugin 'garbas/vim-snipmate'
Plugin 'tpope/vim-surround'
Plugin 'eagletmt/ghcmod-vim'
Plugin 'eagletmt/neco-ghc'
Plugin 'Shougo/neocomplete.vim'
Plugin 'mustache/vim-mustache-handlebars'
Plugin 'rust-lang/rust.vim'
Plugin 'cespare/vim-toml'
Plugin 'jparise/vim-graphql'
Plugin 'w0rp/ale'
call vundle#end()
filetype plugin indent on
" set tabstop=4 softtabstop=4 shiftwidth=4 expandtab
set tabstop=2 softtabstop=2 shiftwidth=2 expandtab
set number autoindent ignorecase smartcase showcmd showmode ruler hlsearch nowrap
set textwidth=0 wrapmargin=0 " turn off annoying auto wrapping
set noeb vb t_vb= " get rid of annoying beeping
set noswapfile
set nobackup
set timeoutlen=200 ttimeoutlen=0
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
" let g:syntastic_javascript_eslint_exec = '/Users/brennan/code/react-scaffold/node_modules/.bin/eslint'
" let g:syntastic_javascript_eslint_exec = '/Users/brennan/moovweb/automatic-checkout/node_modules/.bin/eslint'
" let g:syntastic_javascript_eslint_args = "--rule 'semi: 0' --rule 'comma-dangle: 0' --rule 'no-console: 0' "
" let g:syntastic_javascript_eslint_exec = 'eslint_d'
" let g:syntastic_javascript_eslint_args = "--rule 'no-console: 0' --rule 'no-constant-condition: 0'"
" let g:syntastic_javascript_checkers = ['eslint']
" 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
let g:ale_linters_explicit = 1
let b:ale_linters = ['eslint']
let b:ale_fixers = ['eslint']
let g:airline#extensions#ale#enabled = 1
highlight clear ALEErrorSign
highlight clear ALEWarningSign
let g:ale_sign_error = '❌'
" let g:ale_sign_error = '💩'
" let g:ale_sign_error = '💥'
" let g:ale_sign_error = '⽕'
" let g:ale_sign_error = '⚡'
" let g:ale_sign_error = '•'
" let g:ale_sign_error = '🐞'
" let g:ale_sign_error = '☢'
let g:ale_sign_warning = '⚠️'
" let g:ale_sign_warning = '•'
"
let g:ale_linters = {'javascript': ['eslint'], 'jsx': ['eslint']}
let g:jsx_ext_required = 0
if has("gui_running")
" Color Scheme
set background=dark
" colorscheme candyman
colorscheme hybrid
set guifont=DejaVu\ Sans\ Mono\ for\ Powerline:h17
let g:airline_powerline_fonts = 1
set guioptions-=r
set guioptions-=L
endif
set background=dark
colorscheme hybrid
let g:airline_powerline_fonts = 1
" Power user shit
let mapleader = "\<Space>"
nnoremap <Leader>b :Gblame<cr>
nnoremap <Leader>c :CoffeeWatch vert<cr><C-w>l
nnoremap <Leader>x :q<cr>
map <C-s> :vsp<cr><C-w>l
map <C-v> :sp<cr><C-w>j
imap <C-c> <Esc>
" Emmet
" workaround for the fact that emmet is truncating the last 2 characters of
" the expansion
imap <C-o> <C-c>a<C-p>
imap <C-k> <C-c>a<C-p><cr><C-c>O
let g:user_emmet_expandabbr_key = '<C-p>'
let user_emmet_expandabbr_key = '<C-p>'
let g:user_emmet_settings = {
\ 'javascript.jsx' : {
\ 'extends' : 'jsx',
\ },
\}
" Autopairs toggling
let g:AutoPairsShortcutToggle = 'π'
autocmd FileType html,css,jsx,javascript.jsx EmmetInstall
autocmd FileType jsx set syntax=javascript.jsx
autocmd FileType js set syntax=javascript.jsx
autocmd FileType .eslint set syntax=javascript.jsx
autocmd FileType .babelrc set syntax=javascript.jsx
" Snipmate
imap kj <esc>a<Plug>snipMateNextOrTrigger
smap kj <Plug>snipMateNextOrTrigger
" prettier / linting
nnoremap <Leader>k :silent %!prettier --stdin --print-width 120 --trailing-comma all --single-quote<CR>
nnoremap <Leader>j :silent %!prettier --stdin --print-width 120 --single-quote --no-semi<CR>
nnoremap <Leader>f mF:%!eslint_d --stdin --fix-to-stdout<CR>`F
" Airline
set laststatus=2
" Having a hard time finding the filename for the window with so much crap
" everywhere. Simplify to make it easier to see.
"let g:airline#extensions#tabline#enabled = 0
"let g:airline_section_a = '%#__accent_bold#%{airline#util#wrap(airline#parts#mode(),0)}%#__restore__#%{airline#util#append(airline#parts#paste(),0)}%{airline#util#append("",0)}%{airline#util#append(airline#parts#iminsert(),0)}'
let g:airline_section_a = ''
"let g:airline_section_b = '%{airline#util#wrap(airline#extensions#hunks#get_hunks(),0)}%{airline#util#wrap(airline#extensions#branch#get_head(),0)}'
"let g:airline_section_b = '%{airline#util#wrap(airline#extensions#branch#get_head(),0)}'
let g:airline_section_b = ''
let g:airline_section_c = '%t' " filename
let g:airline_section_x = '' " tagbar, filetype, virtualenv
let g:airline_section_y = '' " fileencoding, fileformat
" Unite
let g:unite_source_history_yank_enable = 1
let g:unite_source_file_rec_max_cache_files = 200000
let g:unite_source_rec_async_command='ag --nocolor --nogroup --hidden -g ""'
let g:unite_source_grep_command='ag'
let g:unite_source_grep_default_opts='-i --line-numbers --nocolor --nogroup --hidden -p /Users/brennan/.agignore'
call unite#filters#matcher_default#use(['matcher_fuzzy'])
"call unite#custom#source('file_mru,file_rec,file_rec/async,grepocate','max_candidates', 0)
autocmd FileType unite call s:unite_settings()
function! s:unite_settings()
imap <buffer> <C-j> <Plug>(unite_select_next_line)
imap <buffer> <C-k> <Plug>(unite_select_previous_line)
endfunction
nnoremap <Leader>a :UniteBookmarkAdd<cr><cr><cr>
nnoremap <Leader>s :Unite -no-split -buffer-name=bookmarks -start-insert bookmark<cr>
nnoremap <Leader>d :Unite -no-split -buffer-name=buffer -start-insert buffer<cr>
nnoremap <Leader>y :Unite -no-split -buffer-name=yanks history/yank<cr>
" nnoremap <Leader><Space> :Unite -no-split -buffer-name=filenav -start-insert bookmark buffer file_rec/async:!<cr>
nnoremap <Leader><Space> :Unite -no-split -buffer-name=filenav -start-insert bookmark buffer file_rec/git<cr>
" nnoremap <Leader>f :Unite -no-split -buffer-name=filenav -auto-preview -start-insert -winheight=40 bookmark buffer file_rec/async:!<cr>
nnoremap <Leader>g :Unite -no-split -no-quit -auto-preview -winheight=40 -start-insert grep:.<cr>
nnoremap <Leader>r <Plug>(unit_redraw)
noremap <Leader>2 :set tabstop=2 softtabstop=2 shiftwidth=2 expandtab<cr>
noremap <Leader>4 :set tabstop=4 softtabstop=4 shiftwidth=4 expandtab<cr>
" Unite / Angular
nnoremap <Leader>t :UniteWithBufferDir -no-split -buffer-name=templates -start-insert -input=.jade file<cr>
nnoremap <Leader>c :UniteWithBufferDir -no-split -buffer-name=controllers -start-insert -input=_ctrl.coffee file<cr>
" NERDTree
let NERDTreeQuitOnOpen = 1
let g:NERDTreeWinSize = 80
" Open NERDTree in the directory of the current file (or /home if no file is open)
nmap <silent> <C-n> :call NERDTreeToggleInCurDir()<cr>
function! NERDTreeToggleInCurDir()
" If NERDTree is open in the current buffer
if (exists("t:NERDTreeBufName") && bufwinnr(t:NERDTreeBufName) != -1)
exe ":NERDTreeClose"
else
exe ":NERDTreeFind"
endif
endfunction
" NERDCommenter
let NERDCreateDefaultMappings = 0
let NERDSpaceDelims = 1
nmap <C-_> <Plug>NERDCommenterToggle<cr>
vmap - <Plug>NERDCommenterToggle<cr>
" vim-indent-guides ( default binding is <Leader>ig )
nnoremap <C-i> :IndentGuidesToggle<cr>
" vim-expand-region
"vmap v <Plug>(expand_region_expand)
"vmap <C-v> <Plug>(expand_region_expand)
nnoremap <Leader>e v<Plug>(expand_region_expand)<Plug>(expand_region_expand)
" Tabularize
vmap <silent> = :Tabularize /=<cr>
vmap <silent> ; :Tabularize /:\zs<cr>
" Extradite
let g:extradite_width = 200
nnoremap <Leader>z :Extradite!<cr>
syntax on
set cursorline
set scrolloff=5
" Make window navigation easier
map <C-h> <C-W>h
map <C-j> <C-W>j
"map <C-k> <C-W>k
map <C-l> <C-W>l
set nottyfast
syntax on
filetype on
au BufNewFile,BufRead *.ract set filetype=handlebars
" haskell
" let g:haskellmode_completion_ghc=0
" let g:ycm_semantic_triggers = {'haskell' : ['.']}
" autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc
" map <silent> tw :GhcModTypeInsert<CR>
" map <silent> ts :GhcModSplitFunCase<CR>
" map <silent> tq :GhcModType<CR>
" map <silent> te :GhcModTypeClear<CR>
"Note: This option must be set in .vimrc(_vimrc). NOT IN .gvimrc(_gvimrc)!
"" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
let g:neocomplete#enable_at_startup = 1
let g:neocomplete#enable_smart_case = 1
let g:neocomplete#sources#syntax#min_keyword_length = 3
" surround hotkeys when in visual mode
" vmap <space> S(%
" vmap
S{%
" vmap <C-j> S'
" vmap <C-k> S"
" mustache config
"let g:mustache_abbreviations = 1
let g:syntastic_html_tidy_quiet_messages = { "level" : "warnings" }
let g:syntastic_html_tidy_ignore_errors = [
\ 'plain text isn''t allowed in <table> elements',
\ 'plain text isn''t allowed in <tr> elements',
\ 'plain text isn''t allowed in <head> elements',
\ '<base> escaping malformed URI reference',
\ 'discarding unexpected <body>',
\ '<script> escaping malformed URI reference',
\ '</head> isn''t allowed in <body> elements',
\ '<amp-carousel> is not recognized!',
\ '<amp-img> is not recognized!',
\ '<amp-state> is not recognized!',
\ ]
" Python
let g:pymode_rope=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment