Introduction to VIM Tutorial

Source: Internet
Author: User
Tags switches

Reference:

http://blog.csdn.net/longxibendi/article/details/38276847

The VIM editing program has three modes of operation, called edit mode , insert mode , and command mode, respectively.

Note: Some instructions cannot be executed on my machine. Unspecified cause (version replacement, incorrect input mode)

Edit mode:

Page movement:

K Move Up, J down, H shift, l move right.
Ctrl+f moves forward one page (equivalent to page down) in a file, and Ctrl+b moves back one page in the file (equivalent to page UP);

H moves the cursor to the starting line (or the most upstream) on the screen, and M moves the cursor to the middle of the screen , and moves the cursor to the last line of the screen.

W moves the cursor to the beginning of the next word; e moves the cursor to the end of a word; B moves the cursor to the beginning of the previous word; 0 number 0, moves the cursor left to the beginning of the bank ; Move the cursor to the end of the bank; , to the first non-null character of the bank.

Font search:

*      when the cursor rests on a word, the * key searches for the word within the file and jumps to the next; #         when the cursor rests on a word, # searches for the word within the file and jumps to the previous one; (/)   
   
     move to the 
    beginning of the previous/following sentence; {/}        jumps to the beginning of the current/ 
    next paragraph.  
    GG  positions the cursor to the beginning of the first line of the file;
/str1 the search string str1;n continue searching to find out where the STR1 string will appear Next, n continue searching, find out where the str1 string last occurred; str2 Reverse search string str2.

Mode switching and screen switching:

Add a    New line at the top of the row where the cursor is inserted at the beginning of the line where the cursor is inserted at the end of the line at the cursor: SP (split) up and     down screen;: vspvsplit)    split the screen left and right. CTRL+w+H        switches to the left of the current split screen; Ctrl+w+L        switches to the right of the current split screen; Ctrl+w+J        switches to the bottom of the current split screen Ctrl+w+k        Switch to the top screen of the current split screen

Basic Operation Instructions:

s replaces the right side of the cursor with the input body, and enter edit mode;S Delete the current line and enter edit mode;
u undo the result of the previous command;
. Repeat the last command to modify the body
p Pastes the contents of the buffer to the back of the cursor;
P Pastes the contents of the buffer to the front of the cursor.
YY copies the current line to the memory buffer;
The +y copy1 line to the operating system of the pasteboard;
RC              replaces the current character pointed by the cursor with C, and X               deletes the current character pointed to by the cursor;
d$              deletes characters from the current cursor until the end of the line; D0              deletes characters from the current cursor until the beginning of the line;
J Delete Our carriage return (CR) and merge with the next line.

Text Store directives:

: E path_to_file/filename  // open a file : Q              quit without modification;: Q!              Discard all changes and exit the editing program. : N              moves the cursor to the nth line: W              writes the edited content to the original file to save the edited intermediate result: Wq             writes the edited content to the original file and exits the editing program (equivalent to the ZZ command): W file         writes the edited content to the file. Keep the contents of the original files unchanged: A,BW file writes the contents of line      A to line B to the file: R files reads the contents of the file and inserts the following         line of the current cursor: E file to         edit new files instead of the original content: F file renames the         current file to file:f              prints the current file name and status, such as the number of lines of the file, the line number where the cursor is located, etc.

Composition rule: The meaning of +n before the instruction is to execute the line n times.

DW Deletes the              word to the right of the cursor, DB              deletes the word to the left of the cursor, and DD deletes the line of the cursor              and removes the gap;

Introduction to VIM Tutorial

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.