Emacs: Aling variables in Javacript
This is my first code snippet, comments are welcome!
I use this to align my variables (especially require()
) in Javascript/Nodejs.
(defun pap/alignvar ()
(interactive)
(save-excursion
(mark-paragraph)
(align-regexp (region-beginning) (region-end) "\\(\\s-*\\)=")))
(global-set-key (kbd "M-+") 'pap/alignvar)
You just have to be on any line of your variable declaration, and it will align all the =
sign vertically.
Written by PA Parent
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Emacs
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#