The smartparens-mode doesn't suit my style of editing. If I attempt to disable it globally in spacemacs, however, the mode is re-enabled:

(smartparens-global-mode -1)

How do I disable smartparens-mode?

6 Answers 6


You can add smartparens to the dotspacemacs-excluded-packages list of your dotfile.


Spacemacs uses the concept of toggles to enable/disable minor-modes per buffer. Toggles are grouped under SPC t and SPC T, but they only switch for the current buffer. You can temporarily disable smartparens for the current buffer by pressing SPC t p (spacemacs/toggle-smartparens).

But if you want to disable smartparens for every buffer permanently, put spacemacs/toggle-smartparens-globally-off in your dotspacemacs/user-config function. To do that, press SPC f e d, this will open your .spacemacs file. Then make sure you have something like this:

(defun dotspacemacs/user-config ()
  "Configuration function for user code.
This function is called at the very end of Spacemacs initialization after
layers configuration. You are free to put any user code."
  ; other code
  ; other code

From https://github.com/syl20bnr/spacemacs/issues/1603#issuecomment-213553034:

smartparens-global-mode is a global mode. If it is enabled you get smartparens-mode in every buffer. Turning it off does not prevent you from turning on smartparens-mode anywhere. (That would be silly, because if that were true there would be no way to selectively enable smartparens. It would be either everywhere or nowhere, depending on that mode.) In fact smartparens-global-mode is off by default already.

Spacemacs enables smartparens-mode in all programming buffers by switching it on in the hook. Therefore you have to remove the function from prog-mode-hook.

To remove the function from the prog-mode-hook, add the following line to dotspacemacs/user-config in .spacemacs:

(remove-hook 'prog-mode-hook #'smartparens-mode)

If you don't have smartparens-mode disabled by default, you can also add the following line:


Note that if you exclude the smartparens package as suggested in another answer, you'll lose some other features such as SPC j n (sp-newline).


Add entry/exit hooks for evil insert mode:

;; Defeat smartparens-mode in evil mode
(add-hook 'evil-insert-state-entry-hook 'turn-off-smartparens-mode)
(add-hook 'evil-insert-state-exit-hook 'turn-on-smartparens-mode)

In spacemacs hybrid mode, apply to the evil-hybrid-state hooks:

;; Alternative way to defeat smartparens-mode in hybrid mode
(add-hook 'evil-hybrid-state-entry-hook 'turn-off-smartparens-mode)
(add-hook 'evil-hybrid-state-exit-hook 'turn-on-smartparens-mode)

Here's how to selectively enable smartparens only in specific modes

(defun dotspacemacs/user-config ()
  (require 'smartparens)
  (remove-hook 'prog-mode-hook #'smartparens-mode)
  (remove-hook 'markdown-mode-hook #'smartparens-mode)
  (add-hook 'clojure-mode-hook '(lambda () (smartparens-mode 1)) t))

Since this commit 7d2ff48 there is a dotspacemacs-activate-smartparens-mode variable in the .spacemacs file that can be set to nil to disable smartparens.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.