All Projects → abicky → Nodejs Repl.el

abicky / Nodejs Repl.el

Run Node.js REPL and communicate with the process

Projects that are alternatives of or similar to Nodejs Repl.el

Eval In Repl
Consistent ESS-like eval interface for various REPLs
Stars: ✭ 130 (-20.25%)
Mutual labels:  emacs, repl
Clj Suitable
ClojureScript "IntelliSense" support for JS objects and their properties/methods. Via figwheel and Emacs CIDER.
Stars: ✭ 82 (-49.69%)
Mutual labels:  emacs, repl
Indium
A JavaScript development environment for Emacs
Stars: ✭ 1,058 (+549.08%)
Mutual labels:  emacs, repl
Spiral
Emacs Clojure IDE based on UNREPL
Stars: ✭ 146 (-10.43%)
Mutual labels:  emacs, repl
Evil Goggles
Display visual hint on evil edit operations
Stars: ✭ 159 (-2.45%)
Mutual labels:  emacs
Discover.el
Discover more of emacs with context menus!
Stars: ✭ 153 (-6.13%)
Mutual labels:  emacs
Lunarymacs
Moon-based Emacs configuration.
Stars: ✭ 151 (-7.36%)
Mutual labels:  emacs
Lumo
Fast, cross-platform, standalone ClojureScript environment
Stars: ✭ 1,861 (+1041.72%)
Mutual labels:  repl
Emacs Flymake
Continuous syntax checking for Emacs. Fork to add max parallel invocations and other bug fixes.
Stars: ✭ 162 (-0.61%)
Mutual labels:  emacs
Evil
The extensible vi layer for Emacs.
Stars: ✭ 2,265 (+1289.57%)
Mutual labels:  emacs
String Inflection
underscore -> UPCASE -> CamelCase conversion of names
Stars: ✭ 157 (-3.68%)
Mutual labels:  emacs
Org Msg
OrgMsg is a GNU/Emacs global minor mode mixing up Org mode and Message mode to compose and reply to emails in a Outlook HTML friendly style.
Stars: ✭ 153 (-6.13%)
Mutual labels:  emacs
Modern Cpp Font Lock
C++ font-lock for Emacs
Stars: ✭ 159 (-2.45%)
Mutual labels:  emacs
Linum Relative
display relative line number in the left margin in emacs
Stars: ✭ 152 (-6.75%)
Mutual labels:  emacs
Lpy
Minimal Python IDE for GNU Emacs
Stars: ✭ 161 (-1.23%)
Mutual labels:  emacs
Emacs4cl
A 40 line ~/.emacs to quickly set up vanilla Emacs for Common Lisp programming
Stars: ✭ 151 (-7.36%)
Mutual labels:  emacs
Ac Php
emacs auto-complete & company-mode for php
Stars: ✭ 157 (-3.68%)
Mutual labels:  emacs
Typescript.el
TypeScript-support for Emacs
Stars: ✭ 160 (-1.84%)
Mutual labels:  emacs
Hexo Renderer Org
Hexo renderer plugin for emacs org-mode
Stars: ✭ 157 (-3.68%)
Mutual labels:  emacs
Atom Chlorine
An Atom plugin to integrate with Socket-REPL over Clojure, ClojureScript, ClojureCLR, Joker, Babashka, Clojerl, Lumo and Plank
Stars: ✭ 155 (-4.91%)
Mutual labels:  repl

nodejs-repl.el

Run Node.js REPL in Emacs

Description

This program is derived from comint-mode and provides the following features.

  • token completion, same as Node.js REPL
  • file name completion in string
  • incremental history search
  • sending JavaScript codes to REPL

Usage

Put this file in your Emacs lisp path (e.g. ~/.emacs.d/site-lisp) and add the following line to your .emacs:

(require 'nodejs-repl)

Type M-x nodejs-repl to run Node.js REPL. See also comint-mode to check key bindings.

You can define key bindings to send JavaScript codes to REPL like below:

(add-hook 'js-mode-hook
          (lambda ()
            (define-key js-mode-map (kbd "C-x C-e") 'nodejs-repl-send-last-expression)
            (define-key js-mode-map (kbd "C-c C-j") 'nodejs-repl-send-line)
            (define-key js-mode-map (kbd "C-c C-r") 'nodejs-repl-send-region)
            (define-key js-mode-map (kbd "C-c C-c") 'nodejs-repl-send-buffer)
            (define-key js-mode-map (kbd "C-c C-l") 'nodejs-repl-load-file)
            (define-key js-mode-map (kbd "C-c C-z") 'nodejs-repl-switch-to-repl)))

When a version manager such as nvm is used to run different versions of Node.js, it is often desirable to start the REPL of the version specified in the .nvmrc file per project. In such case, customize the nodejs-repl-command variable with a function symbol. That function should query nvm for the Node.js command to run. For example:

(require 'nodejs-repl)
(defun nvm-which ()
  (let* ((shell (concat (getenv "SHELL") " -l -c 'nvm which'"))
         (output (shell-command-to-string shell)))
    (cadr (split-string output "[\n]+" t))))
(setq nodejs-repl-command #'nvm-which)

The nvm-which function can be simpler, and perhaps can run faster, too, if using Bash:

(defun nvm-which ()
  (let ((output (shell-command-to-string "source ~/.nvm/nvm.sh; nvm which")))
    (cadr (split-string output "[\n]+" t))))

Author

Takeshi Arabiki (abicky)

Copyright and License

Copyright (C) 2012-2020 Takeshi Arabiki (abicky)

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].