Emacs builds a web development environment

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.