Ubuntu VMware arrow keys and backspace space bar of the vi command to garbled

created at 06-07-2022 views: 18


Under Ubuntu, there is a problem when using vi initially, that is, when using the arrow keys in edit mode, the cursor does not move, but [A [B [C [D like letters appear in the command line, and if the editing is wrong, even the Backspace key cannot be used, and can only be deleted with Delete.

In response to this question, there are many answers on the Internet, such as installing the full version of vim, editing /etc/vim/vimrc.tiny and other methods, which are very complicated and messy. Here is the easiest way to summarize:


Edit /etc/vim/vimrc.tiny

sudo vi /etc/vim/vimrc.tiny

Since the owner of /etc/vim/vimrc.tiny is the root user, this file needs to be modified under the root permission.

Very simple, the penultimate sentence in this file is set compatible, changing compatible to nocompatible non-compatible mode can solve the problem of the arrow keys changing to ABCD, as shown below:

set nocompatible

Next, it is very simple to solve the problem of the Backspace key. Add a sentence after the above sentence:

set backspace=2

problem solved!

created at:06-07-2022
edited at: 06-09-2022: