Created
August 4, 2013 00:35
-
-
Save stew/6148551 to your computer and use it in GitHub Desktop.
Fancy unicode arrows for emacs scala-mode. Done this way because I don't think it can work as an abbrev.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun right-arrow () | |
(interactive) | |
(cond ((looking-back "=") | |
(backward-delete-char 1) (insert "⇒")) | |
((looking-back "-") | |
(backward-delete-char 1) (insert "→")) | |
(t (insert ">")))) | |
(defun left-arrow () | |
(interactive) | |
(if (looking-back "<") | |
(progn (backward-delete-char 1) | |
(insert "←")) | |
(insert "-"))) | |
(add-hook 'scala-mode-hook '(lambda () (interactive) | |
(local-set-key (kbd "-") 'left-arrow) | |
(local-set-key (kbd ">") 'right-arrow))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment