doomemacs/core/core-editor.el

39 lines
1.4 KiB
EmacsLisp
Raw Normal View History

2015-01-09 21:47:51 -05:00
;; Global editor behavior
2014-12-05 17:28:03 -05:00
(use-package expand-region
:commands (er/expand-region er/contract-region))
(use-package rotate-text
:commands (rotate-word-at-point rotate-region))
2014-08-07 18:35:22 -04:00
2014-09-20 16:54:04 -04:00
(use-package smartparens
2014-12-05 17:28:03 -05:00
:init (require 'smartparens-config)
2014-09-20 16:54:04 -04:00
:config
(progn
(smartparens-global-mode 1)
2014-12-05 17:28:03 -05:00
(setq blink-matching-paren t)
2014-09-20 16:54:04 -04:00
(setq sp-autowrap-region nil ; let evil-surround handle this
sp-highlight-pair-overlay nil
sp-show-pair-delay 0
2015-02-01 04:11:45 -05:00
sp-autoescape-string-quote nil)
2014-09-20 16:54:04 -04:00
2015-02-01 04:11:45 -05:00
;; Handle newlines + spaces
(sp-pair "{" "}" :post-handlers '(("||\n[i]" "RET") ("| " " ")) :unless '(sp-point-before-word-p sp-point-before-same-p))
(sp-pair "(" ")" :post-handlers '(("||\n[i]" "RET") ("| " " ")) :unless '(sp-point-before-word-p sp-point-before-same-p))
2014-09-20 16:54:04 -04:00
2014-12-05 17:28:03 -05:00
;; Auto-close more conservatively
2015-02-01 04:11:45 -05:00
(sp-pair "[" nil :unless '(sp-point-before-word-p sp-point-before-same-p))
(sp-pair "'" nil :unless '(sp-point-after-word-p sp-point-before-word-p sp-point-before-same-p))
(sp-pair "\"" nil :unless '(sp-point-after-word-p sp-point-before-word-p sp-point-before-same-p))
2014-09-20 16:54:04 -04:00
2015-02-01 04:11:45 -05:00
(sp-with-modes '(json-mode js2-mode ruby-mode enh-ruby-mode python-mode)
(sp-local-pair "[" nil :post-handlers '(("||\n[i]" "RET"))))
2015-02-01 04:11:45 -05:00
2014-12-05 17:28:03 -05:00
(after "yasnippet"
(defadvice yas-expand (before advice-for-yas-expand activate)
(sp-remove-active-pair-overlay)))))
2014-12-12 15:26:34 -05:00
(provide 'core-editor)
;;; core-editor.el ends here