Move c electric disabler to config/default

Because it is tied to the smartparens config, and we'll want this
behavior to extend to all C-derived modes (like csharp and php modes).
This commit is contained in:
Henrik Lissner 2019-02-18 15:36:44 -05:00
parent 94b16cba6c
commit 9dd88e5924
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 11 additions and 9 deletions

View file

@ -64,6 +64,16 @@
(sp-local-pair (append sp--html-modes '(markdown-mode gfm-mode))
"<!--" "-->" :actions '(insert) :post-handlers '(("| " "SPC")))
;; Disable electric keys in C modes because it interferes with smartparens
;; and custom bindings. We'll do it ourselves (mostly).
(after! cc-mode
(c-toggle-electric-state -1)
(c-toggle-auto-newline -1)
(setq c-tab-always-indent nil
c-electric-flag nil)
(dolist (key '("#" "{" "}" "/" "*" ";" "," ":" "(" ")" "\177"))
(define-key c-mode-base-map key nil)))
;; Expand C-style doc comment blocks. Must be done manually because some of
;; these languages use specialized (and deferred) parsers, whose state we
;; can't access while smartparens is doing its thing.