2

I'm using web-mode within emacs to edit an html file, in html-mode I can use C-c C-v to render html, it opens the file straight to Firefox.

How I do that with web-mode?

Thanks a lot,

P.S : Using emacs 26.3

1 Answer 1

5

You can find out what C-c C-v does by pressing F1 k C-c C-v in a html-mode buffer:

C-c C-v runs the command browse-url-of-buffer (found in html-mode-map), which is an interactive autoloaded compiled Lisp function in ‘browse-url.el’.

That command can be bound in the appropriate web-mode keymap, aptly named web-mode-map:

(with-eval-after-load 'web-mode
  (define-key web-mode-map (kbd "C-c C-v") 'browse-url-of-buffer))
1
  • 1
    Thanks for the great answer ! I added :bind ("C-c C-v" . browse-url-of-buffer) to my use-package and it works well. Commented Feb 7, 2020 at 23:15

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.