I recently upgraded from Ubuntu 18.04 to Ubuntu 20.04 and got a strange problem with byobu
, tmux
, Vim and ncurses applications: Enter doesn't work, and I need to use CTRL+M instead.
For example, if I edit a file in Vim inside a Byobu (or Tmux) window in a Gnome-Terminal, typing Enter doesn't insert a newline character, but inserts a new line with a M
character. To insert a new line I need to type CTRL+M.
AS a result, to exit Vim I need to type ESC :q
CTRL+M.
This happens also in ncurses applications such as ncdu
: instead of Enter I need to use CTRL+M.
Changing the TERM
environment variable seems to help, but not 100%. The default value I get in byobu
and tmux
is TERM=screeen-256color
, but if I change it to TERM=xterm-256color
everything seems to work fine in Vim, but not in ncdu
.
In addition to this, Enter key doesn't work when I use F9 to change Byobu configuration - as I said above, I need to use CTRL+M to select items in the configuration.
I tried also to add the following line in both ~/.tmux.conf
and ~/.byobu/.tmux.conf
, but it helped only with Vim:
set -g default-terminal "xterm-256color"
The problem happens on xterm
also.
How can I solve this?
Update
I tried again with a new user, and experienced the same problem, so my guess is that it could be something system-related.
Update 2
Tinkering around with xev
I found that there's something odd with this laptop's keyboard - it's an ANSI keyboard even though I'm in Italy (standard Italian keyboard layouts are ISO), and Enter button sends the wrong keycode.
When I press the Enter button it sends a kyecode 104, KP_Enter
, instead of usual keycode 36, Return
. So it's an hardware problem, perhaps unrelated to Ubuntu itself. Not sure why I didn't realise it before.