Skip to content

Instantly share code, notes, and snippets.

@evansb
Last active August 29, 2015 14:10
Show Gist options
  • Save evansb/7360f167cc0176d81366 to your computer and use it in GitHub Desktop.
Save evansb/7360f167cc0176d81366 to your computer and use it in GitHub Desktop.
set encoding=utf-8
scriptencoding utf-8
set nocompatible
filetype off
"let $PATH='/Users/evan/.opam/system/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/evan/School/Haskell/.cabal-sandbox/bin:/Users/evan/.cabal/bin'
if has("gui_running")
set guifont=Source\ Code\ Pro\ Medium:h14
endi
set rtp+=~/.vim/bundle/vundle
call vundle#begin()
runtime bundles.vim
call vundle#end()
" YouCompleteMe
let g:ycm_min_num_chars_for_completion = 2
let g:ycm_ycm_extra_conf = 1
let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'
let g:ycm_path_to_python_interpreter = '/usr/local/bin/python'
let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
let g:ycm_auto_trigger = 1
let g:ycm_filetype_whitelist = { 'c': 1,
\ 'cpp': 1,
\ 'python': 1,
\ 'haskell': 1}
let g:ycm_semantic_triggers = {
\ 'c' : ['->', '.'],
\ 'objc' : ['->', '.'],
\ 'ocaml' : ['.', '#'],
\ 'haskell' : ['.'],
\ 'cpp,objcpp' : ['->', '.', '::'],
\ 'perl' : ['->'],
\ 'php' : ['->', '::'],
\ 'cs,java,javascript,d,vim,python,perl6,scala,vb,elixir,go' : ['.'],
\ 'ruby' : ['.', '::'],
\ 'lua' : ['.', ':'],
\ 'erlang' : [':'],
\ }
"Syntastic
let g:syntastic_auto_jump = 2
let g:syntastic_auto_loc_list = 0
let g:syntastic_ocaml_checkers = ['camlp4']
let g:syntastic_javascript_checkers = ['jslint']
let g:syntastic_python_checkers = ['pyflakes']
let g:syntastic_haskell_checkers = ['hlint']
let g:syntastic_html_checkers = []
let g:syntastic_cpp_compiler = 'clang++'
let g:syntastic_cpp_compiler_options = ' --analyze -std=c++11 -stdlib=libc+'
let g:syntastic_mode_map = { 'mode': 'active',
\ 'active_filetypes': ['c','cpp', 'python', 'haskell', 'ocaml'],
\ 'passive_filetypes': ['puppet'] }
let g:syntastic_always_populate_loc_list=1
let g:syntastic_check_on_open=1
let g:ghcmod_ghc_options = ['-fno-warn-missing-signatures', '-fno-warn-unused-do-bind']
let g:syntastic_haskell_ghc_mod_args = '-g -fno-warn-missing-signatures -fno-warn-unused-do-bind'
" Easy Motion
let g:EasyMotion_leader_key = '<Leader>'
" Airline
let g:airline_theme = 'gruvbox'
let g:airline_detect_modified = 1
let g:airline_detect_paste = 1
let g:airline_powerline_fonts=1
let g:airline#extensions#tagbar#enabled = 1
let g:airline#extensions#branch#enabled = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#syntastic#enabled = 1
let g:airline#extensions#tmuxline#enabled = 1
let g:airline#extensions#whitespace#enabled = 1
let g:airline#extensions#whitespace#checks = [ 'indent', 'trailing']
let g:airline_mode_map = {
\ '__' : '-',
\ 'n' : 'N',
\ 'i' : 'I',
\ 'R' : 'R',
\ 'c' : 'C',
\ 'v' : 'VL',
\ 'V' : 'VB',
\ '' : 'Vsl',
\ 's' : 'LSbs',
\ }
"ctrlP configuration
let g:ctrlp_map = '<C-p>'
let g:ctrlp_cmd = 'CtrlPMixed'
let g:ctlrp_custom_ignore = '\v[\/]\.(git|hg|svn|o)$'
let g:ctlrp_working_path_mode = 'c'
"Gundo
nnoremap <Leader>g :GundoToggle<CR>
"SuperTab
let g:SuperTabContextDefaultCompletionType = "<c-n>"
filetype plugin on
filetype indent on
filetype on
"Cursor
set guicursor=n-v-c-i:block-Cursor
set guicursor+=n-v-c-i:blinkon0
" Basic configuration
set t_Co=256
set history=700
set showmode!
set number
set columns=80
set colorcolumn=80
set lines=35
set textwidth=80
set cino=L0,l1,g1,h1,N-s,t0,(0,w1,W2s
set formatoptions=croq
set splitright
set guioptions-=r
set guioptions-=L
set shortmess+=I
set noswapfile
set visualbell
set ttyfast
set showcmd
set synmaxcol=128
set lazyredraw
set showmatch
set title
set autoread
set autowrite
set formatoptions-=o
set backspace=indent,eol,start
set whichwrap+=<,>,h,l
set linespace=1
set history=40
set expandtab
set shiftwidth=4
set tabstop=4
set softtabstop=4
set autoindent
set smartindent
set incsearch
set hlsearch
set ignorecase
set smartcase
set wrap
set linebreak
set wildmenu
set nofoldenable
set hidden
set autochdir
nnoremap J mzJ`z
nnoremap j gj
nnoremap k gk
nnoremap <space> /
nnoremap <c-space> ?
nnoremap ; :
syntax enable
nnoremap <Esc> <Esc>:noh<CR><Esc>
vnoremap < <gv
vnoremap > >gv
nnoremap es A;<Esc>;
nnoremap E $
nnoremap B 0
inoremap jj <ESC>
" Eye Candy
colorscheme gruvbox
set background=dark
set laststatus=2
" Quick Shortcut
nnoremap <Leader>C :tabedit ~/.vimrc<CR>
nnoremap <F2> :NERDTreeToggle<CR>
nnoremap <F3> :Tagbar<CR>
nnoremap <F4> :GundoToggle<CR>
" Emacs-style Window Tiling
nnoremap <C-x>o <Esc><C-W>w
nnoremap <C-x>3 <Esc>:vsp<CR>
nnoremap <C-x>2 <Esc>:sp<CR>
nnoremap <C-x>1 <Esc>:only<CR>
nnoremap <Down> <C-W>j<C-W>_
nnoremap <Up> <C-W>k<C-W>_
nnoremap <Right> <C-W>l<C-W>_
nnoremap <Left> <C-W>h<C-W>_
" Custom Function
function! DeleteTrailingWS()
exe "normal mz"
%s /\s\+$//ge
exe "normal `z"
endfunc
"Fix indentation
map <F7> mzgg=G`z<CR>
"Dispatch
nnoremap <F9> :Dispatch<CR>
autocmd FileType java let b:dispatch = 'javac %'
autocmd FileType cpp let b:dispatch = 'c++ -std=c++11 -O3 -o a % && ./a'
autocmd FileType python let b:dispatch = 'ipython %'
autocmd FileType haskell let b:dispatch = 'runhaskell %'
autocmd FileType html let b:dispatch = 'open %'
autocmd FileType ocaml let b:dispatch = 'corebuild ' + expand('%:r') + 'native'
autocmd FileType ocaml :DelimitMateOff
" Omni completion
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc
augroup filetype_help
autocmd!
autocmd BufWinEnter,FileType help set winheight=9999
augroup END
au BufWrite * :call DeleteTrailingWS()
function! ReplaceDate()
:g:\d\{2}/\d\{2}/\d\{4}:s/\//\./g
endfunc
set t_Co=256
let g:tagbar_type_haskell = {
\ 'ctagsbin' : 'hasktags',
\ 'ctagsargs' : '-x -c -o-',
\ 'kinds' : [
\ 'm:modules:0:1',
\ 'd:data: 0:1',
\ 'd_gadt: data gadt:0:1',
\ 't:type names:0:1',
\ 'nt:new types:0:1',
\ 'c:classes:0:1',
\ 'cons:constructors:1:1',
\ 'c_gadt:constructor gadt:1:1',
\ 'c_a:constructor accessors:1:1',
\ 'ft:function types:1:1',
\ 'fi:function implementations:0:1',
\ 'o:others:0:1'
\ ],
\ 'sro' : '.',
\ 'kind2scope' : {
\ 'm' : 'module',
\ 'c' : 'class',
\ 'd' : 'data',
\ 't' : 'type'
\ },
\ 'scope2kind' : {
\ 'module' : 'm',
\ 'class' : 'c',
\ 'data' : 'd',
\ 'type' : 't'
\ }
\ }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment