I am having little issues with web-mode.

I am trying to disable the pairing which is done automatically when I try to insert double curly braces like this:

{{<CURSOR>}} , and hit space to start typing my code , it becomes {{ }}}}

here is what I did to try to disable it , but none of this works which is little frustrating.

(electric-pair-mode 1) ;; this is doing all the pairing for me.

(use-package web-mode
  :ensure t
  :defer t
  ;; none of these disabled it 
  (setq web-mode-enable-auto-expanding -1)
  (setq web-mode-enable-auto-closing -1)
  (setq web-mode-enable-auto-pairing -1)
  (setq web-mode-enable-auto-closing -1)
  (setq web-mode-enable-auto-quoting -1)

  (add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
  (add-to-list 'auto-mode-alist '("\\.html\\.erb\\'" . web-mode))
  (setq web-mode-engines-alist '(("django" . "/templates/.*\\.html\\'"))))

I am electric-pair-mode for pairing and use-package for configuration.

  • I wasn't able to reproduce the behavior you describe. Does this occur when loading only those two packages?
    – ebpa
    Sep 12 '17 at 14:07
  • did you set the engine ? go M-x web-mode-set-engine then chose django, with the settings above , you should be able to reproduce it because this is the default behavior of web-mode.
    – static
    Sep 12 '17 at 14:26

In elisp nil represents a false value. Try:

(setq web-mode-enable-auto-closing nil)
(setq web-mode-enable-auto-pairing nil)

-1 is non-nil (see: (if -1 "true!" "false!")).

  • true!, thanks for the heads up, i have (tool-bar-mode -1) , so I thought it will do the same thing for web-mode variable -1 will disable it as well.
    – static
    Sep 12 '17 at 14:17
  • this is so confusing , doing c-h v tool-bar-mode says it is value is nil that is why I set those values to -1.
    – static
    Sep 12 '17 at 14:19
  • Hmm... Maybe part of your init isn't getting evaluated so that command is getting ignored?
    – ebpa
    Sep 12 '17 at 14:22
  • that might be the case , nonetheless , I am happy that nil disabled the auto-pairing and I am happy that I didn't have to debug the code evaluation path to figure out whats going on lol.
    – static
    Sep 12 '17 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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