2015-12-29 21:26:04 +01:00
|
|
|
|
|
|
|
" Interactive
|
|
|
|
nnoremap <buffer> <Leader>i :!irb -Ilib -r ./%<CR><CR>
|
|
|
|
|
|
|
|
" Indent
|
|
|
|
setlocal tabstop=2
|
|
|
|
setlocal shiftwidth=2
|
|
|
|
|
|
|
|
" Folding
|
2015-12-29 21:46:22 +01:00
|
|
|
function! RubyFold(lnum)
|
2015-12-29 21:26:04 +01:00
|
|
|
if getline(a:lnum) =~ '^\s*def\s' || getline(a:lnum) =~ '^\s*class\s' || getline(a:lnum) =~ '^\s*module\s'
|
|
|
|
return indent(a:lnum) / 2 + 1
|
|
|
|
endif
|
|
|
|
if getline(a:lnum) =~ '^\s*end'
|
|
|
|
return indent(a:lnum) / 2 + 1
|
|
|
|
endif
|
|
|
|
if getline(a:lnum - 1) =~ '^\s*end'
|
|
|
|
return indent(a:lnum - 1) / 2
|
|
|
|
endif
|
|
|
|
return '='
|
|
|
|
endfunction
|
|
|
|
|
2015-12-29 21:46:22 +01:00
|
|
|
function! RubyFoldText()
|
2015-12-29 21:26:04 +01:00
|
|
|
return getline(v:foldstart) . ' +'
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
setlocal foldmethod=expr
|
|
|
|
setlocal foldexpr=RubyFold(v:lnum)
|
|
|
|
setlocal foldtext=RubyFoldText()
|
|
|
|
|
|
|
|
" Use rake as makeprogram
|
|
|
|
setlocal makeprg=rake
|
|
|
|
|