Permalink
Browse files

Adding a hot key for equal sign alignment.

  • Loading branch information...
1 parent 24d1fcc commit bbe440712da01bbb848f364baa9f3b49e16e88fc @JEG2 committed Mar 19, 2013
Showing with 8 additions and 0 deletions.
  1. +8 −0 emacs.d/functions.el
View
@@ -558,3 +558,11 @@
(jeg2s-trim-backwards)
(jeg2s-trim-forwards))
(global-set-key (kbd "C-c w w") 'jeg2s-trim-backwards-and-forwards)
+
+(defun jeg2s-align ()
+ "Aligns equal signs in the region or buffer."
+ (interactive)
+ (let ((begin (if (region-active-p) (region-beginning) (point-min)))
+ (end (if (region-active-p) (region-end) (point-max))))
+ (align-regexp begin end "\\(\\s-*\\)=" 1 1 nil)))
+(global-set-key (kbd "C-c =") 'jeg2s-align)

0 comments on commit bbe4407

Please sign in to comment.