Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Don't clobber user text objects

References #46.
  • Loading branch information...
commit 3720d283a82ceb7dc84f7326c22b25543b626b77 1 parent 8aa9cee
@tpope tpope authored
Showing with 14 additions and 5 deletions.
  1. +14 −5 ftplugin/ruby.vim
View
19 ftplugin/ruby.vim
@@ -125,16 +125,25 @@ if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps")
xnoremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','b','v')<CR>
xnoremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','','v')<CR>
- onoremap <silent> <buffer> im :<C-U>call <SID>wrap_i('[m',']M')<CR>
- onoremap <silent> <buffer> am :<C-U>call <SID>wrap_a('[m',']M')<CR>
- onoremap <silent> <buffer> ic :<C-U>call <SID>wrap_i('[[','][')<CR>
- onoremap <silent> <buffer> ac :<C-U>call <SID>wrap_a('[[','][')<CR>
-
let b:undo_ftplugin = b:undo_ftplugin
\."| sil! exe 'unmap <buffer> [[' | sil! exe 'unmap <buffer> ]]' | sil! exe 'unmap <buffer> []' | sil! exe 'unmap <buffer> ]['"
\."| sil! exe 'unmap <buffer> [m' | sil! exe 'unmap <buffer> ]m' | sil! exe 'unmap <buffer> [M' | sil! exe 'unmap <buffer> ]M'"
\."! sil! exe 'ounmap <buffer> im'| sil! exe 'ounmap <buffer> am'| sil! exe 'ounmap <buffer> ic'| sil! exe 'ounmap <buffer> ac'"
+ if maparg('im','n') == ''
+ onoremap <silent> <buffer> im :<C-U>call <SID>wrap_i('[m',']M')<CR>
+ onoremap <silent> <buffer> am :<C-U>call <SID>wrap_a('[m',']M')<CR>
+ let b:undo_ftplugin = b:undo_ftplugin
+ \."! sil! exe 'ounmap <buffer> im' | sil! exe 'ounmap <buffer> am'"
+ endif
+
+ if maparg('ic','n') == ''
+ onoremap <silent> <buffer> ic :<C-U>call <SID>wrap_i('[[','][')<CR>
+ onoremap <silent> <buffer> ac :<C-U>call <SID>wrap_a('[[','][')<CR>
+ let b:undo_ftplugin = b:undo_ftplugin
+ \."| sil! exe 'ounmap <buffer> ic' | sil! exe 'ounmap <buffer> ac'"
+ endif
+
if maparg("\<C-]>",'n') == ''
nnoremap <silent> <buffer> <C-]> :<C-U>exe v:count1."tag <C-R>=RubyCursorIdentifier()<CR>"<CR>
nnoremap <silent> <buffer> g<C-]> :<C-U>exe "tjump <C-R>=RubyCursorIdentifier()<CR>"<CR>
Please sign in to comment.
Something went wrong with that request. Please try again.