Vim Learning Note (i): Preparing for work

Source: Internet
Author: User

First, preface

Before learning vim, but for a variety of reasons, did not continue to study, in fact, perseverance is not enough, not able to persist, so now vim will only be simple operation, really ashamed. Now pick up the learning vim and record the learning process, the fun commands in Vim, and the problems encountered in learning ... and hope to become a vim God someday (girls look at me on the command line hammering how much I admire ah ^_^).

Starting to learn vim is painful, because the commands in Vim are really too many, but hard to remember quickly and forget, so the most effective way is: keep practicing, it may be a bit long, so do not expect to use vim in a short period of time than the other editor effective.

(The learning curve of various text editors, the vertical and horizontal coordinates in the graph are not indicated.) What I understand is that the--x axis is proficiency, and the y-axis is the skill. So for Notepad, skills and proficiency are proportional. For VS, the greater the proficiency, the more skills you need, and the fewer skills you will need as you become more proficient. For VI, it takes a lot of skill to get started, but once you have mastered these skills, you will become more and more proficient. For Emacs, the skill and proficiency level is vortex-like. )

I thought an editor just, can have how much knowledge need to master, then incredibly found two books, specifically about the use of vim, it seems I am not very understanding of vim ah. My study is based on these two books, they are: "Learning VI and Vim Editor (seventh edition)", "Vim use skills", interested friends can download themselves from the Internet.

User summary of the four learning steps:

1. Survival

2, Feel good

3, feel better, stronger, faster

4. The ability to use VIM

Second, installation

I am using Ubuntu, the installation method is to enter the command line:

sudo apt-get install vim

How other versions of Linux are installed, they can be accessed online, there are many articles about how to install.

Iii. Understanding three basic models

(1) Normal mode

When you start Vim, VIM will be in normal mode. In the normal mode of vim, all keys are function keys. Common commands in Norma mode:

    • iInsert mode, press ESC back to Normal mode.
    • x→ Delete one character of the current cursor.
    • :wq→ Disk + exit (save :w , :q exit) (W can be followed by file name)
    • dd→ Delete the current line and save the deleted line to the Clipboard
    • p→ Paste Clipboard

Recommended :

    • hjkl(strong example recommends using it to move the cursor, but not necessary) → You can also use the cursor key (←↓↑→). Note: j just like the down arrow.
    • :help <command>→ Displays help for related commands. You can also type without :help command. (Exit help requires input: Q)

(2) Insert mode

In normal mode, press I on the keyboard to type Insert mode (of course, there are other ways, such as pressing A, O, O, etc., I is the most common method), when you see the-insert-font in the lower left corner of vim, you have entered the VIM insert mode. In insert mode, you are free to enter what you want to enter, just like with other editors ~

(3) Visual mode

In normal mode, press the V key on the keyboard to enter visual mode. In visual mode, you can select a portion of a file for deletion, copying, and so on.

Iv. switching between vim three basic modes

(1) Normal <-> Insert

In normal mode, press I on the keyboard to enter insert mode

In insert mode, press ESC on your keyboard to return to normal mode, and if you are not sure if you are in normal mode, you can press the ESC key multiple times

(2) Noraml <-> Visual

In normal mode, press V on the keyboard to enter visual mode

In visual mode, press the ESC key on your keyboard to return to normal mode (you can also press the V key again)

reference documents; http://blog.csdn.net/niushuai666/article/details/7275406

Vim Learning Note (i): Preparing for work

Related Article

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.