1. Install VimYum Install-y vim-enhanced2. Common commandsDisplay to the first few lines of the fileVim +10/etc/init.d/iptables (shown to line tenth of the file)Show the number of file lines: Set NuVIM Tri-Medium modeGeneral modeThe movement of the
The Vim tool on the Linux platform can be said to be very well known and powerful, so this tool has to be said!Use the command vi file name directly to create and edit the file.Three modes of VIM:Command mode;Insert mode:Bottom line mode;The default
Verb
The verb represents what we intend to do with the text. For example:D means delete deletesR indicates replacement replaceC means modify changeY means copy YankV indicates that the visual select is selected
Noun
Nouns
VimX: Delete the character of the cursor (same as delete)De: Delete the ending of the word from the position of the cursorDW: Delete the first word from the cursor position until the next wordDB: Delete the contents of the word before the cursorDG:
.: The point command is the most important command, the function is to repeat the previous command
Numbers: Adding numbers to a command can improve efficiency, such as 100j moving down 100 rows, 100dd deleting 100 rows
Cursor Movement:
Note: These commands have a colon before them:When you are finished editing the document, you are ready to exit VI when you return to the shell, you can use one of the following methods.In command mode, double-press two capital Letter Z, if the
I. Three modes of VIMThere are three modes in vim: edit mode, input mode, last line modeWhen you open a file by using the VIM command, it is in edit mode by default.1. Edit mode--Input modeI: Convert to input mode before the current cursor
Character test:= = Test whether equal, want to wait for true, not equal to False! =: Test whether unequal, not equal to true, and so falseLoop: Enter condition, exit conditionForWhileUntilfor variable in list;Loop bodyDoneFor I in 1 2 3 4
(1) Address delimitation: Start_pos[,end_pos]#: A specific line of #, for example, 5 is the 5th line;.: Current line;$: last line;#,#: Specifies the row range, the left is the starting line, the right side is the end line;#,+#: Specifies the line
At the command line, enter switch to open vim, press I to enter edit mode, start editing text, press ESC to enter command mode. Initial use : Open in the graphical interface open vim, press I built, enter the editing mode, edit the text, press ESC
With vim for almost two years to see the tutorial also a lot, in general, you have to practice more, when you feel the need, and then add features. Here to share a view of the best tutorial, from the bar of a friend, write very wellZeroLearn to play
Vim Common Commands Summary.-You can let us repeat the last Operation command y-Copy the command. It can be followed by a displacement, or an object selection. For example it's actually with C-The Cut command is very similar yaw-copy a word,
Vim is known as the ancient artifact. A small editor, the appearance is not very humble, the name of the artifact from? This is what attracts me. --In this memo.Vim is a free software that also admires the author's philanthropic behavior and helps
Several modes of VIM switchingInsert command
Command
Role
A
Insert in the word specifier the cursor
A
Insert at the end of the line where the cursor is
I
Insert in the word
Command HistoryCommands with: and/begin with a history, you can first type: or/Then press the up and down arrows to select a history command.Start vimEnter the following command in the Command line windowVim starts vim directlyVim filename opens vim
#显示行号Set Nu#取消行号Set Nonu#查找Vi/etc/init.d/iptables/iptables#查找并替换1,20s/iptables/iptables/g G is a global substitution and cannot be replaced globally without g1, $s/iptables/iptables/g $ is a full file%s/iptables/iptables/g% is a full file, replacing
First enter the following directoryCd/usr/share/vimThen open VIMRC.sudo vim VIMRCInsert the following code in the "Set backspace=2" line in VIMRC:Set AI "Auto indentingset history=100 " keep lines of Historyset ruler
We all find that when writing code, sometimes it is possible to have more information for the variable name, and the name may be longer,To use the variable name again, I find it seems to be unable to remember the previous VC 6.0, you can use aTool,
Windows Vim uses Vundle, reported "E303, cannot open * * Exchange file, recovery will not be possible" solution.Under Windows vim using Vundle, the "E303, cannot open * * Exchange file, recovery will not be possible", such as:650) this.width=650;
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