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?
- ????? ^: Move the cursor to the beginning of the line;??
- ??
- ????? $: Move the cursor to the end of the line;??
- ??
- ????? Ctrl-b: Similar to "PgUp" on the keyboard (b is Backword)??
- ??
- ????? Ctrl-f: Similar to "PgDn" on the keyboard (F is ForWord)??
- ???????
- ???????
?? ^: 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?
- ????? G: Move to the last line;??
- ??
- ????? 1 g: Move to the first line;??
- ??
- ????? 50G: Move to 50 lines;??
- ??
- ?????? H: Move to the first line of the current window;??
- ??
- ?????? M: Move to the middle position of the current window;
- ??
- ?????? 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?
- 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 e operation 5 times;??
- 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, i?am?eagerly?awaiting?my?next?disappointment.? -ashleigh? Brilliant??
- 2, Every?man ' S?memory?is?his?private?literature.? -aldous? Huxley??
- 3, life?is?what?happens?to?you?while?you ' Re?busy?making?other?plans.? -john? Lennon??
- 4, life?is?really?simple,?but?we?insist?on?making?it?complicated.? -confucius??
- 5, do?not?dwell?in?the?past,?do?not?dream?of?the?future,?concentrate?the?mind?on?the??
- 6, Present?moment.? -buddha??
- 7, the?more?decisions?that?you?are?forced?to?make?alone,?the?more?you?are?aware?of??
- 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?
- 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;
- ??
- 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?
- 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;