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
|
|
|
|
:config
|
|
|
|
(progn
|
2015-05-03 01:49:17 -04:00
|
|
|
(require 'smartparens-config)
|
|
|
|
|
2014-09-20 16:54:04 -04:00
|
|
|
(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
|
2015-02-02 02:01:29 -05:00
|
|
|
(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))
|
2014-11-29 20:21:03 -05:00
|
|
|
(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)
|
2015-02-02 02:01:29 -05:00
|
|
|
(sp-local-pair "[" nil :post-handlers '(("||\n[i]" "RET"))))
|
2015-02-01 04:11:45 -05:00
|
|
|
|
2015-05-07 03:19:24 -04:00
|
|
|
(sp-with-modes '(c-mode c++-mode objc-mode java-mode scss-mode css-mode php-mode)
|
|
|
|
(sp-local-pair "/* " " */" :post-handlers '(("||\n[i]" "RET")))
|
|
|
|
(sp-local-pair "/**" "*/" :post-handlers '(("||\n[i]" "RET"))))
|
|
|
|
|
|
|
|
(sp-with-modes '(objc-mode scss-mode css-mode)
|
|
|
|
(sp-local-pair "/*\n" "\n */" :post-handlers '(("||[i]" "RET"))))
|
|
|
|
|
|
|
|
(sp-with-modes '(c-mode c++-mode php-mode java-mode)
|
|
|
|
(sp-local-pair "/*" "" :post-handlers '((" ||\n[i]*/" "RET"))))
|
2015-05-05 21:14:37 -04: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
|