Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
222 lines (180 sloc) 6.65 KB
set nocompatible
call pathogen#infect()
set backspace=indent,eol,start
set nobackup
set history=100 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set incsearch " do incremental searching
set number " show absolute line numbers
set splitbelow " Open hsplits below the current one
set splitright " Open vsplits to the right of the current one
set cursorline " Highlight the row the cursor is on
set spellfile=~/.vim/custom-spellings.en.add
set guifont=Inconsolata:h16
set guioptions-=T
set nofoldenable
set wildmode=longest,list:longest " bash like command line tab completion
set virtualedit=block,onemore " Allow moving past the end of the line
set scrolloff=11 " Provide eleven lines of context
let g:miniBufExplForceSyntaxEnable = 1 " re-enable syntax
set mouse=nir " Enable mouse for scrolling in terminal
set path+=**
set colorcolumn=81
" Tab-complete options
set complete=.,w,b,u,t,kspell
set completeopt=longest,menu
" Global Undo
set undofile
set undodir=~/.vimundo
" No backup, no wwapfile
set nobackup
set noswapfile
" Per-project .vimrc files
set exrc
set secure
" This will use the unnamed register as the system clipboard
set clipboard=unnamed
" Coloration
if &t_Co > 2 || has("gui_running") " &t_Co => terminal has colors
set t_Co=256
set background=dark
let g:gruvbox_italic = 0
colorscheme gruvbox
syntax on
set hlsearch
set list listchars=tab:»·,trail:·
if has("autocmd")
filetype plugin on
filetype indent on
augroup myFileTypeSettings
" delete all autocommand settings in this group
au! BufRead,BufNewFile .autotest setfiletype ruby
au! BufRead,BufNewFile *.haml setfiletype haml
au! BufRead,BufNewFile *.sass setfiletype sass
au! BufRead,BufNewFile *.textile setfiletype textile
autocmd FileType text setlocal textwidth=78
" 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
augroup END
" From
augroup BWCCreateDir
autocmd BufWritePre * if expand("<afile>")!~#'^\w\+:/' && !isdirectory(expand("%:h")) | execute "silent! !mkdir -p ".shellescape(expand('%:h'), 1) | redraw! | endif
augroup END
endif " has("autocmd")
" Softtabs, 2 spaces
set tabstop=2
set shiftwidth=2
set expandtab
" If possible, try to use a narrow number column.
if v:version >= 700
setlocal numberwidth=3
" Who types this, really?
inoremap jj <Esc>
" Remap autocomplete to Tab
inoremap <Tab> <C-N>
inoremap <S-Tab> <C-P>
" No Help, please
nnoremap <F1> <Esc>
" Display extra whitespace
set list listchars=tab:»·,trail:·
" There's really no reason to not navigate by screen line
nnoremap <Down> g<Down>
nnoremap <Up> g<Up>
" Extradite, git history browser
nnoremap <F11> :Extradite!<cr>
let g:extradite_width = 80
" Easier to remember Redo
noremap U :redo<Enter>
" Move around splits with Option
inoremap <M-Left> <Esc><C-W><Left>
inoremap <M-Right> <Esc><C-W><Right>
inoremap <M-Up> <Esc><C-W><Up>
inoremap <M-Down> <Esc><C-W><Down>
noremap <M-Left> <C-W><Left>
noremap <M-Right> <C-W><Right>
noremap <M-Up> <C-W><Up>
noremap <M-Down> <C-W><Down>
" Press Shift+P while in visual mode to replace the selection without
" overwriting the default register
vnoremap P p :call setreg('"', getreg('0')) <CR>
" Use <C-x>s as the implementation of z= instead
nnoremap z= i<C-x>s
" Leader mappings
map <Leader>h :nohls<Enter>
nmap <Leader>= mmgg=G`mzz
nmap <Leader>; lF:xepldf>
nmap <Leader>ve :tabedit $MYVIMRC<CR>
nmap <Leader>vr :source $MYVIMRC<CR>
nmap <Leader>x :exec getline(".")<CR>
nmap <Leader>d Orequire 'pry'; binding.pry<Esc>:w<CR>
nmap <Leader>sao Osave_and_open_page<Esc>:w<CR>
map <Leader>ee :e <C-R>=expand("%:p:h") . '/'<CR>
map <Leader>es :split <C-R>=expand("%:p:h") . '/'<CR>
map <Leader>ev :vnew <C-R>=expand("%:p:h") . '/'<CR>
map <Leader>q gqip
map <Leader>diff jdV/====<CR>kd:vne<CR>P<C-w>hjV/>>>><CR>kd:vne<CR>P:diffthis<C-w>l:diffthis<CR>
nnoremap \| :Explore<CR>
" rspec mappings
noremap <Leader>t :call RunCurrentSpecFile()<CR><C-l>
noremap <Leader>s :call RunNearestSpec()<CR><C-l>
noremap <Leader>l :call RunLastSpec()<CR><C-l>
noremap <Leader>r :call RunRake()<CR><C-l>
" regreplop.vim
nnoremap <silent> R <Plug>ReplaceMotion
nnoremap <silent> RR <Plug>ReplaceLine
vnoremap <silent> R <Plug>ReplaceVisual
" vim-quicklink
vnoremap <silent> H :call ConvertVisualSelectionToLink()<cr>
" Actually do searching with the silver searcher if available
cnoreabbrev ag grep
if executable("ag")
set grepprg=ag\ --nogroup\ --nocolor\ --column
" 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
" Search the project for the word under the cursor.
nnoremap K :silent grep "<C-R><C-W>"<CR><C-L>
autocmd QuickFixCmdPost *grep* cwindow
" Treat <li> and <p> tags like the block tags they are
let g:html_indent_tags = 'li\|p'
" Settings for Markdown
au BufRead,BufNewFile *.md set filetype=markdown
au BufRead,BufNewFile *.md setlocal spell
au BufRead,BufNewFile *.md setlocal textwidth=80
" Dispatch
noremap <F12> :Dispatch<CR>
"au BufRead */test/* let b:dispatch = "bundle exec ruby -I test %"
"au BufRead */test/* let g:rspec_command = "m"
"au BufRead */test/* compiler! rubyunit
"au BufRead */spec/*_spec.rb let b:dispatch = "bundle exec rspec %"
"au BufRead */spec/*_spec.rb let g:rspec_command = "bundle exec rspec %"
"au BufRead */spec/*_spec.rb compiler! rspec
let g:rspec_command = "bundle exec rspec"
let g:rspec_additional_command = ""
" Syntastic
let g:syntastic_check_on_open = 1
let g:syntastic_ruby_exec = '/usr/local/rubies/mri-2.1.1/bin/ruby'
let g:syntastic_always_populate_loc_list = 1
" Use line cursor in insert mode, block in normal (only in tmux)
if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
Something went wrong with that request. Please try again.