aboutsummaryrefslogtreecommitdiff
path: root/stow/vim/.vim/ftplugin/ruby/ruby.vim
blob: 41b806a4e45fb48c91b85b0b706047bde3b97722 (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
" ~/.vim/ftplugin/ruby/ruby.vim
" Ruby-specific vim configuration

" Tabs are expanded to 4 spaces
setlocal tabstop=2 shiftwidth=2 expandtab
" Show existing tabs (they can be deleted with :retab)
setlocal list

" Mappings
"
" For SonicPi

if expand('%:p') =~ 'sonicPi'

	let mapleader = " "

	nnoremap <buffer> <leader>C :sp ~/.vim/ftplugin/ruby/ruby.vim<CR>

	nnoremap <buffer> <leader>p :w<CR>:!sonic-pi-tool eval-file %<CR><CR>
	nnoremap <buffer> <leader><leader> :w<CR>:!sonic-pi-tool stop && sonic-pi-tool eval-file %<CR><CR>
	nnoremap <buffer> <leader>s :!sonic-pi-tool stop<CR><CR>

	let mapleader = ","

	inoremap <buffer> <leader>loop loop do <CR><+++><CR>end<CR><++><Esc>?<+++><CR>cf>

endif