Vim command plot

Source: Internet
Author: User
Tags save file






Vim command, Vim is a good editing tool, below for you to introduce the basic command of VIM.




Method/Step

1

"Vim command-Start vimtutor": Execute command: Vimtutor. Vimtutor is an introductory tutorial on VIM usage. You can get started in 25-30 minutes.


2

"VIM command-Move cursor":


The key of H is on the left side and moves to the left each time it is pressed.


The keys on the L are on the right, and each time you press it, you move to the right.


The J key looks like an arrow pointing down in the tip direction.


K move upwards.


3

"Vim command-Start and exit":


1. Press <ESC> (this is to ensure you are in normal mode).


2.:q! < return car > do not save exit.


3.:wq < return car > Save and exit.


4

"Vim Command-edit delete":


1. Press X to remove the character at the location of the light target.


5

"Vim command-Edit Insert":


1. Press I to insert the text.


6

"Vim Command-Summary 1":


1. The cursor movement in the screen text can be either arrow-key or HJKL-letter-Keys.


H (Shift left) J (downlink) K (upstream) L (shift right)


2. To enter the Vim editor (from the command line prompt), enter the:vim file name < return car >


3. To exit the VIM editor, please enter the following command to discard all changes:


<ESC>: q! < return car >


or enter the following command to save all changes:


<ESC>: Wq < return car >


4. In normal mode, delete the character of the light target, press:x


5. In normal mode, to start inserting text at the location where the light is located, press:


I input necessary text <ESC>


7

"Vim command-delete class command":


1. The input DW can be deleted from the light to the end of a single word/phrase.


8

"Vim command-Other delete command":


1. Enter the d$ from the previous light to delete to the end of the line.


9

"Vim command-about commands and objects":


The format of the delete command D is as follows:


[NUMBER] D object or D [number] Object


The meaning is as follows:


Number-Represents the number of times the command was executed (optional, default setting is 1).


D-Represents the delete.


Object-Represents the image to be manipulated by the command (the following is an introduction).


A short list of icons:


W-from the former position of the previous light until the end of the word/phrase, including spaces.


E-from the former position of the previous light until the end of the word/phrase, but * does not include spaces.


$-from the former position of the previous light until the end of the line.


10

"Vim command-Special object for Object command":


1. Enter DD to remove the entire current.


11

"Vim command-undo command":


1. Enter u to undo the last command and enter U to fix the entire line.


12

"Vim Command-Summary 2":


1. To delete to the end of the word/phrase from the previous light, enter:DW


2. To delete from the current light to the end of the current line, please enter:d$


3. To delete the entire line, please enter:DD


4. The format of a command in normal mode is:


[NUMBER] Command object or command [number] Object


The meaning is:


Number-Represents the number of times the command is executed


Command-represents what to do, such as D for delete


Object-Represents the image to be manipulated, such as W for a single word/phrase, $ for the end of the line, and so on.


$ (to the end of line), etc.


5. To undo the previous operation, please enter the:u (small write u)


To undo the changes made in a row, enter:u (Big U)


To undo the previous Undo command, restore the previous operation results, please enter:CTRL-R


13

"Vim command-place Class meter command":


1. Enter p after the last erased content is placed in the light target.


14

"Vim command-replace Class command":


1. Enter the characters of R and the position of a character to replace the light target.


15

"Vim command-Change Class command":


1. To change the part or all of a single word/phrase, enter the CW.


16

"VIM command-C directive":


1. Changing the type of instruction works in the same way as removing the command. The Operation format is:


[number] C object or C [number] Object


2. The same as the parameters, such as W for the single word/phrase, $ for the end of the line and so on.


3. Please move the light to the first line in this section labeled--->.


4. Then move the light target to the first bug.


5. Then input C $ causes the remainder of the line to be corrected as in the second line. At the end, press <ESC>.


17

"Vim Command-Summary 3":


1. To reset the contents of the text that has been deleted, enter the small write letter p. This action can remove the


Text content is placed after the light target. If the last delete is an entire line, then the row will be


The next line in the row where the previous light is located.


2. To replace the characters in the location of the light, enter the small write r and the new word to replace the original position character.


Characters.


3. Changing the command allows you to change the specified image from the position of the previous light target to the end of the image.


For example, the input CW can be used to replace the previous light to the end of the word content, input C $ can be replaced


The front light targets the content at the end of the line.


4. The format of the Change Type command is:


[number] C object or C [number] Object


18

"Vim command-positioning":


1.


The input ctrl-g shows the line position of the previous light and the file status information in the previous edit file.


The input shift-g jumps directly to a specified line in the file.


19

"Vim command-search":


1. The input/and trailing strings can be used to find the string in the current file.


20

"Vim command-match parentheses":


1. Press% to find the matching parentheses),],}.


21

"vim command-fix error":


1. Input: s/old/new/g can replace old as new.


22

"vim Command-Summary 4":


 1. The ctrl-g is used to display the location and file status information of the previous light target. Shift-g is used to jump the light target


     to the last line of the file. First, hit a line and then press SHIFT-G to move the light to the line


    .


 2. Enter/Then tighten a string to find the string in the file you were editing.


     Enter a question? Then the string is followed by the search for the word "


    " in the file you were editing. After completing a search, press N to redo the last command, and you can look in the same direction


     Find the next string, or press Shift-n to look in the opposite direction for the string where it is located.


 3. If the previous position of the light is the parentheses (,), [,], {,}, press% to move the light to the matching


     parentheses.


 4. In one line, replace the string old with the new string, enter  :s/old/new


     Replace all the strings in a line with the old as new string, please Enter  :s/old/new/g


     Replace all strings in two lines with old as new string, enter  :#, #s/old/new/g


     Replace all the strings in the file with old as new string, and enter  :%s/old/new/g


     to make a full-text replacement to make sure that you have added a C option to each replacement. Please enter:%S/OLD/NEW/GC


23

"Vim command-Execute external command":


1. Enter:! And then you enter an external command to execute the external command.


24

"Vim command-Save file":


1. To save the file to a file, please enter: w FILENAME


"Vim command-selective save":


1. To save part of the file, please enter: #,# w FILENAME


"Vim command-Extract merged files":


1. To insert additional file contents into the current file, enter: R FILENAME.


"Vim Command-Summary 5":


1.:!command is used to perform an external command.


Please see some examples:


:!dir-Used to display the contents of the previous catalogue.


:!RM filename-the file used to delete the filename.


2.: w FILENAME saves the files being editable in the previous VIM to the filename


In the file.


3.: #, #w FILENAME to save the contents of the previous edit file # line to # line to a file


In FILENAME.


4.: r filename Extracts the magnetic disc file filename and inserts it into the light target position of the current file


Back side


"Vim command-Open Class command":


1. Enter o to open a new line below the light target and enter into insert mode.


"VIM command-cursor insertion":


1. Enter a will be able to insert text after the light target.


"Vim command-permutation":


1. Enter the big write R to replace multiple characters.


"Vim Command-Options":


1. To find the word ignore you can enter/ignore in normal mode. To re-find the word, you can


Redo Press N.


2. Then set the IC option (IC is English ignoring the first letter of the Ignore case), i.e.


Input:


: Set IC


3. Now you can find the word ignore again by entering the N key. The redo lookup can be re-key into the N keys.


4. Then set the Hlsearch and Incsearch options to enter the following contents:


: Set HLS is


5. Now you can enter the find command again to see what the effect is:


/ignore


"Vim Command-Summary 6":


1. Enter the small write o can open a new line under the light target and place the light in the beginning of the new


Insert mode.


Enter the big write O to open a new line above the light target and place the light at the beginning of the new start, enter


Insert mode.


2. Enter a small version of a can insert text after the light target position.


A large write can insert text after the end of the line in which the light is placed.


3. Enter the big write R to enter the swap mode until you press <ESC> to exit the swap mode and enter the normal


Mode.


4. Input: Set XXX can setup xxx option.


"Vim command-online Help":


Vim has a comprehensive in-line help system. To activate the Help system, please select the following three kinds of


One of the methods:


-Press <HELP> key (if any on the keyboard)


-Press <F1> key (if any on the keyboard)


-Input: Help < return car >


Input: Q < return > can close the Help window.


"Vim command-Create startup script":


Vim has much more functional features than VI, but most features do not have a default activation. To activate more


function, you have to create a VIMRC file.


1. Start editing the VIMRC file, which depends 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 the Windows system


2. Then import the VIMRC sample file:


: Read $VIMRUNTIME/vimrc_example.vim


3. Save the file with the command:


: Write


35



Vim command plot




Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.