Search code examples
consolev8

google d8 (v8 shell) navigation on Mac (arrow keys) do not navigate


I'm using the v8 console (d8) on a Mac after installing it via brew install v8. Let's say I type something like:

const a = {};|

(where | is the cursor) - I want to move the cursor back so that it's in between the curlies, like so:

const a = {|};

But, when I press the back button, I get:

const a = {};^[[D^[[D

... Is there a way to fix this or even a key combination I can use to navigate?

Thanks!


Solution

  • The feature you're looking for is called "readline support", named after the library that provides it. d8 does not currently have such support. Thankfully, there's a handy tool named rlwrap that emulates readline support for arbitrary interactive terminal programs. Installing that and then running d8 as rlwrap d8 should give you what you want :-)