aboutsummaryrefslogtreecommitdiffstats
path: root/ftplugin/ruby.vim
blob: e95b70f760d73053c6082e1dd3fcf78b440819cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
" Ruby vim settings

" Indentation
setlocal expandtab
setlocal tabstop=2
setlocal softtabstop=2
setlocal shiftwidth=2


" Don't preserve indentation on empty lines
inoremap <buffer> <CR> <CR>
nnoremap <buffer> o o
nnoremap <buffer> O O


" Debugging
nnoremap <buffer> Zd obyebug<Esc>
nnoremap <buffer> ZD Obyebug<Esc>


" RSpec
nnoremap <buffer> <leader>z :call RunCurrentSpecFile() \| call system("date '+%FT%T%z: z' >> ~/.vim/spec-stats.log")<cr>
nnoremap <buffer> <leader>Z :call RunNearestSpec() \| call system("date '+%FT%T%z: Z' >> ~/.vim/spec-stats.log")<cr>
nnoremap <buffer> 🕳 :call RunCurrentSpecFile() \| call system("date '+%FT%T%z: e' >> ~/.vim/spec-stats.log")<cr>
nnoremap <buffer> ⛳ :call RunNearestSpec() \| call system("date '+%FT%T%z: E' >> ~/.vim/spec-stats.log")<cr>


" Reset Rails test database
nnoremap <buffer> <F7> :!RAILS_ENV=test bundle exec rake db:reset<CR>


" Spring
command! -buffer FuckSpring :!bundle exec spring stop


" Convert from old to new hash syntax
" Example: :%RubyNewHashSyntax gc
command! -buffer -range -nargs=? RubyNewHashSyntax
	\ <line1>,<line2>substitute/\v:<(\w+)> \=\>/\1:/<args>