Skip to content

Instantly share code, notes, and snippets.

@mdarby
Created March 8, 2011 15:11
Show Gist options
  • Select an option

  • Save mdarby/860390 to your computer and use it in GitHub Desktop.

Select an option

Save mdarby/860390 to your computer and use it in GitHub Desktop.
set guioptions=aAce " Turn of MacVim's toolbar, scrollbars, etc.
set transparency=0 " No transparency
set guifont=Monaco:h12 " Default font
set list " Show special characters
set backspace=indent,eol,start " Make backspace behave
set nohidden " Close the buffer when I close the tab
set splitright " Open vertical splits to the right
set splitbelow " Open horizontal splits to the bottom
set foldmethod=syntax " Fold based on the code at hand
set foldnestmax=3 " Only fold three levels
set autoread " Read in changed files
set magic " Better regexes
set nobackup " Dont' worry about backing up files
set noswapfile
set vb " Tired of that noise.
color mdarby " Vanity
" Highlight the current line
set cul
hi CursorLine term=none cterm=none ctermbg=5
" Use arrow keys to move buffers
map <up> <C-w>k<cr>
map <down> <C-w>j<cr>
map <left> <C-w>h<cr>
map <right> <C-w>l<cr>
" Search mappings: These will make it so that going to the next one in a
" search will center on the line it's found in.
map n Nzz
map n nzz
" Map \w to close a buffer
map <Leader>w :bd<cr>
" Map \R to :Rake
map <Leader>R :Rake<cr>
" Map \r to :.Rake
map <Leader>r :.Rake<cr>
" Reindent the entire file
map <Leader>I gg=G``<cr>
" I don't need RSI.
imap jj <Esc>:write<cr>
" Keep visual blocks around
vmap < <gv
vmap > >gv
" Easier mapping for LustyJuggler
map bb :LustyJuggler<cr>
" Automatically strip whitespace
autocmd! BufWrite * mark ' | silent! %s/\s\+$// | norm ''
" Don't search these directories via Command-T
set wildignore+=tmp,coverage,doc,script,log,vendor,autotest,.git
" Show git stuff in the status line
set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P
" When vimrc is edited, reload it
autocmd! bufwritepost vimrc.local source ~/.vimrc.local
" Remove the Windows ^M - when the encodings gets messed up
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
" Toggle folds with spacebar
nnoremap <space> za
" Enable RSpec snippets in spec files
au BufNewFile,BufRead *_spec.rb set filetype=ruby.rspec.rspec_rails.factory_girl
" Sudo write the file
cmap w!! %!sudo tee > /dev/null %
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment