Skip to content

Instantly share code, notes, and snippets.

@jcinnamond
Last active January 1, 2016 23:39
Show Gist options
  • Save jcinnamond/8217926 to your computer and use it in GitHub Desktop.
Save jcinnamond/8217926 to your computer and use it in GitHub Desktop.
;; Alignment for ruby 1.9 style hashes
;; From:
;; h = {
;; key1: "v1",
;; longer_key: "v2",
;; }
;; To:
;; h = {
;; key1: "v1",
;; longer_key: "v2",
;; }
(defun jc-align-hash ()
(interactive)
(align-regexp (region-beginning) (region-end) ":\\(\\s-*\\)" 1 1 nil))
(define-key enh-ruby-mode-map (kbd "C-<tab>") 'jc-align-hash)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment