Last Updated: February 25, 2016
·
1.191K
· rrix

Convert Ruby 1.8 style hash rockets to Ruby 1.9 hashes in Vim

nmap <Leader>h :s/\:\([a-zA-Z_]*\)\s=>/\1\:/g<cr>
vmap <Leader>h :'<,'>s/\:\([a-zA-Z_]*\)\s=>/\1\:/g<cr>

then \h (or whatever you have mapleadered) will convert all the 1.8 style hashes on a line to 1.9 style hashes. If you're in visual mode, it will convert all the hash rockets in a selection