cpjolicoeur /slicehost_vimrc

.vimrc from slicehost "rush slice
" os x backspace fix
set backspace=indent,eol,start
"set t_kb
fixdel

" tabs -> spaces
set expandtab
set tabstop=2
set softtabstop=2
set shiftwidth=2

" turn mouse on
" set mouse=a

" space = pagedown, - = pageup
noremap  
noremap - 

" remap'd keys
map  w
nnoremap  :set invhls hls?  " use f5f5 to toggle search hilight
nnoremap  :set invwrap wrap? " use f4f4 to toggle wordwrap
nnoremap  :vsplit
nnoremap  w

function RubyEndToken ()
  let current_line = getline( '.' )
  let braces_at_end = '{\s*\(|\(,\\s\|\w\)*|\s*\)\?$'
  let stuff_without_do = '^\s*\(class\|if\|unless\|begin\|case\|for\|moddule\|while\|until\|def\)'
  let with_do = 'do\s*\(|\(,\|\s\|\w\)*|\s*\)\?$'

  if match(current_line, braces_at_end) >= 0
    return "\}\O"
  elseif match(current_line, stuff_without_do) >= 0
    return "\end\O"
  elseif match(current_line, with_do) >= 0
    return "\end\O"
  else
    return "\"
  endif
endfunction

imap   =RubyEndToken()

" backup to ~/.tmp
set backup
set backupdir=$HOME/.tmp
set writebackup

" misc
"set ai
set nohls
set incsearch
set showcmd
set nowrap

syntax on   " enable syntax highlighting
filetype on   " enable filetype detection
filetype indent on  " filetype specific indentation
filetype plugin on  " filetype specific plugins

" :alias
com VR :vertical resize 80