VIM simple tutorial (4)

Source: Internet
Author: User
VIM simple tutorial (4) VIM simple tutorial (3) http://www.2cto.com/os/201303/194220.html Lesson 4 basic copy and paste operations cut and paste www.2cto.com when you use the command d or x to delete a paragraph of text, the deleted text will be automatically saved by vim... VIM simple tutorial (4) VIM simple tutorial (3) http://www.2cto.com/os/201303/194220.html Lesson 4 basic copy and paste operations cut and paste www.2cto.com when you use the command d or x to delete a piece of text, the deleted text is automatically saved to a special clipboard by vim. Then you can use the p command (put) to paste it behind the position where the cursor is located. You can try to enter the following two commands in sequence: the ddp commands are executed to change the two lines of content. similar to the following command, xp reverses the two letters. The www.2cto.com p command can also add a number to the front to repeat n times. Labels are added to the text. sometimes, we need to delete a large text block. it is difficult to describe the start and end of the text block directly using the d command. In this case, you can use the m command (mark) to make a mark in the text. Let's take a specific example. For example, the following text is available: int main (void) {double x = 1e-2; double y [5]; y [0] = gsl_log1p (x ); y [1] = log1p (x); y [2] = log1p2 (x); y [3] = log1p3 (x ); y [4] = log (1 + x); printf ("gsl_log1p = %. 15e \ n ", y [0]); printf (" log1p = %. 15e \ n ", y [1]); printf (" log1p2 = %. 15e \ n ", y [2]); printf (" log1p3 = %. 15e \ n ", y [3]); printf (" log (1 + x) = %. 15e \ n ", y [4]); return 0;} you want to delete several printf statements. First move the cursor to the first character p of the first printf statement. Run the ma command. A is the name of the tag. the naming rule is the same as that of the q command. Then move the cursor to the first character r of the return statement. Enter the command d'. Several lines of printf statements are deleted. 'A indicates the Mark position. 'A indicates the start position of the row where the mark is located. when we make multiple marks in an article, we may not be able to remember where all the tags are. In this case, you can use the following command to display all the tags.: Marks, we can see that in addition to our defined tags, there are also many custom system-defined tags. Their meaning will be introduced later. In the copy command Vim, the copy operation is called yank. The corresponding command is y. The y command is similar to the d command, except that it does not delete the selected region.
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.