Solve the problem that the direction keys and backspace keys cannot be used normally by VI in Ubuntu.

Source: Internet
Author: User
From: http://hongzhguan.iteye.com/blog/1479563

Solution 1:

Problem:

In ubuntu, the direction keys cannot be used when VI is being edited, and the return keys cannot be deleted.

Solution:

You can install the vim full version. In the full version, the keyboard is normal. After installation, use the VI command.

Install VIM:

Ubuntu is pre-installed with the vim tiny version, but requires the vim full version. Run the following statement to install Vim full:

$ Sudo apt-Get remove vim-common

$ Sudo apt-Get install Vim

In this way, VIM is an excellent software that can be used to understand.

Solution 2:

Run the ": Set nocompatible" command on the VI command line to set the incompatible mode for VI.

 
In ubuntu11.10, the VI command has three modes: input mode and edit mode. ": "After the command mode VI enters, the default mode is edit mode VI editing mode. The default shortcut keys are j k h lvi. In edit mode, you can use I to enter input mode VI. The input mode can only be in English, by default, the up, down, left, and right arrows in VI input mode cannot be used. You can use ESC to return to VI editing Mode Shift +. You can enter command mode VI command mode W to save and Q to exit.

1) It is effective for all users and solves the problem of garbled VI Chinese characters of users in the system.

Sudo gedit/etc/Vim/vimrc. Tiny

Add the following content:

# The file content is displayed as follows:

"Encoding related

Set encoding = UTF-8

Set langmenu = zh_CN.UTF-8

Language message zh_CN.UTF-8

Set fileencodings = ucs-bom, UTF-8, cp936, gb18030, big5, EUC-JP, EUC-KR, Latin1

Set fileencoding = UTF-8

2) only effective solutions for current users

By default, UBUNTU does not have a. vimrc file in the home directory of the current user. In this case, you can touch a. vimrc file and add it to it.

# The file content is displayed as follows:

"Encoding related

Set encoding = UTF-8

Set langmenu = zh_CN.UTF-8

Language message zh_CN.UTF-8

Set fileencodings = ucs-bom, UTF-8, cp936, gb18030, big5, EUC-JP, EUC-KR, Latin1

Set fileencoding = UTF-8

PS: I tried solution 1 to Solve the Problem smoothly.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.