File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ You can define key bindings to send JavaScript codes to REPL like below:
2929 (add-hook 'js-mode-hook
3030 (lambda ()
3131 (define-key js-mode-map (kbd "C-x C-e") 'nodejs-repl-send-last-expression)
32+ (define-key js-mode-map (kbd "C-c C-j") 'nodejs-repl-send-line)
3233 (define-key js-mode-map (kbd "C-c C-r") 'nodejs-repl-send-region)
3334 (define-key js-mode-map (kbd "C-c C-l") 'nodejs-repl-load-file)
3435 (define-key js-mode-map (kbd "C-c C-z") 'nodejs-repl-switch-to-repl)))
Original file line number Diff line number Diff line change @@ -355,6 +355,19 @@ when receive the output string"
355355 " Send ^U to Node.js process."
356356 (nodejs-repl--send-string " \x 15" ))
357357
358+ ;;;### autoload
359+ (defun nodejs-repl-send-line ()
360+ " Send the current line to the `nodejs-repl-process' "
361+ (interactive )
362+ (save-excursion
363+ (let ((proc (nodejs-repl--get-or-create-process))
364+ (start))
365+ (beginning-of-line )
366+ (setq start (point ))
367+ (end-of-line )
368+ (comint-send-region proc start (point ))
369+ (comint-send-string proc " \n " ))))
370+
358371;;;### autoload
359372(defun nodejs-repl-send-region (start end )
360373 " Send the current region to the `nodejs-repl-process' "
You can’t perform that action at this time.
0 commit comments