Update: there might be a better way. Lookup "vim Node.js REPL" ("interactive shell" doesn't result in anything. The terminology is different between Python and Node.js/JavaScript)
- Tab completion is broken (even though IJavaScript claims to support it)
- When
jupyter console --kernel javascript
is run, when it's exited, there's a straynode
process that must be killed manually)
- Launch
node
manually.
How to send code to like jupyter-vim
plugin for jupyter consoles
Note: this method has the disadvantage that it doesn't stop sending commands when there's an error.
function JavaScriptShellOpen()
rightbelow vertical term node --experimental-repl-await
call feedkeys("\<c-w>\<c-w>p")
endfunction
nnoremap <buffer> \jo :call JavaScriptShellOpen()<cr>
nnoremap <buffer> \jO :call JavaScriptShellOpen()<cr>
let s:to_last_window='<c-w><c-w>p'
" paste content of "a into the last window
let s:send_code=s:to_last_window..'<c-w>"a'..s:to_last_window
" send paragraph to node shell
exec 'nmap <buffer> \jr mb"ayip`b'..s:send_code
" send selected to node shell
exec 'vmap <buffer> \jr "ay'..s:send_code
" send line to node shell
exec 'nmap <buffer> \jl "ayy'..s:send_code
" send cell to node shell (not implemented!)
nmap <buffer> \X <nop>
Not guaranteed to work if there are more than 2 windows in the tab.
???
2: List of all kernels: https://github.com/jupyter/jupyter/wiki/Jupyter-kernels