-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy path_js.el
More file actions
55 lines (42 loc) · 1.91 KB
/
_js.el
File metadata and controls
55 lines (42 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
;; -*-emacs-lisp-*-
;;;
;;; javascript configuration
;;;
(eval-when-compile
(if (locate-library "js2-mode")
(require 'js2-mode)
(require 'js)
(require 'js-comint nil t)))
(with-eval-after-load "indium-interaction"
(cinsk/move-key indium-interaction-mode-map [(control ?c) ?d] [(control ?c) ?D])
(define-key indium-interaction-mode-map [(control ?c) (control ?r)] 'indium-eval-region)
(define-key indium-interaction-mode-map [(control ?c) (control ?b)] 'indium-eval-buffer)
(define-key indium-interaction-mode-map [(control ?c) ?\!] 'indium-run-node)
)
(if (locate-library "js2-mode")
(progn
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
(add-to-list 'interpreter-mode-alist '("node" . js2-mode))
(add-to-list 'interpreter-mode-alist '("nodejs" . js2-mode))
(with-eval-after-load "js2-mode"
(add-to-list 'js2-mode-hook 'subword-mode)
(when (locate-library "indium")
(add-hook 'js2-mode-hook (lambda ()
(unless (fboundp 'indium-interaction-mode)
(require 'indium))
(indium-interaction-mode))))))
;; else part
(when (locate-library "js-comint")
(require 'js-comint))
(let ((path (executable-find "js")))
(when path
(setq inferior-js-program-command path)))
(with-eval-after-load "js"
(define-key js-mode-map [(control ?c) ?\!] 'run-js)
(define-key js-mode-map [(control ?c) (control ?r)] 'js-send-region-and-go)
(define-key js-mode-map [(control ?c) (control ?b)] 'js-send-buffer-and-go)))
(enable-minor-mode "js2-mode" js2-mode-hook skewer-mode skewer-mode
(string-prefix-p (expand-file-name "~/src/js/d3/") buffer-file-name))
(with-eval-after-load "skewer-mode"
(define-key skewer-mode-map [(control ?c) (control ?b)] 'skewer-load-buffer)
(define-key skewer-mode-map [(control ?c) ?\!] 'skewer-repl))