Skip to content

Instantly share code, notes, and snippets.

@japgolly
Created February 10, 2012 00:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save japgolly/1784925 to your computer and use it in GitHub Desktop.
Save japgolly/1784925 to your computer and use it in GitHub Desktop.
.vimrc
call pathogen#infect()
set nobackup
set history=200
syntax on
filetype plugin indent on
set colorcolumn=121 " Margin on the right
set number " Show line numbers on the left
"let g:CSApprox_attr_map = { 'bold' : 'bold', 'italic' : '', 'sp' : '' }
set background=dark
let g:solarized_termcolors=256
"colorscheme solarized
colorscheme synic
" set cursorline
autocmd Filetype ruby setlocal ts=2 sw=2 expandtab
" Highlight any trailing spaces
highlight ExtraWhitespace ctermbg=red guibg=red
augroup WhitespaceMatch
" Remove ALL autocommands for the WhitespaceMatch group.
autocmd!
autocmd BufWinEnter * let w:whitespace_match_number =
\ matchadd('ExtraWhitespace', '\s\+$')
autocmd InsertEnter * call s:ToggleWhitespaceMatch('i')
autocmd InsertLeave * call s:ToggleWhitespaceMatch('n')
augroup END
function! s:ToggleWhitespaceMatch(mode)
let pattern = (a:mode == 'i') ? '\s\+\%#\@<!$' : '\s\+$'
if exists('w:whitespace_match_number')
call matchdelete(w:whitespace_match_number)
call matchadd('ExtraWhitespace', pattern, 10, w:whitespace_match_number)
else
" Something went wrong, try to be graceful.
let w:whitespace_match_number = matchadd('ExtraWhitespace', pattern)
endif
endfunction
" F2 toggles line numbers on the left
map <silent> <F2> :set nu!<CR>
" F3 toggles paste mode
map <F3> :set paste!<BAR>:set paste?<CR>
" CTRL-H gets ready for a search & replace with perl regex
map <C-H> :perldo s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment