Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: bd7df0bcea
Fetching contributors…

Cannot retrieve contributors at this time

183 lines (146 sloc) 4.535 kb
" NOTICE! The vimpagerrc file is a subset of this, please check that
" what is being changed here is updated there if it exists.
set nocompatible
call pathogen#helptags()
call pathogen#runtime_append_all_bundles()
let mapleader = ","
set backspace=indent,eol,start
set cursorline
set hidden
set laststatus=2
set nojoinspaces
set nowrap
set number
set ruler
set scrolloff=3
set sidescrolloff=3
set showcmd
set splitbelow splitright
set title
set wildignore+=*.class,*.o,.DS_Store
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/tmp/**,*/build/*,*/*.dSYM/*
set wildmenu
" Store backup & swap files elsewhere to avoid directory pollution
set backupdir=~/.vim/tmp,/tmp
set directory=~/.vim/tmp,/tmp
" Write all writeable buffers when changing buffers or losing focus.
autocmd FocusLost * silent! wall
set autowriteall
" ...but not for fugitive buffers
autocmd BufReadPost fugitive://* set bufhidden=delete
" Search settings
set ignorecase
set incsearch
set smartcase
set hlsearch
nnoremap <silent> <leader><leader>h :set hlsearch!<CR>
nnoremap <silent> <leader>h :nohlsearch<CR>
" Indentation settings (soft tabs, two spaces)
set autoindent
set expandtab
set shiftwidth=2
set smartindent
set smarttab
set tabstop=2
set list listchars=tab:»·,trail:·
filetype plugin indent on
" Persistent undo
set undodir=~/.vim/undo
set undofile
set undolevels=1000
if has('gui_running') || $TERM_PROGRAM != 'Apple_Terminal'
set background=dark
colorscheme solarized
if $TERM_PROGRAM == 'Apple_Terminal'
set nocursorline
" Highlight if there is color
if(&t_Co > 2 || has("gui_running"))
syntax on
" Copy current file path to system pasteboard.
map <silent> <D-C> :let @* = expand("%")<CR>:echo "Copied: ".expand("%")<CR>
elseif(has("unix") || has("win32"))
map <silent> <C-C> :let @* = expand("%")<CR>:echo "Copied: ".expand("%")<CR>
" Paste yanked text in command mode
cnoremap <D-C> <C-R>"
" Toggle spell check
map <leader>ss :setlocal spell!<cr>
" Map :W to :w to make holding shift too long work
cmap W w
" Make Y consistent with D and C.
map Y y$
" Indent/unindent visual mode selection with tab/shift+tab
vmap <tab> >gv
vmap <s-tab> <gv
" CtrlP
let g:ctrlp_max_height=20
let g:ctrlp_match_window_reversed=0
let g:ctrlp_use_caching=0
map <D-N> :CtrlP<CR>
map <leader>b :CtrlPBuffer<CR>
map <D-e> :CtrlPBuffer<CR>
map <leader>e :e#<CR>
" Indent Guides
let g:indent_guides_auto_colors = 0
autocmd VimEnter,Colorscheme * :hi link IndentGuidesOdd Normal
autocmd VimEnter,Colorscheme * :hi link IndentGuidesEven CursorLine
" Gundo
nnoremap <leader>u :GundoToggle<CR>
" NERDCommenter
let NERDSpaceDelims = 1
map <leader>/ <plug>NERDCommenterToggle
" NERDTree
map \ :NERDTreeToggle<CR>
map \| :NERDTreeFind<CR>
" Splitjoin
nmap <leader>j :SplitjoinJoin<CR>
nmap <leader>s :SplitjoinSplit<CR>
" Syntastic
let g:syntastic_enable_signs=1
" Tlist
map <leader>l :TlistToggle<CR>
" ZoomWin
map <leader>z :ZoomWin<CR>
" Delete trailing whitespace
func! DeleteTrailingWhitespace()
exec "normal mZ"
exec "normal `Z"
autocmd BufWritePre *.{c,cpp,h,hpp,m,mm} :call DeleteTrailingWhitespace()
autocmd BufWritePre *.{erb,feature,haml,rb,yml} :call DeleteTrailingWhitespace()
autocmd BufWritePre *.{css,html,js,json,less,sass,xml} :call DeleteTrailingWhitespace()
autocmd BufWritePre *.{java,php} :call DeleteTrailingWhitespace()
" Associate some filetypes with their proper syntax
autocmd BufRead,BufNewFile *.applescript set filetype=applescript
autocmd BufRead,BufNewFile *.json set filetype=javascript
autocmd BufRead,BufNewFile *.prawn set filetype=ruby
autocmd BufRead,BufNewFile *.txt set filetype=text
autocmd FileType scss set iskeyword=@,48-57,_,-,?,!,192-255
" Enable soft-wrapping for text files
autocmd FileType eruby,html,markdown,text,xhtml setlocal wrap linebreak nolist
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
" Automatically load .vimrc source when saved
autocmd BufWritePost .vimrc source $MYVIMRC
augroup END
if filereadable($HOME . "/.vimrc_local")
source ~/.vimrc_local
Jump to Line
Something went wrong with that request. Please try again.