Up down left right changes to A B C D when using visudo

When I am using sudo visudo, I found that when I insert up down left right on my keyboard, it will display A B C D.

Internet says that if this happens on vi I should re-install vim, but can this work on visudo?

it should as visudo use vi… vi-sudo… :wink: if it call vi and not ex otherwise it will still use the original vi… and not vim… :thinking: and you will need to create an alias for
alias vi='vim'

EDIT: I’m not sure at all it will work… as the alias is for the user and sudo will certainly not keep it…
and just installing vim won’t change the use of vim instead of vi… :thinking:

you could overwrite the symbolic link coming with vi vi->ex and replace it with your own vi->vim but it will be changed back in case of vi update or reinstall…

There is other solution:

1. Precise the editor you want on the command:

sudo EDITOR=vim visudo

or with nano if you prefer (keep a terminal editor is my 1st advise)

2. Add in your sudoers file the following line (near the beginning not the 1st line)

Defaults editor=/usr/bin/vim

or nano if you prefer (keep a terminal editor is my 1st advise)

I’m not sure this line just change the edior for visudo or change the defaults editor when you run sudo (like as EDITOR env variable)

but nowaydays I would not use visudo as it just read and save /etc/sudoers and not the new way of using /etc/sudoers.d/ then you don’t see or know if other rules are defined in /etc/sudoers.d/ or maybe there is a way I’m not aware of (seems do be possible with -f option but you need to specify the file to edit and check.)*