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 website : http://www.hpw123.net

Email: [email protected]

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


textEditorThere are many, gedit, KWrite, OpenOffice, text-modeEditorThere are VI, VIM (enhanced version of VI). VI and VIM are our most commonly used in Linux.Editor. VI or VIM is the most basic text Editing tool for Linux, vi or VIM although there is 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.


OK, let's get into the theme:


Why should I learn VI

    • all of the Unix L The IKE system will have a VI text editor built in, and other text editors will not necessarily exist;
    • Many of the software's editing interfaces will be actively 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;
    • Simple program, very fast editing


two. Use of VI

Basically VI is divided into 3 modes, namely, General mode, 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 the characters or delete the whole line, you can copy, paste your file data.

    • edit Mode

In the general mode can be deleted, copy, paste and other operations, but cannot edit the contents of the file, until you press "I,i,o,o,a,a,r,r" and so on any one of the letters will not enter the editing mode, usually in Linux, when you press these keys, An INSERT or replace word appears at the bottom left of the interface, so you can edit it, and if you want to go back to normal mode, you must press ESC to exit edit mode.

    • command-line mode

In the general mode, enter ":?" /"3 of any one of the buttons, you can move the cursor to the bottom of the line, in this mode, you can provide the operation to find data, while reading, saving, a large number of replacement characters, leaving VI, display line number and other operations are done in this mode.

Key Instructions

Part I: General mode available button description, 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

Well, can you open several files together to edit it in vim? The answer, of course, is yes.

Using vim [file] [file] ...

Multi-window function

This multi-window and multi-file But there is a difference, I think carefully


Vim Common commands



Four. Other VIM usage precautions

Chinese coding problem

people should have encountered garbled, is not going crazy

Under Linux, you are using the Unified Code (UTF8) in the end-user interface of Vim, and the files will be garbled due to different coding.

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. Open the terminal's software, such as the Windows interface under GNOME

Workaround:

Lang=zh_cn. gb2312//specific 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, you can configure a suitable for their own

Want to configure look here haha

You can still look here.


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

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



OK, today's content is probably the case, if there is something wrong, ask the big God, we see in the next article:)

Oh, let's relax a bit. Easy Moment 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.