Brisk vim (1): Mobile

Source: Internet
Author: User

Intermittent use of vim for a year, will always be a few commands, very low efficiency

The last few weeks replaced Windows with Linux Mint, which basically stabilized.

Just tonight, I've made up my mind to start a new vim journey, by the way, by writing a series of notes and summaries

Or that sentence, I am just a new person, the code has not written many lines, but I have been silently trying to teach themselves

So, please look at the veteran to laugh and laugh on the line, do not despise me, I am very vulnerable ...

This is my "light Vim series" In the first section, each section will be updated constantly, add more skills in the

Vim Novice refueling, we summarize together, and work hard to practice ...

Basis

Character movement

K move                kh            left shift            H        ll            right move                JJ            down

You can also use the arrow keys on the keyboard to move, but the existence of H J K L loses its meaning.

The main purpose of using H J k L to control the direction is to keep your hands away from the keyboard Center for increased efficiency

tips: Precede the command with a number that represents the number of times the command executes, such as: 5k, which moves up 5 rows

Word movement

W W            move to the beginning of the next word e-e            moves to the end of the next word b b            backwards to the beginning of the previous word

It is important to note that E ignores punctuation, such as: I ' m,e will be two words, E won't

Similarly, precede the command with a number that represents the number of executions, such as: 2w, to move 2 words down

I may say a few more times at the beginning, because this technique is important.

Move entire row

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

The thing to note here is that there is a difference between the J K and the above.

J K also moves to the previous row and the next line, but they move where the cursor is located

+-no matter where your cursor is, always move to the beginning of the next line or the previous line

Advanced

Roll screen

Ctrl+f            Scroll forward a full screen ctrl+b            scroll back a full screen ctrl+d            forward half-screen ctrl+u scroll back            half screen ctrl+e            scroll backward one line        ctrl+y            Scroll forward one line

Seems to be more, but can be based on the location of the keyboard memory, and the following two are not commonly used

The scroll screen above has one thing in common, it will change the position of the cursor, and the screen is changing

If you want the cursor to remain in its original position, scroll the screen to see the following

Adjust the cursor with Z

Z<enter>        moves the row of the cursor to the top of the screen Z.              Move the row of the cursor to the middle of the screen Z              move the row of the cursor to the low end of the screen

tips:980z<enter> can move line No. 980 to the top of the screen

Well, sometimes you don't want to roll the screen, you just want to move in the current screen.

Look down, please.

Move through the screen

H move the line m to the top of the screen move to the center of the screen l move to the bottom line of the screen NH moves to the top of the screen the nth line           nl           moves to the top of the screen on the nth line

According to my guess these three letters should be high, middle and low abbreviations, in fact, very good to remember

Practice a few more times, it is important to note that this is just the position of the cursor changes, and the above two different

tips: You can use +-and J K to achieve the same position change, just to operate multiple times

+-and J K difference forget it? Look up.

Move in current row

^            moves to the first non-whitespace of the current line n|           Move to nth column of the current row

The ^ here is the same as the position shown in the above 0 normally

And n|, personal feeling is not h l convenient, slowly number of travel number is not as direct as the H-l move around

Move based on a text block

The so-called text blocks are sentences, paragraphs, subsections, etc.

(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 paragraph [[           move to the beginning of the current section]]           move to the beginning of the next section

Wherein, VIM with?. Wait for the symbol to mark a sentence.

Blank line to mark a paragraph

Use a section macro to mark a section (the section macro is what I haven't figured out yet)

Move by line number

Ctrl+g            Display current line information ng                go to nth line G                 go to end of text
GG moves to the beginning of text

If you don't know how many lines you have, you can use Ctrl+g to see

If you want to go to line No. 800, you can use 800G

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

tips:' anti-quotes can be returned to the position before using G

Brisk vim (1): Mobile

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.