Web-modeweb Mode website
AboutWeb-mode.elis a autonomous Emacs major-mode for editing web templates.
HTML documents can embed parts (css/javascript) and blocks (Client/server side).
Downloadweb-mode.el
Install
(Require ' Web-mode) (Add-to-list ' auto-mode-alist ' ("\\.html?\\ '". web-mode));; Indent Setting (Defun my-web-mode-hook () "Hooks for Web mode." (setq web-mode-markup-indent-offset 2)) (Add-hook ' Web-mode-hook ' My-web-mode-hook); Comment Style setting (setq Web-mode-comment-style 2)
Emacs calls an external browser to open an HTML document emacs default Html-modeemacs opens an HTML document when the default call to Html-mode,html-mode has a default key binding c-c C-v,view buffer Contents can be implemented by calling an external browser to open an HTML document Browse-url-of-buffer
We can use C-h K, enter c-c c-v to see what this key binds to
C-c c-v runs the command Browse-url-of-buffer, which is an interactivecompiled Lisp function. It is bound to C-c c-v, <menu-bar>
As you can see from the above, this key binding is called the Browse-url-of-buffer function to implement this function to invoke the function in Web-mode by binding the key.(Defun web-mode-keybinding-settings () "Settings for keybinding." (Eal-define-keys ' (web-mode-map) ' (("C-c c-v" Browse-url-of-file)))) (Eval-after-load " Web-mode-keybinding-settings " ' (web-mode-keybinding-settings))
Define the key bindings in Web-mode c-c c-v call the above function, this shortcut does not work in other mode
Web-settings.el(Require ' Web-mode) (Add-to-list ' auto-mode-alist ' ("\\.html?\\ '". web-mode));; Indent Setting (Defun my-web-mode-hook () "Hooks for Web mode." (setq web-mode-markup-indent-offset 2)) (Add-hook ' Web-mode-hook ' My-web-mode-hook); Comment Style setting (setq Web-mode-comment-style 2);; KeyBinding ( Defun web-mode-keybinding-settings () "Settings for keybinding." (Eal-define-keys ' (web-mode-map) ' (("C-c c-v" Browse-url-of-file)))) (Eval-after-load " Web-mode-keybinding-settings " ' (web-mode-keybinding-settings)) (provide ' web-settings)
Emacs builds a web development environment