summaryrefslogtreecommitdiffstats
path: root/lisp/ravi-init-web.el
diff options
context:
space:
mode:
authorRavi R Kiran <aine.marina@gmail.com>2015-10-23 18:57:59 (GMT)
committerRavi R Kiran <aine.marina@gmail.com>2015-10-23 18:57:59 (GMT)
commitcd1924466152177ea06b17c843f256463c1b91b8 (patch)
treeaf90afe028e5e392f242a3ea36302aafe1c1769d /lisp/ravi-init-web.el
parent5561df232cfa49822f322196d98170f95aa1139e (diff)
parent74c319ef12dd3130f6afc17abc59404b59d601d1 (diff)
downloaddotemacs-cd1924466152177ea06b17c843f256463c1b91b8.zip
dotemacs-cd1924466152177ea06b17c843f256463c1b91b8.tar.gz
dotemacs-cd1924466152177ea06b17c843f256463c1b91b8.tar.bz2
Merge branch 'master' into rtags-attempt
* master: (139 commits) Add pdf-tools as a nicer replacement for doc-view Add pdf-tools submodule Fix maildir data with correct path Add desktop notifications for email Potential use for modes without repls Attach files more easily in mu Update to newest version of mu Please remove tooltips after a while, please ace-window gets confused when tooltips are present Sometimes the dispatch list does come in handy Pre-populate searches Succumb to muscle memory of control keys Remove ropemacs due to disuse Do not let company-quickhelp steal a global key Manage word navigation Use proper helm function to replace completing-read Electric operators on python mode Use which-key in preference to guide-key Navigate easier Simplify config with magit 2.1.0 ...
Diffstat (limited to 'lisp/ravi-init-web.el')
-rw-r--r--lisp/ravi-init-web.el112
1 files changed, 112 insertions, 0 deletions
diff --git a/lisp/ravi-init-web.el b/lisp/ravi-init-web.el
new file mode 100644
index 0000000..85446ef
--- /dev/null
+++ b/lisp/ravi-init-web.el
@@ -0,0 +1,112 @@
+;;; ravi-init-web.el --- Web development -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2014
+
+;; Author: <ravi@nero.lan>
+;; Keywords:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Web development tools
+
+;;; Code:
+
+(use-package emmet-mode
+ :commands (emmet-mode)
+ :init
+ (progn
+ (add-hook 'css-mode-hook 'emmet-mode)
+ (add-hook 'sgml-mode-hook 'emmet-mode))
+ :config
+ (progn
+ (unbind-key "C-j" emmet-mode-keymap)
+ (bind-key "M-r" 'emmet-expand-line emmet-mode-keymap))
+ :ensure t
+ :diminish emmet-mode)
+
+;; Javascript
+(use-package js2-mode
+ :mode (("\\.js$" . js2-mode)
+ ("\\.json$" . js2-mode)
+ ("Jakefile$" . js2-mode))
+ ;; :interpreter ("node" . js2-mode)
+ :config
+ (progn
+
+ (use-package js2-refactor
+ :config
+ (progn
+ (js2r-add-keybindings-with-prefix "C-c C-m"))
+ :ensure t)
+
+ (defun ravi/js2-mode-hook ()
+ (emmet-mode)
+ (setq js2-basic-offset 2)
+ (when (functionp 'helm-dash)
+ (setq-local helm-dash-docsets '("JavaScript" "jQuery" "jQuery UI"))))
+ (add-hook 'js2-mode-hook 'ravi/js2-mode-hook))
+ :ensure t
+ )
+
+;; Interact with the browser
+(use-package skewer-mode
+ :config
+ (progn
+ (skewer-setup))
+ :ensure t)
+
+;; HTML with web-mode
+(use-package web-mode
+ :mode (("\\.html" . web-mode))
+ :config
+ (progn
+
+ ;; Make it work with smartparens
+ (defun ravi/web-mode-sp-hook ()
+ (setq web-mode-enable-auto-pairing nil)
+ (smartparens-mode)
+ (sp-use-smartparens-bindings))
+ (add-hook 'web-mode-hook 'ravi/web-mode-sp-hook)
+ (add-hook 'web-mode-hook 'emmet-mode)
+ (defun sp-web-mode-is-code-context (id action context)
+ (when (and
+ (eq action 'insert)
+ (not (or (get-text-property (point) 'part-side) (get-text-property (point) 'block-side))))
+ t))
+ (sp-local-pair 'web-mode "<" nil :when '(sp-web-mode-is-code-context))
+
+ (defun ravi/web-mode-extra-hook ()
+ (when (functionp 'helm-dash)
+ (setq-local helm-dash-docsets '("HTML"))))
+ (add-hook 'web-mode-hook 'ravi/web-mode-extra-hook)
+
+ ;; Customization
+ (setq web-mode-enable-current-element-highlight t)
+ (setq web-mode-markup-indent-offset 2)
+ (setq web-mode-css-indent-offset 2)
+ (setq web-mode-code-indent-offset 2)
+ (setq web-mode-enable-part-face t)
+ )
+
+ :ensure t)
+
+(defun ravi/css-mode-extra-hook ()
+ (when (functionp 'helm-dash)
+ (setq-local helm-dash-docsets '("CSS"))))
+(add-hook 'css-mode-hook 'ravi/css-mode-extra-hook)
+
+(provide 'ravi-init-web)
+;;; ravi-init-web.el ends here