terminal: Ctrl arrow keys don't behave as expected

From @Karasuni on May 25, 2017 16:19

Using Bash on Windows the ctrl+arrow keys don’t behave as expected. Instead of navigating per word it instead prints a few characters:

  • Ctrl + UP => ;5A
  • Ctrl + DOWN => ;5B
  • Ctrl + LEFT => ;5C
  • Ctrl + RIGHT => ;5D

The issue also appears in tmux when trying to resize te terminal using Oh My Tmux command Ctrl+A + arrow key

Copied from original issue: Microsoft/WSL#2153

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 9
  • Comments: 23 (16 by maintainers)

Most upvoted comments

For what it’s worth, if you have an .inputrc file in your home directory, then the default /etc/inputrc file is not read. If you want to have the default bindings then you can either copy the file contents, or add the directive $include /etc/inputrc to your ~/.inputrc file.

The original issue from 2017 had exactly this problem, ~/.inputrc was present and it did not include the default /etc/inputrc.

If you’re using zsh, there are instructions here https://hellricer.github.io/2019/05/21/ctrl-arrows-in-terminal.html

Based on my investigation, the default configuration of bash does not allow <kbd>Ctrl+Arrow</kbd> to navigate by word.

Have you configured your inputrc to allow this? If not, this is not a bug.

@jsn1993 Could you give us more info? The Ctrl+arrow keys have worked pretty consistently for a few Windows releases at this point, so I bet something else is going on. Could you maybe file a new issue with repro steps?

I can also use ctrl+A to move to the beginning of the line in WSL, but no luck with ctrl+arrow