2

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
  (setq
   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.

1 Answer 1

5
(with-eval-after-load 'web-mode
  (define-key web-mode-map (kbd "M-;") 'comment-dwim))
2
  • 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, 2015 at 20:38
  • I guess that's why web-mode comes with its own commenting command.
    – wasamasa
    May 7, 2015 at 20:50

Your Answer

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

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