掲題の設定をさらしておこうかと。雑な設定ですけども。。実際の画面は上の画像の通りです。
参考にしたのはこちら。
ポイントは js2-mode-hook に以下の一行を加えていることくらいでしょうか。
(local-set-key "\C-c\C-r" 'js-send-region)
region を js の repl に送るコマンドです。(require 'js-comint) (setq inferior-js-program-command "java org.mozilla.javascript.tools.shell.Main") (add-hook 'js2-mode-hook '(lambda () (local-set-key "\C-x\C-e" 'js-send-last-sexp) (local-set-key "\C-\M-x" 'js-send-last-sexp-and-go) (local-set-key "\C-cb" 'js-send-buffer) (local-set-key "\C-c\C-b" 'js-send-buffer-and-go) (local-set-key "\C-cl" 'js-load-file-and-go) (local-set-key "\C-c\C-r" 'js-send-region) )) (when (load "js2" t) (setq js2-cleanup-whitespace nil js2-mirror-mode nil js2-bounce-indent-flag nil) (defun indent-and-back-to-indentation () (interactive) (indent-for-tab-command) (let ((point-of-indentation (save-excursion (back-to-indentation) (point)))) (skip-chars-forward "\s " point-of-indentation))) (define-key js2-mode-map "\C-i" 'indent-and-back-to-indentation) ;; (define-key js2-mode-map "\C-m" nil) (add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))) (setq-default c-basic-offset 4) (defun js-other-window () "Run JavaScript on other window" (interactive) (split-window-horizontally 80) (let ((buf-name (buffer-name (current-buffer)))) (js2-mode) (run-js inferior-js-program-command) (switch-to-buffer-other-window (get-buffer-create buf-name)))) ;; (define-key global-map ;; "\C-cj" 'js-other-window)
0 件のコメント:
コメントを投稿