Skip to content

Instantly share code, notes, and snippets.

@bsnape
Last active August 29, 2023 05:15
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save bsnape/edff869d5b7dc0b0d7c2 to your computer and use it in GitHub Desktop.
Save bsnape/edff869d5b7dc0b0d7c2 to your computer and use it in GitHub Desktop.
Rubymine find & replace string hash rockets with new syntax
find:
\'(\w+)\'\s*=>
replace:
$1:
replace symbol hash rockets with new syntax
find:
:(\w+)\s*=>
replace:
$1:
@smikkelsen
Copy link

How do you use this in rubymine? I'm looking for a solution to this problem! thanks

@gayle
Copy link

gayle commented Aug 21, 2018

I found this https://www.jorgemanrubia.com/2012/12/29/why-i-love-rubymine/
That says "If you place the cursor inside a hash entry and press ALT-ENTER you are offered the possibility of converting between => and : notations. Do the same inside a block, and you can convert automatically between the braces or do/end syntax. Do it inside a string to convert it to a symbol"

@ecbrodie
Copy link

ecbrodie commented Aug 7, 2020

For double-quote users, use this for the find of string hash keys:

\"(\w+)\"\s*=>

@siwoo-park-ringle
Copy link

siwoo-park-ringle commented Aug 29, 2023

From symbol keys to double quote rocket keys

find:
(\w+):

replace:
"$1" =>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment