backgroundAlthough I am an Android development engineer, I have also come into contact with various IDEs (not limited to Android development). Different IDEs often have different shortcut keys, and we can't configure every IDE. In fact, most IDEs now support Vim in the form of plug-ins. Therefore, you only need to master the basic use of Vim, and you can quickly get started in IDEs that support Vim, with familiar operations and familiar feel. Vim ModeVim can be divided into 3 modes: Normal mode, Visual mode and Insert mode. The following basic operations are all performed in Normal mode. The differences between the three modes are not explained in detail here. Bing search has many related basic tutorials. The relationship between the three can be simply described by the following figure Basic OperationCursor MovementPay attention to the difference between uppercase and lowercase letters Up, down, left, rightJust look at the table, it's simple and easy to understand. It may be a little awkward at first, but you will love it after getting used to it.
Inter-word positioningKey position If capitalized, words are allowed to contain punctuation w (jump forward to the beginning of a word) e (jump forward to the end of the word) b (jump back to the beginning of a word) Inline positioningKey position $ (position to the end of the line) 0 (position to the beginning of the line) ^ (position to the beginning of the line, ignoring spaces) fForward search for the character ch. If ch is a letter, it is case-sensitive. F Block positioningKey position {(jump to the previous code block) } (jump to the next code block) % (positions to another matching bracket) Page PositioningKey position gg (position to the first line of the page) G (position to the last line of the page) H (position to the top of the current page, High is capitalized) M (position to the middle of the current page, Middle is capitalized) L (position to the bottom of the current page, Low is capitalized) nG or ngg (position to the specified line, n represents the line number, must be greater than 0, if it is greater than the *** line number, it will jump directly to the *** line of the page) m and ' (this is a very powerful pair of commands that can mark a location and then quickly locate the mark on the same page. m means mark, a is a letter, which can be one of the 26 letters, and ' is a single quote followed by the previously marked letter) Screen scrollingFull screen scrollingKey position Ctrl + f (scroll down one screen, the first letter of Foward is lowercase) Ctrl + b (scroll up one screen, Backward has a lowercase first letter) Half screen scrollKey position Ctrl + d (scroll down half a screen, Down is lowercase) Ctrl + u (scroll up half a screen, Up is lowercase) Line ScrollingKey position Ctrl + e (scroll down one line) Ctrl + y (scroll up one line) Edit ModeinsertKey position i (insert at the cursor, the first letter of insert is lowercase) I (insert at the beginning of the line, the first letter of insert is capitalized) a (insert the character after the cursor, the first letter of append is lowercase) A (insert at the end of the line, the first letter of append is capitalized) o (insert in the previous row) O (Insert at the next row) cc/S (clear the current line and enter insert mode) s (clear the current character and enter insert mode) Well, this is very simple, so I won’t post a picture. FindKey position /pattern (forward search) ?pattern (reverse lookup) n (find next) N (Find Previous) * (When the cursor is on a word, search for the next word) # (When the cursor is on a word, search for the previous word) replaceKey position :%s/old/new/g (globally replace old with new) :s/old/new/g (replace the current line old with new) Note that the replace operation is only effective on the current page, so use this operation with caution. |
<<: Modify the default font globally, which can also be done through reflection
>>: Apple acquires French image recognition company, may embed technology into iPhone
Nowadays, the work of product and operation is be...
Whether it is a large company or a small business...
According to Taiwan's Economic Daily News, th...
Recently, Apple iOS WeChat released version 8.0.2...
iFixit has just shared a teardown report of the i...
How much does it cost to develop a digital mini p...
"Shale is very dense, and oil cannot be extr...
I would like to talk about the topic of testing p...
Introduction: The man's long legs stopped and...
Recent questions received: Editor, I am recently ...
The most embarrassing thing in life is: when you ...
Science Fiction Network, December 2, Xinhua News ...
Maybe many Apple fans didn't pay attention to...
When you walk into a private room in a hotel, you...
Audit expert: Wang Linyu Deputy Chief Physician, ...