From 73fa46a7796d5f53326c0d38f617b6cb839c2d34 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Tue, 5 Dec 2017 21:16:14 +0100 Subject: ftplugin/ruby.vim: Add `RubyNewHashSyntax` command I've had to use a similar pattern a couple of times in the past to convert files or sections of files from the old Ruby hash syntax (`:key => 'value'`) to the new syntax (`key: 'value'`). Give the pattern and substitution a command to make it readily available the next time I need to use it. --- ftplugin/ruby.vim | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'ftplugin/ruby.vim') diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index fe7315d..2abb417 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -20,3 +20,9 @@ nnoremap ZD Obyebug " Spring command! -buffer FuckSpring :!bundle exec spring stop + + +" Convert from old to new hash syntax +" Example: :%RubyNewHashSyntax gc +command! -buffer -range -nargs=? RubyNewHashSyntax + \ ,substitute/\v:<(\w+)> \=\>/\1:/ -- cgit v1.2.3