Skip to content

Instantly share code, notes, and snippets.

@fimmtiu
Created April 3, 2014 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fimmtiu/9958678 to your computer and use it in GitHub Desktop.
Save fimmtiu/9958678 to your computer and use it in GitHub Desktop.
convert-ruby-hashes
(defun convert-ruby-hashes ()
(interactive)
(query-replace-regexp ":\\([[:word:]_]+\\)\\([[:space:]]+\\)=>[[:space:]]+" "\\1:\\2" nil
(if (and transient-mark-mode mark-active) (region-beginning))
(if (and transient-mark-mode mark-active) (region-end))))
(global-set-key (kbd "C-c h") 'convert-ruby-hashes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment