Fix nodejs repl + enhance narf:repl

This commit is contained in:
Henrik Lissner 2016-03-31 03:21:16 -04:00
parent f26ddf99ac
commit a1bc073920
3 changed files with 11 additions and 6 deletions

View file

@ -1,13 +1,17 @@
;;; defuns-repl.el
;;;###autoload (autoload 'narf:repl "defuns-repl" nil t)
(evil-define-command narf:repl (&optional bang)
(evil-define-command narf:repl (&optional bang command)
:repeat nil
(interactive "<!>")
(interactive "<!><a>")
(if (and narf--repl-buffer (buffer-live-p narf--repl-buffer))
(narf/popup-buffer narf--repl-buffer)
(rtog/toggle-repl (if (use-region-p) 4))
(setq narf--repl-buffer (current-buffer))))
(setq narf--repl-buffer (current-buffer))
(when command
(with-current-buffer narf--repl-buffer
(insert command)
(unless bang (comint-send-input))))))
;;;###autoload (autoload 'narf:repl-eval "defuns-repl" nil t)
(evil-define-operator narf:repl-eval (&optional beg end bang)

View file

@ -4,6 +4,9 @@
:mode "\\.js$"
:interpreter "node"
:init
(use-package nodejs-repl :defer t :commands (nodejs-repl)
:config (evil-set-initial-state 'nodejs-repl-mode 'emacs))
(define-repl! js2-mode nodejs-repl)
(define-docset! js2-mode "js,javascript,nodejs,angularjs")
:config
@ -101,7 +104,5 @@
:config
(setq-default coffee-indent-like-python-mode t))
(use-package nodejs-repl :defer t)
(provide 'module-js)
;;; module-js.el ends here

View file

@ -32,7 +32,7 @@
"M-T" 'narf/tab-display
"A-`" 'os-switch-to-term
"C-`" 'narf/popup-messages
"C-~" 'rtog/toggle-repl
"C-~" 'narf:repl
"M-`" 'narf/popup-toggle
"M-w" 'narf/close-window-or-tab