I want web-mode to use comment-dwim instead of web-mode-comment-or-uncomment (bound to M-;).

I tried:

;; Web Mode (http://web-mode.org/)
(with-eval-after-load 'web-mode
   web-mode-markup-indent-offset 2
   web-mode-css-indent-offset 2
   web-mode-code-indent-offset 2)
  ;; (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
  (global-set-key (kbd "M-;") 'comment-dwim))

But the change doesn't apply, I've also tried with local-set-key.

(with-eval-after-load 'web-mode
  (define-key web-mode-map (kbd "M-;") 'comment-dwim))
  • I have an issue with that. Now I can successfully comment the way it should, but when I try to uncomment it re-comments instead (so 2 comments delimiters around my region). May 7 '15 at 20:38
  • I guess that's why web-mode comes with its own commenting command.
    – wasamasa
    May 7 '15 at 20:50

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.