VIM Powerful inquiry cursor movement

Source: Internet
Author: User

VIM powerful inquiry cursor movement-richerg85 's Column-Blog channel-csdn.net

Not much nonsense to say, directly into the subject, now looking at "byte of Vim", documenting the powerful commands, step by step, in order to become a vimer!

???? 1. Move in a simple direction

??

? (The most basic move command, like your keyboard's left and right http://write.blog.csdn.net/postedit direction key, but the function is unusually powerful!) )

??? PS: If you are a new vim, I hope you can look at the side of the operation, if you are in the Windows environment, you can install a Cygwin or virtual machine under a Linux system, if it is a Linux system, you will not say anything!

? ? These four operations can be preceded by a number that represents the number of times the operation was performed, such as 5h, repeat H (5 letters to the left) 5 times.

??

??? Other keys:

??

[Plain]View Plaincopyprint?
    1. ????? ^: Move the cursor to the beginning of the line;??
    2. ??
    3. ????? $: Move the cursor to the end of the line;??
    4. ??
    5. ????? Ctrl-b: Similar to "PgUp" on the keyboard (b is Backword)??
    6. ??
    7. ????? Ctrl-f: Similar to "PgDn" on the keyboard (F is ForWord)??
    8. ???????
    9. ???????
  ?? ^: Moves the cursor to the beginning of the     line; $: Moves the cursor to the end of the row;     Ctrl-b: Similar to "PgUp" (b backword) on the keyboard     ctrl-f: Similar to "PgDn" on the keyboard (F is ForWord)??????



??? Line operation:

????

[Plain]View Plaincopyprint?
    1. ????? G: Move to the last line;??
    2. ??
    3. ????? 1 g: Move to the first line;??
    4. ??
    5. ????? 50G: Move to 50 lines;??
    6. ??
    7. ?????? H: Move to the first line of the current window;??
    8. ??
    9. ?????? M: Move to the middle position of the current window;
    10. ??
    11. ?????? L: Move cursor to the last line of the current window;
? ? ? G: Move to the last line,      1G: Move to the first line,      50G: Move to 50 lines, H: Move to the       first row of the current window,       M: Move to the middle of the current window,       L: Move the cursor to the last line of the current window;

?

2, Word, sentence, paragraph operation [Plain]View Plaincopyprint?
    1. W: The cursor moves to the beginning of the next word; note: For Chinese, consecutive Chinese characters as a word.??
    2. 2w: Repeat w operation 2 times;??
    3. E: The cursor moves to the ending of the next word;
    4. 5e: Repeat e operation 5 times;??
    5. B: Move the cursor forward and move to the beginning of the first word;
W: The cursor moves to the beginning of the next word; note: For Chinese, consecutive Chinese characters as a word. 2w: Repeat W operation 2 times, E: The cursor moves to the ending of the next word, 5e: Repeat the E operation 5 times, B: Move the cursor forward, move to the beginning of the first word;

If you want to learn more, you can enter it in vim Normal mode: Help Word-motions

Word (sentences) direct move operation:

): The cursor moves to the next sentence;

(: The cursor moves to the previous sentence;

3): Move the cursor down to 3 sentences

Paragraph (paragraphs) direct move operation:

{: move a paragraph up;

}: Move down one paragraph

3}: Move down 3 paragraphs

More operations in vim Normal mode input: Help cursor-motions

Mark (Mark):

When you are editing a document (not necessarily the last paragraph), you need to manipulate the other paragraphs of the current document, and after you have finished working with the other paragraphs, you want to return to the current paragraph of the operation, how quickly can it be returned:

Give you a text that can be easily explained:

[Plain]View Plaincopyprint?
    1. 1, i?am?eagerly?awaiting?my?next?disappointment.? -ashleigh? Brilliant??
    2. 2, Every?man ' S?memory?is?his?private?literature.? -aldous? Huxley??
    3. 3, life?is?what?happens?to?you?while?you ' Re?busy?making?other?plans.? -john? Lennon??
    4. 4, life?is?really?simple,?but?we?insist?on?making?it?complicated.? -confucius??
    5. 5, do?not?dwell?in?the?past,?do?not?dream?of?the?future,?concentrate?the?mind?on?the??
    6. 6, Present?moment.? -buddha??
    7. 7, the?more?decisions?that?you?are?forced?to?make?alone,?the?more?you?are?aware?of??
    8. 8, Your?freedom?to?choose.? -thornton? Wilder??
1, I am eagerly awaiting my next disappointment. -ashleigh Brilliant2, every man's memory is his private literature. -aldous Huxley3, life are what the happens to and you are busy making other plans. -john Lennon4, life are really simple and we insist on making it complicated. -CONFUCIUS5, do no dwell in the past, does not dream of the future, concentrate the mind on the6, present moment. -BUDDHA7, the more decisions that is forced to make alone, and the more is aware Of8, your freedom to choose. -thornton Wilder

The above text has 8 lines, when in the 6th line of editing, found that the 2nd line seems to have a problem, need to modify, in order to remember the current operation of the line, you can make a mark,Ma, then 2G (jump to line 2nd), after the operation, go back to Normal mode (press ESC), execute ' A ( Note that there is a single quotation mark in front of a, and then go back to line 8th of the previous action.

Operating instructions:

m+ words (Word A-Z or a-Z)

If another token is needed, it can be MB, and the return executes ' B;

Tags can also be deleted, using the command ":d elmarks" To delete the specified tag. The command ": Marks" lists all the tags.

Hurry up and try it!!!

?

Cursor Jump command:

[Plain]View Plaincopyprint?
    1. Ctrl-o: (Similar to the ctr-z cancel operation of a text editor such as word), this operation returns the position of the last cursor;
    2. ??
    3. Ctrl-i: (Similar to the ctr-y redo of a text editor such as word), this action returns to the last cursor position after the Ctrl-o is returned at the last cursor location??
Ctrl-o: (Similar to the ctr-z cancel operation of a text editor such as word), this action returns the position of the last cursor, Ctrl-i: (similar to the ctr-y redo of a text editor such as word), this action returns to the last cursor position after Ctrl-o is returned at the last cursor position



Operation of partial text

Ctrl-v: Enter block operation mode

The text example is also the above 8 paragraphs of text, the cursor is placed on line 6th (you can use the action described above to place the cursor at the beginning of Line 6th), press ESC into normal mode, press V into the visual mode (Vim tip), press AP (a paragraph) will select the current paragraph, Execute ~ will reverse the case letters, lowercase to uppercase, uppercase to lowercase!

[Plain]View Plaincopyprint?
    1. 6, PRESENT? Moment.? -buddha??
6, PRESENT moment. -buddha

If you want to work with Word, change the AP to AW (a word)!

Two images:

This picture can be used as a desktop;

VIM Powerful inquiry cursor movement

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.