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
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#