Easy to learn Linux tutorial four artifact VI Program editor Introduction

Source: Internet
Author: User

This series of articles by @ Superman Einstein produced, reproduced please indicate the source.  

article Links:

http://hpw123.net/a/Linux/Linuxjichu/2014/1026/93.html

Superman Einstein personal site : http://www.hpw123.net

Email: [email protected]

CSDN: http://blog.csdn.net/u010283694


textEditorThere are very many, such as graphic mode gedit, KWrite, OpenOffice, text-modeEditorThere are VI, VIM (enhanced version number of VI). VI and VIM are the most commonly used in LinuxEditor. VI or VIM is the most important text editing tool for Linux, vi or VIM although no graphical interfaceEditorthe simple action of clicking the mouse, but the VI editorSystem Management,Server Managementin the character interface, it is never comparable to the editor of the graphical interface.


All right. Let's go to the subject:


Why should I learn VI

    • all of the Unix L The IKE system will have a VI text editor built in. Other text editors do not necessarily exist;
    • very many of the software's editing interfaces are automatically tuned with VI
    • Vim has the ability to edit the program, can be active in font color to identify the correctness of the grammar, convenient programming;
    • The program is simple. Edits quite quickly


two. Use of VI

Basically, vi is divided into 3 modes, each of which is a general pattern. Edit mode and command line mode

    • General Mode

Open a file with VI directly into the general mode (this is the default mode), in this mode, you can use the left and right buttons to move the cursor, you can delete characters or delete the whole line. Also be able to copy and paste your file data.

    • edit Mode

In general mode can be deleted, copy, paste and other operations. However, you cannot edit the contents of the file until you press "I". I,o,o,a. A,r,r "No matter what a letter after the entry into the editing mode, usually in Linux, when you press these keys, in the bottom left side of the interface will appear insert or replace words, at this time enough to edit. Instead, suppose you want to go back to normal mode. You must press ESC to exit edit mode.

    • command-line mode

In general mode among them. Enter ":?" /"3 or whatever one of the buttons. You will be able to move the cursor to the most following line in this mode. Be able to provide you with the operation of finding data while reading, saving. A large number of substitution characters, leaving VI, displaying line numbers, etc. are completed in this mode.

Key Instructions

Part I: Button description available in general mode, cursor movement, copy and paste, search and replace, etc.

Part Two: General mode switch to edit mode available key description

#p # pagination Title #e#


Part III: General mode switch to instruction column mode available key description


three. Vim's function

Block Selection

Oh, just mentioned in the VI operation is the unit of behavior, then how to fix is a block range it?


more file Editing

amount. Can vim open several files at the same time to edit together? The answer, of course, is yes.

Using vim [file] [file]:


multi-form functionality

This multi-form and multi-file But there is a difference. Think carefully.


Vim often uses commands



Four. Other VIM usage precautions

Chinese coding problem

people should have encountered garbled. Is it going crazy?

Under Linux. Vim's terminal interface you are using the Unified Code (UTF8), because the code is different, the file will be garbled

1. Your Linux system supports the default language data: This is related to/etc/sysconfig/i18n

2. Your terminal interface (BASH) language: This is related to the variable lang

3. The original code of your file

4. Software to open the terminal, such as the form interface below GNOME

Workaround:

Lang=zh_cn. gb2312//detailed look at your file encoding and then the Terminal Interface toolbar, "Terminal", "Set character encoding", "the desired encoding" OK, it should be okay.


Configure your own vim

VIM Configuration A lot of many, very cool, online has a lot of information, to be able to configure a suitable for their own

Want to configure look here haha

I can still look here.


                                                                          —————————— Superman Einstein updated on October 26, 2014

Note: Some of the text comes from bird's private cuisine



OK, that's what this is about today. Suppose there's something wrong with the writing. Ask the great God, we see in the next article:)

Oh. Let's just relax. Easy Moments 2014 collections



Easy to learn Linux tutorial four artifact VI Program editor Introduction

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.