Debian learning vim for beginners under VMware Workstation easy to use (iii)

Source: Internet
Author: User

what is VIM?

Vim has the ability to edit the program, can be active in font color to identify the correctness of the grammar, convenient programming.

Vim is a text editor developed from VI. Code completion, compilation and error jumps and other convenient programming features are particularly rich, in the programmer is widely used.

Install Vim:

sudo apt-get install vim

vim keyboard diagram:

use of vim:

Basically vim is divided into three modes: Command mode, insert mode and bottom command mode (last line mode). The effects of these three models are:

Command mode:

I,o,a switch to insert mode to enter characters.

x deletes the character at which the current cursor is located.

: Switch to the bottom line command mode to enter the command at the lowest line.

Insert mode:

Character keys and shift combination: enter characters.

Enter: Enter, break.

Delete: Delete the key and delete the one character after the cursor.

Arrow keys: Move the cursor in the text.

Home/end: Moves the cursor to the beginning/end of the line.

PGUP/PGDN: Page Up/down.

Insert: The toggle cursor is in input/replace mode and the cursor becomes a vertical bar/underline.

ESC: Exit input mode and switch to command mode.

Baseline Command mode (last line mode):

Press: (colon) in command mode to enter the baseline command mode.

In the baseline command mode, the basic commands are:

: Q Exits the program.

: w Save the file.

: Wq save and leave.

Press the ESC key to exit the bottom command mode at any time.

Vim creation:

Vim Text.txt

vim commonly used buttons:General mode available for cursor movement, copy-and-paste, search-replace, etc. common Ways to move cursors:   

      ← (h): The cursor moves one character to the left.

↓ (j): The cursor moves down one character.

↑ (k): The cursor moves up one character.

→ (l): The cursor moves one character to the right.

Ctrl+f: The screen moves down one page.

Ctrl+b: The screen moves up one page.

G: Move to the last line.

GG: Move to the first line.

N<enter>:n is a number. The cursor moves down n rows.

common ways to search for replacements:

/vim: Look under the cursor for a string called Vim.

After N:/vim, then search down the string named Vim.

N:/vim, then search up the string named Vim.

: N1,n2s/vim1/vim2/g:n1 and N2 are numbers. Look for the string vim1 between N1 and N2, and replace the word with vim2.

: 1, $s/vim1/vim2/g: looking for  vim1 string, and replace the string with  vim2 .

      : 1, $s/vim1/vim2/gc: look for the vim1 string from the first line to the last line, and replace the string with vim2 ! and display the prompt character before the substitution to the user to confirm (confirm) whether need to replace!

Delete, copy, and paste:

X,x:x Delete one character for backward; X Delete a character before you want to.

Ndd:n is the number that deletes the downward n-row of the cursor.

YY: The line where the cursor is copied.

Nyy:n is a number. The next n rows where the cursor is copied.

P,p:p the copied data is pasted on the next line of the cursor, and P is affixed to a row on the cursor.

U: Repeat the previous action.

Ctrl+r: Redo the last action.

.: A decimal point that repeats the meaning of the previous action.

  

  

Debian learning vim for beginners under VMware Workstation easy to use (iii)

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.