From windows to * nix (4) Editor

Source: Internet
Author: User

This article is for vi, because it and its variants are the most widely used on * nix, but the most frustrated users. The user follows a certain installation or configuration instruction until the user encounters: "Use vi to edit xxxx. conf, add xxxx to it. "inexperienced users cannot continue, even exiting vi is a challenge.

 

Although * nix has other editors that are more suitable for windows users, they are not always available (for example, they are not installed ). I admit that vi is not easy to use. However, I have mastered the most basic vi usage and used vi to configure the system to get the editor you prefer. For example, I use vim, its operations are the same as those of vi, but it adds many features suitable for programmers. If you need to read the manual (man) on * nix, you will find that man's operations are the same as vi's.

 

Vi has a 10-minute tutorial that can be learned in 10 minutes, but this tutorial is not installed with vi, but in vim.

 

I have also learned this tutorial, but 10 minutes is definitely not enough. But I don't think there is any better Getting Started Guide than this tutorial.

 

To start this tutorial, enter vimtutor on your terminal. If the English language is not good, enter vimtutor zh.

 

Now, assume that you have learned this tutorial and have a preliminary understanding of vi. Next, let's talk about some personal opinions.

 

 

Pattern Editor

 

People often call vi this way. Strictly speaking, the GUI editor in windows is also in a pattern. For example, when you input a pair of hand-held keyboards, you obviously cannot use the mouse at the same time, at this time, you are in the typing mode. When you move your right hand away from the keyboard and use the mouse, you enter the command mode, and the typing is no longer possible.

 

There is a mode of operation: shortcut keys. It does not require a mouse and can be kept in the typing mode. All function operations are completed using a combination of key keys (such as Ctrl, Alt, Shift. EMACS has brought this approach to its extreme, and its users have always wanted the pedals to become standard PC accessories.

 

Therefore, if you are not a fan of EMACS, the mode will not be a gap between you and vi.

 

Operation Method

 

The GUI editor has a consistent operation method: move the cursor position, determine the operation range, and then press the button to operate. This makes it easy for users to get started.

In command mode, vi follows a similar method: move the cursor. The difference is that the operation is determined first, and then the operation range is determined.

The following example shows how to delete all the text and compare the operations of the GUI editor and vi:

The GUI editor first uses the mouse to locate the first character of the text, then press and hold the left mouse button to start dragging down to the last character of the text, and then press the Delete key.

Vi in command mode, enter 1G in sequence (move the cursor to the first line) d (to delete) G (move the cursor to the last line)

 

Memory burden

 

In the previous example, you will think that you should remember the meaning of G (indicating moving the cursor to a row). In addition, there are also letters w, e that indicate moving, but as long as you want, you can use only one row or one column of hjkl to move one row or one column at a time. If you cannot remember this, you can use the cursor key. Soon you will find it very slow, that's why you are looking for shortcuts. For example, if you select all the text in the GUI editor in the previous example, users with A little experience will not do the same. They will use A shortcut key (Ctrl + A) to select all the text, then, this Ctrl + A also took time to remember.

 

According to your actual work, you may only need a small part of the vi command, so you do not need to remember all the vi commands. Until one day, you have a new task, and you cannot stand the current operation speed, then you will naturally learn more commands.

 

 

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.