diff --git a/helpers.el b/helpers.el index 569eac3..4ae4ac0 100644 --- a/helpers.el +++ b/helpers.el @@ -60,6 +60,11 @@ there's a region, all lines that region covers will be duplicated." (interactive "r") (align-regexp begin end "\\(\\s-*\\)=" 1 1 )) +(defun align-region-to-opening-brace (begin end) + "Align region to equal signs" + (interactive "r") + (align-regexp begin end "\\(\\s-*\\){" 1 1 )) + ;; ;; Yank Pop Forwards diff --git a/keybindings.el b/keybindings.el index cbbcb32..a576e9a 100644 --- a/keybindings.el +++ b/keybindings.el @@ -46,6 +46,8 @@ ;; Align to equal signs (via helpers.el). (global-set-key (kbd "C-x a =") 'align-region-to-equals) (global-set-key (kbd "M-]") 'align-region-to-equals) +(global-set-key (kbd "C-x a {") 'align-region-to-opening-brace) +(global-set-key (kbd "M-[") 'align-region-to-opening-brace) ;; align-regexp (global-set-key (kbd "C-c \\") 'align-regexp)