diff --git a/core/core-editor.el b/core/core-editor.el index db02f2205..5f45b0715 100644 --- a/core/core-editor.el +++ b/core/core-editor.el @@ -252,29 +252,26 @@ sp-highlight-pair-overlay nil sp-cancel-autoskip-on-backward-movement nil sp-show-pair-delay 0 - sp-max-pair-length 5) - + sp-max-pair-length 3) (smartparens-global-mode 1) (require 'smartparens-config) - ;; Smartparens interferes with Replace mode (add-hook 'evil-replace-state-entry-hook 'turn-off-smartparens-mode) (add-hook 'evil-replace-state-exit-hook 'turn-on-smartparens-mode) - ;; Auto-close more conservatively (sp-pair "'" nil :unless '(sp-point-after-word-p)) (sp-pair "\"" nil :unless '(sp-point-before-word-p sp-point-after-word-p sp-point-before-same-p)) (sp-pair "{" nil :post-handlers '(("||\n[i]" "RET") ("| " " ")) - :unless '(sp-point-before-word-p sp-point-before-same-p)) + :unless '(sp-point-before-word-p sp-point-before-same-p)) (sp-pair "(" nil :post-handlers '(("||\n[i]" "RET") ("| " " ")) - :unless '(sp-point-before-word-p sp-point-before-same-p)) + :unless '(sp-point-before-word-p sp-point-before-same-p)) (sp-pair "[" nil :post-handlers '(("| " " ")) - :unless '(sp-point-before-word-p sp-point-before-same-p)) + :unless '(sp-point-before-word-p sp-point-before-same-p)) (sp-local-pair 'css-mode "/*" "*/" :post-handlers '(("[d-3]||\n[i]" "RET") ("| " "SPC"))) (sp-local-pair '(sh-mode markdown-mode) "`" nil - :unless '(sp-point-before-word-p sp-point-before-same-p)) + :unless '(sp-point-before-word-p sp-point-before-same-p)) (sp-with-modes '(xml-mode nxml-mode php-mode) (sp-local-pair "" :post-handlers '(("| " "SPC"))))) diff --git a/modules/module-lua.el b/modules/module-lua.el index 52ac5585a..f3b4b6aa7 100644 --- a/modules/module-lua.el +++ b/modules/module-lua.el @@ -8,22 +8,9 @@ (def-company-backend! lua-mode (lua yasnippet)) (def-electric! lua-mode :words ("else" "end")) (def-repl! lua-mode doom/inf-lua) - (add-hook! lua-mode (setq-local sp-max-pair-length 9)) - (sp-with-modes '(lua-mode) - ;; disable defaults - (sp-local-pair "if" nil :actions :rem) - (sp-local-pair "while" nil :actions :rem) - (sp-local-pair "function" nil :actions :rem) - (sp-local-pair "if " " end") - (sp-local-pair "then " " end") - (sp-local-pair "do " " end") - (sp-local-pair "if" "end" :when '(("RET")) :post-handlers '(" |\n[i]")) - (sp-local-pair "then" "end" :when '(("RET")) :post-handlers '("||\n[i]")) - (sp-local-pair "do" "end" :when '(("RET")) :post-handlers '("||\n[i]")) - ;; block functions - (sp-local-pair "function" "end" :when '(sp-point-after-bol-p) :post-handlers '(" |\n[i]")) - ;; inline functions - (sp-local-pair "function " " end" :unless '(sp-point-after-bol-p)))) + + ;; sp's lua-specific rules are obnoxious, so we disable them + (setq sp-pairs (delete (assq 'lua-mode sp-pairs) sp-pairs))) (use-package company-lua :after lua-mode) diff --git a/modules/module-php.el b/modules/module-php.el index af4a2c552..f91943d44 100644 --- a/modules/module-php.el +++ b/modules/module-php.el @@ -18,6 +18,8 @@ (map! :map php-mode-map (:localleader :nv ";" 'doom/append-semicolon)) + (add-hook! php-mode (setq-local sp-max-pair-length 6)) + (sp-with-modes '(php-mode) (sp-local-pair "/*" "*/" :post-handlers '(("||\n[i]" "RET") ("| " "SPC"))) (sp-local-pair "/**" "*/" :post-handlers '(("||\n[i]" "RET") ("||\n[i]" "SPC"))) diff --git a/modules/module-sh.el b/modules/module-sh.el index 10bbc2648..fbb943276 100644 --- a/modules/module-sh.el +++ b/modules/module-sh.el @@ -14,14 +14,7 @@ (setq sh-indent-after-continuation 'always) ;; [pedantry intensifies] - (add-hook! sh-mode (setq mode-name "sh")) - - (sp-with-modes '(sh-mode) - (sp-local-pair "case" "" :when '(("SPC")) :post-handlers '((:add doom/sp-insert-yasnippet)) :actions '(insert)) - (sp-local-pair "if" "" :when '(("SPC")) :post-handlers '((:add doom/sp-insert-yasnippet)) :actions '(insert)) - (sp-local-pair "for" "" :when '(("SPC")) :post-handlers '((:add doom/sp-insert-yasnippet)) :actions '(insert)) - (sp-local-pair "elif" "" :when '(("SPC")) :post-handlers '((:add doom/sp-insert-yasnippet)) :actions '(insert)) - (sp-local-pair "while" "" :when '(("SPC")) :post-handlers '((:add doom/sp-insert-yasnippet)) :actions '(insert)))) + (add-hook! sh-mode (setq mode-name "sh"))) (use-package company-shell :after sh-script