Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

use js2-mode fork from https://github.com/mooz/js2-mode.git

  • Loading branch information...
commit 982a0f22c827fab8a5e946cfbc62c76b0b74306e 1 parent 27241a0
Lang Martin authored
3  .gitmodules
@@ -25,3 +25,6 @@
25 25 [submodule "ace-jump-mode"]
26 26 path = ace-jump-mode
27 27 url = git://github.com/winterTTr/ace-jump-mode.git
  28 +[submodule "js2-mode"]
  29 + path = js2-mode
  30 + url = https://github.com/mooz/js2-mode.git
1  js2-mode
... ... @@ -0,0 +1 @@
  1 +Subproject commit 858b079d3ee5bf8ab7623b817f73cf958e684e02
4 rc-hyper-keymap.el
@@ -26,10 +26,6 @@
26 26 (progn
27 27 (define-key (current-global-map) (kbd "H-l")
28 28 (lambda-insert-with-point "(lambda ()" ")"))
29   -
30   - (if (boundp 'js2-mode-map)
31   - (define-key js2-mode-map (kbd "H-l")
32   - (lambda-insert-with-point "function () {" "}")))
33 29 )
34 30
35 31 (provide 'rc-hyper-keymap)
45 rc-javascript.el
... ... @@ -1,20 +1,46 @@
1 1 (defvar rc-javascript-mode)
2 2
  3 +(defun js-insert-lambda ()
  4 + (interactive)
  5 + (let ((before "function() {")
  6 + (after "}"))
  7 + (insert before)
  8 + (insert after)
  9 + (backward-char (length after))))
  10 +
3 11 (defun rc-js2-mode-setup ()
4 12 (interactive)
5 13 (require 'js2-mode)
6 14 (custom-set-variables
7   - '(js2-basic-offset 2)
8   - '(js2-bounce-indent-flag t)
9   - '(js2-mirror-mode nil))
10   - (add-hook 'js2-mode-hook 'turn-off-tabs)
11   - ;; (add-hook 'js2-mode-hook 'turn-on-js-paredit-mode)
12   - ;; (add-hook 'js2-mode-hook 'turn-on-c-subword-mode)
13   - ;; (add-hook 'js2-mode-hook 'turn-on-moz-minor-mode)
14   - (define-key js2-mode-map "\C-x\C-s" 'cleanup-untabify-save))
  15 + '(js2-bounce-indent-p t)
  16 + '(js2-mirror-mode nil)
  17 + '(js2-cleanup-whitespace t)
  18 + '(js2-global-externs (quote (require exports))))
  19 + (add-hook 'js2-mode-hook 'turn-on-c-subword-mode)
  20 + (define-key js2-mode-map (kbd "H-l") 'js-insert-lambda)
  21 + (eval-after-load 'js2-mode
  22 + '(progn
  23 + (require 'js2-imenu-extras)
  24 + (js2-imenu-extras-setup))))
  25 +
  26 +(defun rc-js2-mode-spaces ()
  27 + "Configure js2 mode without tabs and with js2-basic-offset: 2"
  28 + (interactive)
  29 + (require 'js2-mode)
  30 + (set-default 'js2-basic-offset 2)
  31 + (add-hook 'js2-mode-hook 'turn-off-tabs))
  32 +
  33 +(defun rc-js2-mode-tabs ()
  34 + "Configure js2 mode with tabs and with js2-basic-offset: 4"
  35 + (interactive)
  36 + (require 'js2-mode)
  37 + (set-default 'js2-basic-offset 4)
  38 + (add-hook 'js2-mode-hook 'turn-on-tabs)
  39 + (add-hook 'js2-mode-hook 'set-tab-width-4))
15 40
16 41 (defun rc-js2-mode ()
17 42 (rc-js2-mode-setup)
  43 + (rc-js2-mode-tabs)
18 44 (add-to-auto-mode-alist '(("\\.js\\'" . js2-mode)))
19 45 (defalias 'rc-javascript-mode 'js2-mode))
20 46
@@ -40,8 +66,7 @@
40 66 ;; (require 'flymake-jshint)
41 67 (add-to-auto-mode-alist '(("\\.js\\'" . js-mode)))
42 68
43   - (define-key js-mode-map (kbd "H-l")
44   - (lambda-insert-with-point "function () {" "}"))
  69 + (define-key js-mode-map (kbd "H-l") 'js-insert-lambda)
45 70 (defalias 'rc-javascript-mode 'js-mode))
46 71
47 72 (rc-js2-mode)

0 comments on commit 982a0f2

Please sign in to comment.
Something went wrong with that request. Please try again.