Created
June 15, 2015 12:22
-
-
Save tonini/7e98a01d248cd99fc30c to your computer and use it in GitHub Desktop.
This file contains 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
;; Smartparens - Minor mode for Emacs that deals with parens pairs and tries to be smart about it | |
;; https://github.com/Fuco1/smartparens | |
;; | |
;; How to deal with do/end ->/end blocks in your Elixir files: | |
(eval-after-load 'smartparens | |
'(progn | |
(defun my-elixir-do-end-close-action (id action context) | |
(when (eq action 'insert) | |
(newline-and-indent) | |
(previous-line) | |
(indent-according-to-mode))) | |
(sp-with-modes '(elixir-mode) | |
(sp-local-pair "do" "end" | |
:when '(("SPC" "RET")) | |
:post-handlers '(:add my-elixir-do-end-close-action) | |
:actions '(insert)) | |
(sp-local-pair "->" "end" | |
:when '(("SPC" "RET")) | |
:post-handlers '(:add my-elixir-do-end-close-action) | |
:actions '(insert))))) | |
;; Smartparens faces | |
;; | |
;; - disable pair overlay for readability | |
(setq sp-highlight-pair-overlay nil) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment