Brisk Vim (1): Mobile

Source: Internet
Author: User
Tags linux mint
ArticleDirectory
    • Basic
    • Advanced

We have been using Vim intermittently for a year, and there will always be a few commands, with extremely low efficiency.

In the past few weeks, windows was replaced with Linux mint, which is basically stable.

Tonight, I have made up my mind to start a new Vim journey and write a series of notes and summaries.

I am just a new employee,CodeI have never written many lines, but I have been studying hard.

So please take a look at the old birds and smile. Don't despise me. I am very weak ......

This is the first section of the brisk Vim series, which is constantly updated.

Come on with vim! Let's sum up and practice together ......

Basic

Character Movement

 
K move up KH move left H ll move right JJ move down

You can also use the arrow keys on the keyboard to move, but the existence of h j k l is meaningless.

The main purpose of using h j k l to control the direction is to keep your hands away from the keyboard center, thus improving efficiency.

Tips: Add a number before the command to indicate the number of command executions. For example, if the number is 5 K, it indicates moving up 5 rows.

 

Word Movement

 
WWMove e to the beginning of the next word, move B to the end of the next word, and move back to the beginning of the previous word.

It should be noted that E will ignore punctuation marks, for example, I'm, E will be treated as two words, and E will not

Similarly, adding a number before a command indicates the number of executions. For example, if the number is 2 w, it indicates moving two words down.

I may say it several times at the beginning, because this technique is very important.

 

Move the entire row

 
0Move to the beginning of the row $ move to the end of the row+Move to the beginning of the next line-Move to the beginning of the previous line

Note that +-is different from j k above.

J k also moves to the previous row and the next row, but they move the cursor

+-No matter where your cursor is, it always moves to the beginning of the next line or the last line.

 

Advanced

Screen Rolling

CTRL +F scroll forward to the entire screen CTRL+B. Scroll down the screen and press Ctrl.+D scroll forward half screen CTRL+U scroll back to half screen CTRL+E. Scroll down a row and press Ctrl.+ Y scroll one row forward

It seems many, but it can be remembered Based on the keyboard location, and the following two are not commonly used

The above scrolling screen has one thing in common, that is, it will change the position of the cursor, and the screen is also changing.

If you want to keep the cursor in the original position for screen scrolling, see the following

 

Adjust the cursor with Z

 
Z <enter>Move the row where the cursor is located to the top of the screen Z. Move the row where the cursor is located to the center of the screen Z-Move the row where the cursor is located to the lower end of the screen

TIPS:980z <enter> 980th rows can be moved to the top of the screen

Well, sometimes you don't really want to scroll the screen, you just want to move in the current screen

Read down

 

Move on screen

H. Move Row M to the top of the screen. Move Row M to the center of the screen. l move row NH to the bottom of the screen. Move row n to the top of the screen. nl moves row n to the top of the screen.

I guess these three letters should be short for "high", "Middle", and "low ".

Just practice it several times. Note that the cursor position is changed here, which is different from the above two.

TIPS:You can use +-and j k to achieve the same location change, but you only need to perform the operation multiple times.

+-Do not forget the j k zone? Go up.

 

Move in current row

 
^Move to N at the first non-space position of the current row| Move to column N of the current row

The ^ here is the same as the position indicated by the above 0.

N |, I personally feel that there is no H l convenience, and slowly moving the number of trips is not as good as directly moving around by H l

 

Move by text block

The so-called text blocks are sentences, paragraphs, and sections.

(Move to the beginning of the current sentence) Move to the beginning of the next sentence {move to the beginning of the current paragraph} Move to the beginning of the next section [[move to the beginning of the current section] Move to the beginning of the next section

Among them, VIM uses? .! To mark a sentence.

A blank line to mark a paragraph

Mark a section with a section macro (I haven't figured out what the section macro is)

 

Move by row number

 
CTRL +G shows the current row information ng to line n g to the end of the text
Move Gg to the beginning of the text

If you do not know the number of rows, you can use Ctrl + G to view

If you want to convert to 800th rows, you can use 800 GB

In fact, the Z command can also be done, and move the cursor to the first line

TIPS:''Back quotes can be returned to the position before G

 

 

 

 

 

 

 

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.