How to Use the vim command to move the cursor

Source: Internet
Author: User

How to Use the vim command to move the cursor

It is worth mentioning that the pdf version of my vim tutorial has been completed. You can download it. Here is the download of csdn: csdn. If the download fails on the left, you can also enter the following address in the browser to download: http://download.csdn.net/detail/xinguimeng/7714213, of course, if you are a loyal user of Baidu network disk, you can also use Baidu network disk, I also synchronized upload to Baidu network disk, below: Baidu Network Disk download, if the address is Hung, you can enter in the browser: http://pan.baidu.com/s/1sj9CLXz to download.

* ************** Move the four arrow keys of the cursor ****************** *******

1. after using Windows for a long time, we will find that moving the cursor uses the mouse, even if there are four direction keys rarely used, but in vim, we advocate the idea of replacing the mouse with the keyboard, vim has a more complex series of commands that use the mouse instead of the keyboard to move the cursor.

2. in command mode, if we are in insert mode, we can press Esc to the command mode, and then use hjkl to move the cursor. These four keys are connected, h indicates moving the cursor to the left. j indicates moving down a row. k indicates moving the cursor up a row. l indicates moving the cursor to the right.

3. this command is a bit difficult, but it is not difficult to remember. h and l are on the leftmost and rightmost of the four key locations, respectively, which means moving left and right respectively, jk is connected. As j is in the front, it is converted to the vertical direction below, while k is in the back, corresponding to the vertical direction above.

4. In fact, these commands are naturally knocked out when they are used much more often, and they will still depend on the feeling.

* ****************** Other commands for moving the cursor *************** ***********

1. first, w indicates moving backward to the first letter of the next word. w indicates the first letter of "word", while B indicates moving forward a word, its cursor will automatically move to the first letter of the previous word, where B is the first letter of "before.

2. Then e indicates moving backward to the last letter of the next word, and ge indicates moving to the last letter of the previous word.

3. for what is a "word", this one can be freely defined in vim. By default, punctuation marks are also considered as a word, of course, we can modify the configuration item.

4. If you are familiar with regular expressions, you can understand the following commands. ^ The command automatically moves the cursor to the beginning of the current line, while the $ command automatically moves the cursor to the end of the current line, there is a 0 command, it indicates moving the cursor to the first character of the current row.

5. Many Commands can accept a number used for counting, that is, numerical counting. For example, 2 $ will move to the end of the next line rather than the end of the current line, but the 0 and ^ commands cannot use numerical values to count, because it has no practical significance.

* ***************** F command and t command ***************** ************

1. Let's talk about the f command and the t command. Both of these are search commands, which cannot be used separately. They must be used together with other characters to indicate the characters after the search.

2. for example, if we use the fx command, we will find the position of the first x character after this character, and position the cursor to this character. We can also use the Fx command, it searches left. f indicates "find", which indicates "search, search ".

3. For example, if we use the tm command, we will find the position of the first m after the character, but the cursor will not stay on m, but on the left of m, the lower case t indicates right search, and the upper case T indicates left search.

*********************** ********

1. it is inconvenient for me to write a tutorial in my online blog. We recommend you download my pdf version of the tutorial, which contains a large number of tutorials.

2. Enter a piece of text on vim, and then use Esc to return to the command mode to see the following:

.

3. Let's enter the 4 W command in command mode, but we are not in a hurry. Let's first look at what will be displayed in 4? See the following:


4. Then we enter w, that is, our 4 w command is complete. Let's see the effect:


5. If I give you some operations, I will be exhausted. You can download my pdf and read many of them.



********* ********************

1. Some may ask: Xin Xing, what are the functions of these commands for moving the cursor?

2. I can only say: it is useless at present, but with some of our subsequent commands, it can quickly implement copy and paste functions, this is more than an order of magnitude faster than moving the mouse to copy and paste.

3. vim is profound and profound, and the learning path is long and promising.





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.