Permalink
Find file
56e883c Dec 19, 2016
executable file 246 lines (199 sloc) 5.99 KB
" Vim
" ===
" Source ~/.vimrc.before if it exists
if filereadable(expand('~/.vimrc.before'))
source ~/.vimrc.before
endif
set nocompatible " be iMproved
filetype off " required!
call plug#begin('~/.vim/bundle')
Plug 'L9'
Plug 'chriskempson/base16-vim'
Plug 'christoomey/vim-tmux-navigator'
Plug 'plasticboy/vim-markdown'
Plug 'vim-ruby/vim-ruby'
Plug 'tpope/vim-surround'
Plug 'vim-scripts/ZoomWin'
Plug 'mattn/webapi-vim'
Plug 'tpope/vim-rails'
Plug 'tpope/vim-dispatch'
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
Plug 'godlygeek/tabular'
Plug 'scrooloose/nerdtree'
Plug 'mattn/gist-vim'
Plug 'epmatsw/ag.vim'
Plug 'tpope/vim-commentary'
Plug 'tmux-plugins/vim-tmux'
Plug 'ervandew/supertab'
Plug 'tpope/vim-rbenv'
Plug 'gem.vim'
Plug 'zerowidth/vim-copy-as-rtf'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'justinmk/vim-gtfo'
Plug 'jayflo/vim-skip'
Plug 'kchmck/vim-coffee-script'
Plug 'gcmt/wildfire.vim'
Plug 'fatih/vim-go'
Plug 'benmills/vim-golang-alternate'
Plug 'junegunn/vim-github-dashboard'
Plug 'cakebaker/scss-syntax.vim'
Plug 'tpope/vim-projectionist'
Plug 'tpope/vim-rake'
Plug 'junegunn/goyo.vim'
Plug 'junegunn/limelight.vim'
Plug 'ryanss/vim-hackernews'
Plug 'jiangmiao/auto-pairs'
Plug 'sheerun/vim-polyglot'
Plug 'mxw/vim-jsx'
call plug#end()
" Per-directory .vimrc files
set exrc
set secure
" Syntax
" ======
syntax on
syntax enable
set t_Co=256
" General Config
" ==============
let mapleader='\'
set gfn=Menlo:h14
set encoding=utf-8
set number " Line numbers are good
set backspace=indent,eol,start " Allow backspace in insert mode
set history=1000 " Store lots of :cmdline history
set showcmd " Show incomplete cmds down the bottom
set showmode " Show current mode down the bottom
set gcr=a:blinkon0 " Disable cursor blink
set autoread " Reload files changed outside vim
set laststatus=2 " Always show status line
set clipboard=unnamed " Use system clipboard
set hidden " Buffers can exist in the background
set splitright " Opens vertical split right of current window
set splitbelow " Opens horizontal split below current window
"set shortmess=filnxtToOI " see :help shortmess
" http://items.sjbach.com/319/configuring-vim-right
" Mouse
" ======
" Send more characters for redraws
set ttyfast
" Enable mouse use in all modes
set mouse=a
" Set this to the name of your terminal that supports mouse codes.
" Must be one of: xterm, xterm2, netterm, dec, jsbterm, pterm
set ttymouse=xterm2
" Search Settings
" ===============
set incsearch " Find the next match as we type the search
set hlsearch " Hilight searches by default
set viminfo='100,f1 " Save up to 100 marks, enable capital marks
" Turn Off Swap Files
" ===================
set noswapfile
set nobackup
set nowritebackup
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
" Persistent Undo
" ===============
" Keep undo history across sessions, by storing in file
" Only works in MacVim (gui) mode
if has('gui_running')
set undodir=~/.vim/backups
set undofile
" Hide the toolbar
set guioptions-=T
endif
" Indentation and Display
" =======================
set autoindent
set smartindent
set smarttab
set shiftwidth=2
set softtabstop=2
set tabstop=2
set expandtab
filetype plugin on
filetype indent on
set list listchars=tab:\ \ ,trail:· " Display tabs and trailing spaces visually
set nowrap " Don't wrap lines
set linebreak " Wrap lines at convenient points
" Folds
" =====
set foldmethod=indent " Fold based on indent
set foldnestmax=3 " Deepest fold is 3 levels
set nofoldenable " Don't fold by default
" Completion
" ==========
"set wildmode=list:longest
set wildmode=longest,list,full
set wildmenu " Enable ctrl-n and ctrl-p to scroll thru matches
set wildignore=*.o,*.obj,*~ " Stuff to ignore when tab completing
set wildignore+=*vim/backups*
" Scrolling
" =========
" Start scrolling when we're getting close to margins
set scrolloff=10
set sidescrolloff=15
set sidescroll=1
" Status Line
" ===========
set statusline= " Override default
set statusline+=%{fugitive#statusline()[4:-2]} " Show fugitive git info
set statusline+=\ %f\ %m\ %r " Show filename/path
set statusline+=%= " Set right-side status info after this line
set statusline+=%l/%L:%v " Set <line number>/<total lines>:<column>
set statusline+=\ " Set ending space
" NERDTree
" ========
function! ShowFileInNERDTree()
if exists("t:NERDTreeBufName")
NERDTreeFind
else
NERDTree
wincmd l
NERDTreeFind
endif
endfunction
map <leader>f :call ShowFileInNERDTree()<cr>
" Plugin overrides
source ~/.vim/autocmd.vim
source ~/.vim/format.vim
source ~/.vim/rails.vim
source ~/.vim/ruby.vim
source ~/.vim/common.vim
source ~/.vim/tmux.vim
source ~/.vim/ctrlp.vim
source ~/.vim/go.vim
source ~/.vim/goyo.vim
source ~/.vim/snippets.vim
source ~/.vim/writing.vim
let base16colorspace=256
set bg=dark
colorscheme base16-eighties
" Nerdtree
" ==========
let g:NERDTreeDirArrowExpandable = '+'
let g:NERDTreeDirArrowCollapsible = '-'
" Git Gutter
" ==========
let g:gitgutter_sign_column_always = 1
let g:gitgutter_eager = 0
" GH Dashboard
" ==========
let g:github_dashboard = { 'username': 'pengwynn', 'password': $GITHUB_TOKEN }
" JSX in .js files
" ==========
let g:jsx_ext_required = 0
" Searching
" ==========
if executable('ag')
" Use ag over grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
endif