Skip to content

Ctrl-U and other default bindings in the REPL are a bit counter-intuitive #20145

@tobia

Description

@tobia
  • Version: v10.0.0-nightly20180419bbdb4af0bd
  • Platform: Linux 4.10.0-42-generic 46~16.04.1-Ubuntu SMP Mon Dec 4 15:57:59 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

I'm not sure what library (or custom code) Node uses to handle line editing in the REPL, but being accustomed to Bash and GNU Readline (as most people probably are nowadays) some of the default bindings are a bit counter-intuitive.

The most egregious one being Ctrl-U, which in Node kills the whole line. In Bash and other Readline-based CLI, Ctrl-U only kills the part of the line before the cursor, as a counterpart to Ctrl-K. I think this is a bad default binding, because a lot of people will have Ctrl-U in their muscle memory and don't expect it to kill the whole line. The problem is compounded by the lack of Ctrl-Y (see below) and Ctrl-X Ctrl-U, either of which would allow you to undo the change.

Another different one is Ctrl-W, which in Node kills the last /\b/-separated word, instead of the last /\s/-separated word as it does in Bash / Readline. Also Ctrl-Y does not seem to yank the last killed string, which makes it impossible to move text around using the keyboard.

I was just wondering if any thought had been given to following the Bash / Readline default bindings, because that's what most users are presumably used to. (I'm not saying Bash or Readline are better or more "right" than the alternatives, just that it's the most used shell in the most used OS for Node development.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedIssues that need assistance from volunteers or PRs that need help to proceed.readlineIssues and PRs related to the built-in readline module.replIssues and PRs related to the REPL subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions