Last active
August 27, 2018 06:10
-
-
Save hzchirs/ae9797ebc752822a217480c1e81bea89 to your computer and use it in GitHub Desktop.
Ruby class name and method name text object for vim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" method name object, e.g. cmn (change method name), dmn (delete method name), vmn (visual select method name) | |
" m -> vim-ruby method text-obj n -> name | |
onoremap mn :<c-u>execute "normal! ?\def\\s\\l\\+\r:nohlsearch\rwviW"<CR> | |
vnoremap mn :<c-u>execute "normal! ?\def\\s\\l\\+\r:nohlsearch\rwviW"<CR> | |
" class name object, e.g. cMn, dMn, vMn | |
" M -> vim-ruby class text-obj n -> name | |
onoremap Mn :<c-u>execute "normal! ?\\(class\\\|module\\\|describe\\)\\s\\u\\l\\+\r:nohlsearch\rwviW"<CR> | |
vnoremap Mn :<c-u>execute "normal! ?\\(class\\\|module\\\|describe\\)\\s\\u\\l\\+\r:nohlsearch\rwviW"<CR> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment