Examples of questions and answers about the VIM editor

Source: Internet
Author: User

What is the difference between VI and VIM editor?

A: The previous mention of VI and vim, but a lot of people like me will think of the difference between the two? Most of the early UNIX use of the VI editor, you can understand that the VIM editor is the upgrade version of VI, then VIM should be more advanced than VI, the VI editor when editing the file will not display color, and vim will show the color, color for our future programming is very useful, Especially when reminding you that there are problems in some places, in general there is no difference between vim and VI, the individual suggests using the Vim editor.

Three modes of the VIM editor?

A: This question actually how to say, is just a name, some of us are accustomed to call "General mode, edit mode, command mode" some custom "command mode, insert mode, last line mode" regardless of which mode we need to clear to each mode of several commands and functions.

General mode features and a few commands?

A: When we use vim +filename to edit a file into the first mode is what we call the general mode, in this mode we can 1, move up and down the cursor 2, delete a character 3, delete a line 4, copy and paste a row or multiple lines. Move cursor in general mode: in the order of the upper and lower left and right: on the keyboard, around or KJHL,

Pages that encounter MultiPage paging up and down to: Ctrl+f ctrl+b or PageUp and PageDown

Move to the beginning of the bank: O or number 0

Move to the end of our line: shift+4

Move to the lowest line of text: G

Move to the first line of the text: NG (n is a number)

Move to the first line of the text: GG

Specify the Find and replace command in general mode?

For example/word: Look after the string for word after the cursor, and when the first one is found, press N to search for the next

Word to search for the string before word, locate and then press N to continue looking for the next

: n1,n2s/word1/word2/g: The cursor is word1 replaced with Word2, in this note if G is changed to change the first word1 of the row to Word2.

: 1, $s/word1/word2/g: replace all word1 of the text with Word2

Here are two commands to note: Set Nu and: Set Nonu, which adds line numbers to the text because it is very likely that there will be multiple lines of text in the actual edits at this point we use the command to display the line number so that we can better edit the text.

Specific description of the general mode of deletion, copy and paste?

A: Previously deleted one character and deleted one character backwards: x,x

Delete cursor Line: DD

Delete cursor down n rows: ndd

Copy cursor line: yy

Copy cursor down n line: Nyy

Paste from the next row and previous line on the lines: P and P

How do I enter edit mode from general mode?

A: From the general mode into the editing mode a total of 6 in the entry method I: the insertion of the character before the cursor, I insert the character at the beginning of the letter, a after the cursor, a at the end of the current line, o insert a row after the current line, o insert a row before the current line

Explain the basic features of edit mode and common function commands?

A: Enter edit mode the last line display insert or "insert" the word, from the edit mode to exit the general mode just press the ESC key,

After editing the save a few commands, it should be accurate to press ESC exit after the command mode of saving.

Save edited text:: w,:w! (Force Save)

Exit edit mode:: Q, whether or not to edit force exit: q!

Save and exit:: wq!

Examples of questions and answers about the VIM editor

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.