Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

421 lines (344 sloc) 11.441 kB
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle "gmarik/vundle"
" begin vundle packages
"" NOTE: Vundle is broken in that adding comments to the end of lines with a
"" Bundle call results in things breaking. Sorry for the lack of documentation
"" of my installed packages here, but two lines per package is too much space
"" for my taste..
"" File and buffer management
Bundle "sjbach/lusty.git"
Bundle "bufkill.vim"
Bundle ""
Bundle "scrooloose/nerdtree.git"
"" Interaction with external processes
Bundle "sjl/clam.vim.git"
Bundle "sjl/vitality.vim.git"
Bundle "tpope/vim-eunuch.git"
Bundle "benmills/vimux.git"
Bundle "tpope/vim-fugitive.git"
Bundle "tpope/vim-bundler.git"
Bundle "ardagnir/eventloop.vim"
Bundle "ardagnir/pterosaur"
"" Movement and normal-mode improvements
Bundle "bkad/CamelCaseMotion.git"
Bundle "tpope/vim-surround.git"
Bundle "Lokaltog/vim-easymotion.git"
Bundle "tpope/vim-speeddating.git"
Bundle "terryma/vim-multiple-cursors.git"
"" Colors and UI
Bundle "altercation/vim-colors-solarized.git"
Bundle "tpope/vim-abolish.git"
Bundle "sjl/gundo.vim.git"
Bundle "tpope/vim-unimpaired.git"
"" Completion and syntax assistance
Bundle "Raimondi/delimitMate.git"
Bundle "scrooloose/nerdcommenter.git"
Bundle "scrooloose/syntastic.git"
Bundle "ervandew/supertab.git"
Bundle "majutsushi/tagbar.git"
Bundle "chrisbra/unicode.vim.git"
"" Language/Framework Specific
Bundle "othree/html5.vim.git"
Bundle "tpope/vim-markdown.git"
Bundle "pangloss/vim-javascript.git"
Bundle "tpope/vim-rails.git"
Bundle "tpope/vim-endwise.git"
Bundle "tpope/vim-haml.git"
Bundle "ap/vim-css-color.git"
Bundle "vim-ruby/vim-ruby.git"
Bundle "cakebaker/scss-syntax.vim.git"
Bundle "jcfaria/Vim-R-plugin.git"
Bundle "tpope/vim-rake.git"
Bundle "jceb/vim-orgmode.git"
" end vundle
filetype plugin indent on
syntax on
" Source a local configuration file if available - this may be used to turn on
" various contentious features below. These features can be found by
" searching for g:vimlocal in this file
if filereadable(expand("~/.vimrc.local"))
source ~/.vimrc.local
" Always assume a 256 color terminal
set t_Co=256
let g:solarized_termcolors=256
" Basic environment
set nocompatible
set shell=/bin/bash
set fileformats=unix,mac,dos
set encoding=utf-8
set termencoding=utf-8
set fileencoding=utf-8
set scrolloff=3
set autoindent
set showmode
set showcmd
set hidden
set wildmenu
set wildmode=list:longest,full
set visualbell
set cursorline
set ttyfast
set ruler
set backspace=indent,eol,start
set laststatus=2
set number
set history=1000
set shortmess=at " eliminate annoying 'Press ENTER or type command to continue' notices
let mapleader = ","
let maplocalleader = ",,"
set nobackup " I have literally never used a vim backup file
set noswapfile " Swapfiles are irritating
" Use the home row!
nnoremap <up> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
nnoremap <right> <nop>
" Make j and k move up and down linewise even when wrapping
nnoremap j gj
nnoremap k gk
" Easy buffer navigation
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
map <leader>w <C-w>v<C-w>l
" Folding
set foldlevelstart=0
nnoremap <Space> za
vnoremap <Space> za
" fold HTML tag
noremap <leader>ft Vatzf
function! MyFoldText()
let line = getline(v:foldstart)
let nucolwidth = &fdc + &number * &numberwidth
let windowwidth = winwidth(0) - nucolwidth - 3
let foldedlinecount = v:foldend - v:foldstart
" expand tabs into spaces
let onetab = strpart(' ', 0, &tabstop)
let line = substitute(line, '\t', onetab, 'g')
let line = strpart(line, 0, windowwidth - 2 -len(foldedlinecount))
let fillcharcount = windowwidth - len(line) - len(foldedlinecount) - 4
return line . '…' . repeat(" ",fillcharcount) . foldedlinecount . '…' . ' '
set foldtext=MyFoldText()
" Remap manual key to nothing
nnoremap K <nop>
" Version 7.3 and up only
if v:version >= 730
set undofile
set undoreload=10000
set colorcolumn=90
function! g:ToggleNuMode()
if(&rnu == 1)
set nu
set rnu
nnoremap <leader>l :call g:ToggleNuMode()<cr>
" Security
" set modelines=0 " don't check modelines, could be dangerous
" Tabs/spaces
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
set textwidth=90
" Select range, then hit :SuperRetab($width) - by p0g and FallingCow
function! SuperRetab(width) range
silent! exe a:firstline . ',' . a:lastline . 's/\v%(^ *)@<= {'. a:width .'}/\t/g'
" Make Y not dumb -- makes it work from the cursor to the end of the line
nnoremap Y y$
" Searching
nnoremap / /\v
vnoremap / /\v
set ignorecase
set smartcase
set incsearch
set showmatch
set hlsearch
set gdefault
map <leader><space> :noh<cr>
runtime macros/matchit.vim
nnoremap <tab> %
vnoremap <tab> %
" so that search centers on the result line
map N Nzz
map n nzz
" Sort CSS
map <leader>S ?{<CR>jV/^\s*\}?$<CR>k:sort<CR>:noh<CR>
" Clean whitespace
map <leader>W :%s/\s\+$//<cr>:let @/=''<CR>
" Ack
map <leader>a :Ack
" Formatting
map <leader>q gqip
" re-hardwrap paragraphs of text
" Make
nmap <leader>m :make<cr>
" Redraw screen
nmap <leader>rd :redraw!<cr>
" QuickFix bar
nmap <silent> <leader>ff :QFix<cr>
nmap <leader>fn :cn<cr>
nmap <leader>fp :cp<cr>
command -bang -nargs=? QFix call QFixToggle(<bang>0)
function! QFixToggle(forced)
if exists("g:qfix_win") && a:forced == 0
unlet g:qfix_win
copen 10
let g:qfix_win = bufnr("$")
" Easier linewise reselection
map <leader>v V`]
" Create blank newlines and stay in normal mode
nnoremap <silent> zj o<Esc>
nnoremap <silent> zk O<Esc>
" Faster ESC
inoremap <ESC> <nop>
inoremap jk <ESC>
inoremap Jk <ESC>
inoremap JK <ESC>
" Swap ; and :
nnoremap ; :
"nnoremap : ;
vnoremap ; :
"vnoremap : ;
" Make selecting inside an HTML tag less dumb
nnoremap Vit vitVkoj
nnoremap Vat vatV
" Diff
nmap <leader>d :!git diff %<cr>
" Edit vim stuff.
nnoremap <leader>ev :vsplit $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
nnoremap <leader>es <C-w>s<C-w>j<C-w>L:e ~/.vim/snippets/<cr>
" Sudo to write
cmap w!! w !sudo tee % >/dev/null
" Easy filetype switching
" nnoremap _ :set
" Disable useless HTML5 junk
let g:event_handler_attributes_complete = 0
let g:rdfa_attributes_complete = 0
let g:microdata_attributes_complete = 0
let g:atia_attributes_complete = 0
" Save when losing focus
au FocusLost * :wa
" Stop it, hash key
inoremap # X<BS>#
" Show syntax highlighting groups for word under cursor
nmap <C-S> :call SynStack()<CR>
function! SynStack()
if !exists("*synstack")
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
" Shortcut for square brackets
onoremap id i[
onoremap ad a[
" Next ()
vnoremap <silent> inb :<C-U>normal! f(vib<cr>
onoremap <silent> inb :<C-U>normal! f(vib<cr>
vnoremap <silent> anb :<C-U>normal! f(vab<cr>
onoremap <silent> anb :<C-U>normal! f(vab<cr>
vnoremap <silent> in( :<C-U>normal! f(vi(<cr>
onoremap <silent> in( :<C-U>normal! f(vi(<cr>
vnoremap <silent> an( :<C-U>normal! f(va(<cr>
onoremap <silent> an( :<C-U>normal! f(va(<cr>
" Next {}
vnoremap <silent> inB :<C-U>normal! f{viB<cr>
onoremap <silent> inB :<C-U>normal! f{viB<cr>
vnoremap <silent> anB :<C-U>normal! f{vaB<cr>
onoremap <silent> anB :<C-U>normal! f{vaB<cr>
vnoremap <silent> in{ :<C-U>normal! f{vi{<cr>
onoremap <silent> in{ :<C-U>normal! f{vi{<cr>
vnoremap <silent> an{ :<C-U>normal! f{va{<cr>
onoremap <silent> an{ :<C-U>normal! f{va{<cr>
" Next []
vnoremap <silent> ind :<C-U>normal! f[vi[<cr>
onoremap <silent> ind :<C-U>normal! f[vi[<cr>
vnoremap <silent> and :<C-U>normal! f[va[<cr>
onoremap <silent> and :<C-U>normal! f[va[<cr>
vnoremap <silent> in[ :<C-U>normal! f[vi[<cr>
onoremap <silent> in[ :<C-U>normal! f[vi[<cr>
vnoremap <silent> an[ :<C-U>normal! f[va[<cr>
onoremap <silent> an[ :<C-U>normal! f[va[<cr>
" Next <>
vnoremap <silent> in< :<C-U>normal! f<vi<<cr>
onoremap <silent> in< :<C-U>normal! f<vi<<cr>
vnoremap <silent> an< :<C-U>normal! f<va<<cr>
onoremap <silent> an< :<C-U>normal! f<va<<cr>
" Next ''
vnoremap <silent> in' :<C-U>normal! f'vi'<cr>
onoremap <silent> in' :<C-U>normal! f'vi'<cr>
vnoremap <silent> an' :<C-U>normal! f'va'<cr>
onoremap <silent> an' :<C-U>normal! f'va'<cr>
" Next ""
vnoremap <silent> in" :<C-U>normal! f"vi"<cr>
onoremap <silent> in" :<C-U>normal! f"vi"<cr>
vnoremap <silent> an" :<C-U>normal! f"va"<cr>
onoremap <silent> an" :<C-U>normal! f"va"<cr>
" Skipreturn
inoremap <c-cr> <esc>A<cr>
inoremap <s-cr> <esc>A:<cr>
au BufNewFile,BufRead *.html nnoremap <s-cr> vit<esc>a<cr><esc>vito<esc>i<cr><esc>
set cf " enable error files and error jumping
:map <F3> :w ! -brief %<CR> " word count for *TeX files
inoreabbrev lorem Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
" Buffer Mappings
map <right> <ESC>:bn<RETURN> " right arrow (normal mode) switches buffers (excluding minibuf)
map <left> <ESC>:bp<RETURN> " left arrow (normal mode) switches buffers (excluding minibuf)
map <up> <ESC>:NERDTree<RETURN><ESC><C-W><C-W> " up arrow (normal mode) brings up a file list
map <down> <ESC>:w<RETURN> " down arrow (normal mode) brings up the buffer list
map <A-i> i <ESC>r " alt-i (normal mode) inserts a single char, and then switches back to normal
map <F12> ggVGg? " encrypt the file (toggle)
" HTML Filetype Settings
let g:do_xhtml_mappings = 'yes'
map <F8> :set nowrap!<CR>
" Some GUI/CLI only settings
if has("gui_running")
set go-=T
set bg=dark
hi normal guibg=black
set guifont=Inconsolata\ for\ Powerline
set transp=8
" Remap help key to be more useful
set fuoptions=maxvert,maxhorz
inoremap <F1> <ESC>:set invfullscreen<CR>a
nnoremap <F1> :set invfullscreen<CR>
vnoremap <F1> :set invfullscreen<CR>
set bg=dark
let g:solarized_visibility="high"
let g:solarized_termcolors=256
colorscheme solarized
" Yank text to the OS X clipboard
noremap <leader>y "*y
noremap <leader>yy "*Y
" Preserve indentation while pasting text from the OS X clipboard
noremap <leader>p :set paste<CR>:put *<CR>:set nopaste<CR>
" Grab all the other settings!
for f in split(glob('~/.vim/plugin/settings/*.vim'), '\n')
exe 'source' f
" below should be separated out into other files...
let g:SuperTabCrMapping = 0
let g:Tex_CompileRule_pdf = 'xelatex -interaction=nonstopmode -synctex=1 $*'
let g:Tex_ViewRule_pdf = 'open'
" so editing crontab on OS X isn't broken
au BufEnter /private/tmp/crontab.* setl backupcopy=yes
" So my emails don't have weird linebreaks
autocmd FileType mail setlocal fo+=awn
autocmd FileType mail set spell
set rtp+=/usr/local/lib/python2.7/site-packages/powerline/bindings/vim
" autocmd FileType ocaml source $HOME/.opam/system/share/typerex/ocp-indent/ocp-indent.vim
Jump to Line
Something went wrong with that request. Please try again.