Lecture 1: 1. move the cursor in the screen text. You can use the arrow keys or the hjkl keys.
H (left shift) J (downstream) K (upstream) L (right shift) 2. to enter the vim Editor (from the command line prompt), enter the: Vim file name <press enter> 3. to exit the vim Editor, run the following command to discard all modifications: <ESC>: Q! <Press enter> or enter the following command to save all the changes: <ESC>: WQ <press enter> 4. delete the character at the cursor position in normal mode. Press: x 5. in normal mode, you must insert text at the cursor position, press: I to enter necessary text <ESC> Note: pressing the <ESC> key will bring you back to normal mode or cancel an unexpected or partially completed
. Summary: 1. to delete a word from the current cursor to the end of a word/word, enter: DW 2. to delete from the current cursor to the end of the current row, enter: d $3. to delete the entire row, enter: dd 4. in normal mode, the format of the next command is [number] command object or command [number] object.
It means:
Number-indicates the number of command executions
Command-indicates what to do. For example, d Indicates deletion.
Object-indicates the object to be operated. For example, W represents a single word/Word, and $ represents the end of a row.
$ (To the end of line), etc. 5. to cancel the previous operation, enter U (lower case U)
To cancel the changes made in one row, enter U (uppercase U)
To undo the previous undo command, restore the results of the previous operation, enter: CTRL-R third lecture Summary: 1. To re-place the deleted text content, enter the lowercase letter P. This operation can delete
After the cursor. If the last row is deleted
In the row where the current cursor is located. 2. To replace the character at the position of the cursor, enter the lower-case character R and the new character to replace the original position.
. 3. The change class command allows you to change the specified object from the current cursor position to the end of the object.
For example, input CW can replace the content from the current cursor to the end of the word; input C $ can replace
Front cursor to the end of the line. 4. Change the class Command Format: [number] C object or C [number] object Lecture 4: 1. CTRL-G is used to display the current cursor position and file status information. Shift-G is used to jump the cursor
Go to the last line of the file. First, press shift-g to move the cursor to the row.
Number indicates the row. 2. Input/followed by a string, which is to be searched backward in the document currently edited.
Enter question mark? Followed by a string, the word is searched forward in the document being edited.
String. After a search is completed, press the n key to repeat the previous command.
Locate the Next string, or find the string in the opposite direction by shift-n. 3. If the current position of the cursor is parentheses (,), [,], {,}, you can press % to move the cursor to the paired
Brackets. 4. Replace the header string old with the new string new in a row. Enter "s/old/new ".
Replace all the strings old with the new string new in one line. Enter: S/old/new/g.
Replace all the strings old with the new string new in the two rows. Enter: #, # S/old/new/g.
Replace all the strings old with the new string new in the file. Enter % S/old/new/g.
During full-text replacement, ask the user to confirm that C option is required for each replacement. Enter % S/old/new/GC in lecture 5: 1 .:! Command is used to execute an external command. See some examples:
:! Dir-displays the content of the current directory.
:! Rm filename-used to delete a file named filename. 2.: W filename can save the file being edited in VIM to the file named filename.
. 3.: #, # W filename can save the content of row # To row # Of the current edited file to the file
In filename. 4.: R filename can extract the disk file filename and insert it to the cursor position of the current file.
. Conclusion 6: 1. Input a lower-case o to open a new line under the cursor and place the cursor at the beginning of the new line to enter
Insert mode.
Enter an uppercase o to open a new line above the cursor and place the cursor at the beginning of the new line to enter
Insert mode. 2. Input lowercase A to insert text after the cursor position.
Input uppercase A can insert text after the end of the row where the cursor is located. 3. If you enter an uppercase value, r enters the replacement mode until you press <ESC> to exit the replacement mode.
Mode. 4. Input: Set XXX to set the xxx option. For example: Set IC (IC is the abbreviation of the first letter of ignore case in English). Lecture 7: ** use online help system ** Vim has a comprehensive online help system. To start the help system, select the following three
Method:
-Press the -Press the <F1> key (if any on the keyboard)
-Input: Help <press enter> input: q <press enter> to close the Help window. Provide a correct parameter to the ": Help" command. You can find help on this topic. Please test
Parameters (do not forget to press Enter. :): Help W <press enter>
: Help C _ <t <press enter>
: Help insert-index <press enter>
: Help user-manual <press enter> lecture 8: ** create a STARTUP script to enable the vim function ** Vim has more features than vi, however, most functions are not activated by default. To start more
Function. You must create a vimrc file. 1. Start editing the vimrc file, depending on the operating system you are using: Edit ~ /. Vimrc this is the command used by the UNIX System
: Edit $ Vim/_ vimrc this is the command used by Windows system 2. Import the vimrc sample file: read $ vimruntime/vimrc_example.vim 3. Save the file with the command: Write
When you start Vim next time, the editor will have the syntax highlighting function. You can continue
Other feature settings of Huan are added to the vimrc file.