I recently upgraded from Ubuntu 18.04 to Ubuntu 20.04 and got a strange problem with
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
This happens also in ncurses applications such as
ncdu: instead of Enter I need to use CTRL+M.
TERM environment variable seems to help, but not 100%. The default value I get in
TERM=screeen-256color, but if I change it to
TERM=xterm-256color everything seems to work fine in Vim, but not in
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
~/.byobu/.tmux.conf, but it helped only with Vim:
set -g default-terminal "xterm-256color"
The problem happens on
How can I solve this?
I tried again with a new user, and experienced the same problem, so my guess is that it could be something system-related.
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.