If you've just started using vim and run vimtutor a few times, will it feel good vim is too clumsy to understand why it's so crowded, and even Visual Studio provides vim plugins. That's because you're still not getting rid of the mouse dependency, and the powerful command for VIM is that you still have the most fur.
If you are a beginner, you can read VIM beginner and advanced drills and personal experiences first.
Here are a few commands (command combinations) that will cover 90% of the job requirements, and you'll find that out of the mouse, it's actually not that awkward thing, and your operation seems faster.
The first step: Remember the cursor move command.
1.1 Assume that the cursor is at the current position in I(NT). How do I make the cursor move to the position indicated by |?
| | | || | | |
INT length = strlen (Other.m_data);
1.2 The cursor reaches the end of the line. How do I make the cursor move backwards to the position indicated by |?
int length = strlen (other.m_data);
| |
Command prompt:
0 ^ 2w et= F. G_ $
| | | || | | |
int length = strlen (Other.m_data);
| |
T= F.
0: to the Wardrobe
^: To the first non-blank character of the wardrobe
$: to end of line
G_: The last non-blank character to the end of a line
W: move by Word to the beginning of the next word (hint: n<command> repeat command N times)
E: Move by word to the end of the next word
F<char>: To the next <char> character place
T<char>: To the next <char> character at the first character
The f/t is the same as f/t, just the reverse operation.
1.3 Suppose the cursor is in the TODO comment line, how to go to the first line? Last line? Line n?
How quickly do you jump to Todo, next Todo, last Todo in other places?
String & string::operate = (const String &other) {
Check if it is self-assignment
if (this = = &other)
return *this;
TODO: Other things for copy
Todo:next
}
Command prompt:
GG: to the first line
G: to the last line
NG: To the nth row (hint: : Set nu display line number : Set nu! Do not display line numbers)
/pattern: Searching for pattern strings (if there are multiple matches N to next N to previous)
Important NOTES:
Many commands can be used in conjunction with the cursor movement to implement an operation on a region.
<start_position><command><end_position>
For example
0y$: To the wardrobe, start copying to the last character of the bank.
yE: Copy from the current position to the last character of the word.
DT): Removes all content from the current location until it is encountered.
Step two: Be familiar with regional selection.
2.1 <action>a<object> and <action>i<object> area operations
Action can be any command, such as D (delete), Y (copy), V (selectable in visual mode)
Object can be W (word), s (sentence), p (paragraph), or special word such as:),}, etc.
Lesson 2.1 operation on block
* <operation>a<word> <operation>i<word>: operation on a block, a word/sentence/paragraph/or any Thing between ", ',),},]
1. Move the cursor to below line inside HelloWorld.
2. Try the commands one by one and see what ' s the highlighted text.
VAW VIW (W stands for Word)
Vas Vis (sentence)
VAP VIP (paragraph)
VA "vi" ("")
VA] vi] ([])
3. Move the cursor back to Helloword, using D (elete) and Y (ank) Replace V in <operation> and see what happens.
---> Function (map["HelloWorld"]) {
--->//this is a comment
--->}
2.2 Suppose you have the following function, you intend to comment out all, how to do?
How do you plan to add an indent and how do you do it?
function (map["HelloWorld"]) {
var a = 10;
This is a comment
Return
}
Command prompt:
^ <Ctrl-v> <Ctrl-d> i//[ESC] [ESC]
1. Move your curser to the beginning of the function. ^
2. Ctrl+v:start block selection.
3. Ctrl+d:move your cursor to select the whole function.
4. i//[ESC]: Insert '//', enter ESC to make it affects
^ <Ctrl-v> <Ctrl-d>
Step three: Automatically prompt for ctrl +p or Ctrl + N
Fourth step: Split screen : Split and : Vsplit
Lesson 4 Split the window
1.: Split or:vsplit:split the window ^
2. Ctrl+w <dir>: dir is direction, can be hjkl or <-| | -
V
To select Working window
3. Ctrl+w Q:quit the split mode
4. Ctrl+w_ or ctrl+w| : Maximize the window
5. ctrl+w+ or ctrl+w-: Increase or decrease the size of the window
How, the above commands are familiar, is not the GUI editor you commonly used in 90% of the operation can be easily implemented in vim?
(The above can be regarded as advancedvim explanation, Advancedvim is a copy of the Vimtutor created by the Advanced Practice tutorial, can be downloaded here)
This article is from the "Chongrubujing Stroll" blog, please be sure to keep this source http://xiaoqingandtech.blog.51cto.com/11792937/1795717
Familiar with several commands, from mouse dependency, vim skill upgrade