A concise tutorial for vim--half an hour from beginner to mastery

Source: Internet
Author: User
Tags lowercase save file

Vim three modes: Command mode, insert mode, bottom line mode. Use ESC, I,: Toggle mode.

vim [path/] Target file name : Open if it exists, new and open if it does not exist.

Basic Steps : 1. Vim hello.c 2. Type I 3. Edition 4. Type [ESC] 5. Type: Wq Save exit

 

Command mode : for copy, paste, delete, insert, undo, move, etc.

move : H, J, K, l--move left, bottom, top, and right cursors (J compare like ↓)

Digital 0--to our $--to the end of our line

^--to the first non-whitespace character of the bank g_--with the last non-whitespace character of the bank

gg--to the first line of the file g--to the last line of the file (note uppercase)

Number ng--to nth row (colon: number n--can also specify n rows)

w--to the beginning of the next word e--to the end of the next word

w--to the next space before e--to the next space

%--matching parentheses move (including (), [], {}, need to move to a parenthesis first)

*/#--moves to the next/previous word that matches the word currently in the cursor

Insert : i--insert text before cursor a--insert text after cursor

o--inserts a new row after the current line o--inserts a new row before the current row (uppercase)

Delete : x--Delete the current cursor character

dd--Delete the current cursor row, delete the content in the Clipboard

[n]dd--deletes the n rows at the beginning of the line where the current cursor is located

copy : yy--Copy the current cursor in the row

[N]yy--n is a number that duplicates the n rows at the beginning of the current cursor

paste : p--paste the Clipboard to the cursor in the row

Search :/name<enter>--After looking for a string named "name" after the cursor, press N, jump between characters

undo : u--undo (note is lowercase) ctrl+r--fallback

override : r--replaces the character at the current cursor cw--the character at the end of a word from the position of the cursor

Other:gu--Word to uppercase gu--Word to lowercase

Cut = = delete + paste

Bottom-line mode :

: W Save (followed by filename, can save file as)

: Q Exit VI (System will prompt to save changes)

: Q. Forced exit (do not save for modification)

: Wq to exit after saving

: Set number Displays line numbers: Set Nonumber Cancel line number

:。 < system command > Execute a system command and display the results, press <enter> to return

:。 SH Switch to command line, press Ctrl+d to return vim

: Help <command> display VIM-related commands

: E <path/file> open a file: bn and: Switch between BP files (: N to next file)

better, faster , stronger.

Digital n<command>: repeated command command number n times, 3DD, 2p

. (decimal point): Repeats the last command

V: Visualize the operation (enter v before entering the command)

block Operation: Ctrl + V, Move cursor Selection object, I,<command>,esc effective

Auto Indent: Ctrl + V, move cursor selection line, =

Indent left and right: Ctrl + V, move cursor Select row,</>

Auto Tip: CTRL + N

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.