Skip to content

Instantly share code, notes, and snippets.

@Nek
Created July 27, 2012 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nek/3188468 to your computer and use it in GitHub Desktop.
Save Nek/3188468 to your computer and use it in GitHub Desktop.
keywords replacement in emacs
;; Use lambda for anonymous functions
(font-lock-add-keywords
'js2-mode `(("\\(function\\) *("
(0 (progn (compose-region (match-beginning 1)
(match-end 1) "\u0192")
nil)))))
;; Use right arrow for return in one-line functions
(font-lock-add-keywords
'js2-mode `(("function *([^)]*) *{ *\\(return\\) "
(0 (progn (compose-region (match-beginning 1)
(match-end 1) "\u2190")
nil)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment