Efficient mobile
Outside the Insert mode
Basically, you should stay in the insertion mode as little as possible, because Vim is like a "dumb" editor in insert mode . Many novices will always stay in the insert mode because it is easy to use. But the power of vim is in his command-line mode! You'll find that after you get to know vim more and more, you'll spend less time using insert mode.
Using h,j,k,l
The first step in using Vim for efficient editing is to give up using the arrow keys. With VIM, you don't have to move between the arrow keys and the letter keys frequently, which can save you a lot of time. When you are in command mode, you can use h,j,k,l to implement the function of left, bottom, upper, and right arrows respectively. You may need to get used to it at first, but once you get used to it, you'll find the efficiency of this operation.
When you edit your e-mail or other text that has paragraphs, you may find that using the arrow keys is not the same as the effect you expect, and sometimes you may skip a lot of lines at a time. This is because your paragraph in vim appears to be a large long line. You can then type a g before pressing H,J,K or L so that vim moves as you wish on the line above the screen.
Moves the cursor effectively within the current line
Many editors only provide simple commands to control the movement of the cursor (e.g. left, top, right, bottom, to beginning/end, etc.). VIM provides a number of powerful commands to satisfy your desire to control the cursor. When the cursor moves from one point to another, the text between these two points (including these two points) is called "Crossing ", and the command here is called motion. (briefly, this important concept will be used later)
Here are some of the commonly used commands (motion):
FX: Moves the cursor to the next X at the current line. Obviously, X can be any one letter, and you can use it to repeat your last F command.
TX: Similar to the above command, but moves to the left of X. (This is really useful.)
FX: Like FX, it's just looking backwards.
W: The cursor moves forward one word.
B: The cursor moves backwards by one word.
0: Move the cursor to the beginning of the current line.
^: Moves the cursor to the first letter position of the current line.
$: Moves the cursor to the end of the line.
): Move the cursor to the next sentence.
(: Move the cursor to the previous sentence.)
Move the cursor effectively throughout the file
Vim has a lot of commands that you can use to get to where you want to go in the file. Here are some commands to move inside a file:
: Moves down one screen.
: Moves up one screen.
G: To end of file
NUMG: Moves the cursor to the specified line (num). (e.g. 10G is to line 10th)
GG: To the top of the file
H: Move the cursor to the top of the screen
M: Move the cursor to the middle of the screen
L: Move the cursor to the bottom of the screen
*: Reads the string at the cursor and moves the cursor to where it appears again.
#: Similar to the above, but looking in the opposite direction.
/text: Searches for the string text from the current cursor and reaches the text where it appears. You must use carriage return to start this search command. If you want to repeat the last search, press N.
? Text: Similar to the above, but in the opposite direction.
MA: Marks a bookmark at the position of the current cursor, named A. The book signature can only be lowercase letters. You can't see the existence of a bookmark, but it's already there.
' A: Go to bookmark A. Note that this is not a single quote, it is generally on the left side of 1 of most keyboards.
'.: To the place where you last edited the file. This command is useful, and you don't have to tag it yourself.
High-efficiency input
Auto-complete with keywords
VIM has a very beautiful keyword auto-complete system. This means that you can enter a part of a long word, then click on a key, and then vim will complete the input of the long word for you. For example: You have a variable named Iamalongandawkwardvarname somewhere in the code you write. Maybe you don't want to enter it every time you go through a letter.
With the Keyword AutoComplete feature, you only need to enter a few letters (such as Iamal) and then press (Hold down CTRL, press N) or. If Vim doesn't give you the word you want, basically press until you're satisfied, and Vim will loop through the matching string it finds.
Smart into insert mode
Many beginners go into insert mode with just I. This, of course, can go into insert mode, but it is usually not so appropriate because VIM provides a lot of commands to enter the insert mode. Here are some of the most common:
I: Insert on the left of the current character
I: Inserting at the beginning of the current line
A: Insert to the right of the current character
A: Insert at the end of the current line
o: Insert a new row below the current line
O: Insert a new row above the current line
C{motion}: Removes the characters that the motion command crosses and enters insert mode. For example: C $, which removes the character from the cursor position to the end of the line and enters insert mode. Ct! , which removes from the cursor position to the next exclamation mark (but not included) and then into insert mode. The deleted characters are present in the Clipboard and can be pasted again.
D{motion}: Same as above, but not into insert mode.
Effectively move large segments of text
Use visual selection (visual selections) and the appropriate selection mode
Don't want the initial vi,vim to allow you to highlight (select) some text and manipulate it. There are three types of visual selection modes:
V: Select by character. Often use the pattern, so try it out for yourself.
V: Select by row. This is especially useful when you want to copy or move a lot of lines of text.
: Select by block. Very powerful, only in a few editors have such a function. You can select a rectangular block, and the text inside the rectangle will be highlighted.
Use the arrow keys and commands (motion) described above when selecting the mode. For example, VWWW will highlight the three words in front of the cursor. VJJ will highlight the current row and the following two lines.
Cut and copy in Visual selection mode
Once you highlight the selection, you might want to do something like this:
D: Clip the selected content to the Clipboard.
Y: Copies the selected content to the Clipboard.
C: Clip the selected contents to the Clipboard and enter insert mode.
Cut and copy in non-visual selection mode
If you know exactly what you want to copy or cut, you don't need to enter the visual selection mode at all. This will also save time:
D{motion}: Cut the character spanned by the motion command to the Clipboard. For example, DW cuts a word and DFS cuts the character from the current cursor to the next s to the Clipboard.
Y{motion}: Similar to the above, but a copy.
C{motion}: Similar to D{motion}, but finally into insert mode.
DD: Cuts the current line.
YY: Copies the current line.
CC: Cuts the current line and enters insert mode.
D: Cut from the cursor position to the end of the line to the Clipboard.
Y: Copies the current line.
C: Similar to D, and finally into insert mode.
X: Cuts the current character to the Clipboard.
S: similar to X, but finally into insert mode.
Paste
Paste is simple, press p.
Using multiple clipboard
Many editors provide only one clipboard. There are many vim. The Clipboard is called a register (registers) in Vim. You can list all of the current defined register names and their contents, with the command ": Reg". It is best to use lowercase letters as the name of the register, because some of the capitalization is used by VIM.
The command that uses the register is a double quote ".
For example: We want to copy the current line to register K. You should press "Kyy." (You can also use V "Ky. Why is this possible? Now the current line should already exist in register K until you copy something into register K. Now you can use the command "KP" to paste the contents of the register K into the position you want.
Avoid duplication
It's amazing. Command
Inside VI, enter. (decimal symbol), the last command you gave is repeated. For example, your last command is ' DW ' (delete a word), vi will then delete a word.
Using numbers
Using numbers is also one of the most powerful and time-saving features of vim. A number can be used before many VIM commands, and this number will tell vim how many times this command needs to be executed. Like what:
3J will move the cursor down three lines.
10DD will delete 10 rows.
Y3 "will copy the contents from the current cursor to the third occurrence of the quotation marks to the Clipboard.
Numbers are a very effective way to extend the scope of motion commands.
Record macros
Sometimes you will find yourself repeating the same series of actions in every paragraph or line of the article. Vim allows you to record a macro to complete your special needs.
Qregister: Record the macro to register register, where register is the name of any of your registers. such as QA, will be recorded and the macro exists in register a.
Q: End the record of the macro.
@register: Use a macro that has register registers. For example, @a will use a macro that exists in register a.
It's important to remember that macros only record your series of keystrokes and repeat them. They're not magic. Because there are many ways to accomplish a goal in vim, there are times when you should be careful to choose commands to record your macros. Because they will execute wherever you want to execute it.
Write code with VIM
Vim is an excellent editor to write code because it has some features that are specifically designed for programmers. Here are some of the commonly used:
]p: Similar to the function of P, but it automatically adjusts the indentation of the pasted text to fit the position of the current code. Try it!
%: Match curly braces, square brackets, brackets, and so on. At the top of a bracket, and then by%, the mouse appears in the other half of the matching brackets.
>>: Indent all the selected code
<<: Similar to above, but anti-indent
GD: At the definition of the function or variable where the cursor is located.
K: In man, look for the word where the cursor is currently located.
http://nodex.javaeye.com/blog/360709
Vim Find Replacement Summary
0,:g/null/d
Find the null line and delete it
1, simple substitution expression
The Replace command can replace another word with one word in the full text:
:%s/four/4/g
The "%" range prefix indicates that substitutions are performed on all rows. The last "G" tag represents all the matching points in the replacement row. If you are only working on the current line, just remove the%
If you have a word like "Thirtyfour", the above command will go wrong. In this case, the word will be replaced with "Thirty4″." To solve this problem, use "\<" to specify the beginning of the matching word:
:%s/\
Obviously, this will still make a mistake when dealing with "fourty". Use "\>" to solve this problem:
:%s/\/4/g
If you are coding, you may just want to replace "four" in the comment , while preserving the code. Since this is difficult to specify, you can add a "C" tag to the replacement commandso that Vim prompts you before each replacement:
:%S/\/4/GC
2. Remove extra spaces
To remove the extra space behind each line, you can execute the following command:
:%s/\s\+$//
The command indicates that the range is "%", so this works on the entire file. The match pattern for the "substitute" command is
"\s\+$". This represents one or more (\+) spaces (\s) before the end of the line ($). The "to" part of the Replace command is empty:"//". This will delete those matching whitespace characters.
3, matching repeatability mode
The asterisk item "*" specifies that items in front of it can be repeated any time. Therefore:
/a*
Match "A","AA","AAA", and so on. But also matches "" (empty string), because 0 times is also included. The asterisk "*" is applied only to the item that is immediately in front of it. So "ab*" matches "a","ab","ABB","abbb", and so on. To repeat the entire string more than once, the string must be made up of an item. The way to form an item is to precede it with "\ (", followed by "\"). So this command:
/\ (ab\) *
Matches: "ab","Abab","Ababab", and so on. and also match "".
To avoid matching empty strings, use "\+". This means that the preceding item can be matched one or more times.
/ab\+
Match "Ab","ABB","abbb", etc. It does not match "a" followed by "B" .
To match an optional option, use "\=". For example:
/folders\=
Match "folder" and "folders".
4, specify the number of repetitions
To match a specific number of times for an item, use the form "\{n,m}". where "n" and "M" are numbers. The item in front of it will be repeated "n" to "M" Times (|inclusive| Contains "n" and "M"). For example:
/ab\{3,5}
Match "abbb","abbbb" and "abbbbb".
When "N" is omitted, it is defaulted to zero. When "M" is omitted, the default is infinity. When ", M" is omitted, it means repeating exactly "n" times. For example:
Pattern Match times
\{,4} 0,1,2,3 or 4
\{3,} 3,4,5, etc.
\{0,1} 0 or 1, same as \=
\{0,} 0 or more, same as *
\{1,} 1 or more, with \+
\{3} 3
5, multiple Select a match
In a lookup mode, theor operator is "\|". For example:
/foo\|bar
This command matches "foo" or "bar". More choices can be attached to the back:
/one\|two\|three
Matches "One", "one",or "three".
To match its multiple repetitions, the entire decision structure must be placed between "\ (" and "\)":
/\ (foo\|bar\) \+
This command matches "foo","Foobar","Foofoo","Barfoobar", and so on.
Let me give you an example:
/end\ (if\|while\|for\)
This command matches "EndIf","Endwhile" and "ENDfor".
Viemu plug-in vim for Visual studio installation hack
Build _VIEMURC as Viemu profile under current user directory "C:\Users\Administrator"
Download Vimenu
2. Cracking
1. Delete directory C:\Documents and Settings\ user name \local Settings\Application Data\identities\{ 17582A9E-740A-47F2-8256-D09F1378E7FA}
2. Delete the registry key HKEY_CURRENT_USER\SOFTWARE\CLASSES\CLSID\{D31F31E1-B08F-46FF-92C5-CA111A2053DF}
After installing Viemu in Visual Studio, vim Vax shortcut keys Daquan