As of nodejs 6.6.0, when using the nodejs REPL you can enter multiline text in the terminal with:
.editor
I would like the nodejs REPL to open an instance of vim (in the same manner that git does when prompting for commit information) so that I can enter the multiline text there.
Does anyone know how to configure this? I realize that I could just run the nodejs REPL within vim or neovim in the first place, but I'm looking for a pure fix here.
How to Start the REPL. Starting the REPL is simple - just run node on the command line without a filename. It then drops you into a simple prompt ('>') where you can type any JavaScript command you wish.
There doesn't appear to be an easy way to customize this behavior. Digging through the code for nodejs
, it appears that the editor mode is simply streaming each line of together.
See here for the relevant piece of code on GitHub.
The closest solution to "use" vim in this NodeJS REPL is to enable Vi(m) mode in bash (if you're using the bash shell).
set -o vi
After running this or putting into your .bashrc
file, the command line interface will act like Vim and have editing modes you have to navigate.
Personally, even though I am a Vim user, don't like the Vi mode in bash because it is difficult to know which mode you're in, even if my go-to mode is Normal mode. Adding some text to indicate which mode you're in may be possible, but I don't think its worth looking into. But your mileage will vary.
See https://sanctum.geek.nz/arabesque/vi-mode-in-bash/ for more on Vi mode in bash.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With