Notes on using commands with the VIM editor

Source: Internet
Author: User

ViEnter VI without reading into any fileVI filename enters VI and reads the file with the specified name (both new and old files can) store and exit vi:w filename is stored in the specified file but does not exit VI (the current working file name if no file name is specified): Wq the file and exits Vi:qdo not make any changes and exit VI: q!Discard any changes and exit VI:!commandtemporarily exit VI and execute the shell command, and then return to VI after execution: SHtemporarily exit VI to the system, and at the end press Ctrl + D to return to VIPlus Data Command Iinserts a character at the close of the cursor and presses the ESC key at the endIbegin the caret at the top of the line where the cursor is located, and at the end press the ESC keyAstarts the caret after the cursor position and presses the ESC key at the endAstarts the caret at the end of the line on which the cursor is located, and then presses the ESC keyOadd a blank line under the cursor and start the caret, and at the end, press the ESC keyOadd a blank line to the cursor and start the caret, and at the end, press the ESC key!commandexecutes the shell instruction and loads the result on the next line of the cursorDelete instruction NXdeletes the n characters starting at the cursor position (with the cursor position, pressing an X to delete the character that the cursor is in)Nxdeletes the n characters starting at the cursor position (without the cursor position)NdwDelete N-character groups starting at the cursor position (word)D0Remove all characters from the beginning of the line to the cursor positiond$ or DRemove all characters from the beginning of the cursor position to the end of the lineNdd : START,ENDD Delete The first start to end line of the file.      0 move to the beginning of a line  $ move to the end of a line  [move to the beginning of the file  ] Move to a file node           Beam position  nh to the left N-bit &NBSP;NL or spacebar to the right to shift N-bit  nk up n-line  n+ up n rows, cursor at the beginning of the line  ni Move n row  n-down n rows, the cursor moves from the beginning of the line to the upper-left corner of the screen  m move to the middle row of the screen  l move to the end of the screen A row of  g moves to the last line of the file  ng or: N moves to the nth row of the file  nw to the right of the N-word group, the punctuation character belongs to the group &NBSP;NW to the right N-word group, the punctuation is not a word        Group &NBSP;NB left N-word group, punctuation marks belong to the word group &NBSP;NB left n Group, punctuation is not a word group   ctrl + u screen up half a menu  ctrl + D            Screen volume Half menu  ctrl + b screen roll up a menu  ctrl + F screen down a menu    modify instruction  r Modify the character of the cursor file  r Start at the cursor position, press ESC at the end  new change the n set of characters, press ESC at the end &NBSP;NCC change n lines from the cursor position, press ESC at the end     Rearrange the line lengths  i and press ENTER to disconnect the line from the cursor and into insert mode  j connect the next row of data to the bank     look for instructions &NBsp;/text from the cursor position to find a string text ?text from the cursor position to find the string text n continue to find the next string (after entering the above search command)    search and replace the instruction  :getxt1/s//text2/options to replace the Text1 of each line with text2 option=g to indicate that all Text1 in the file are superseded, and if no option is entered, Then only the first occurrence of the Text1 in each row is substituted  option=go on the screen display each substituted line &NBSP;OPTION=GC ask for confirmation before each string supersedes   start,endgtext1/s//Text2 /options, only to find and replace line start~end.   or:start,ends/text1/text2/options    copy and move files  :first,last Co dest copies data from first to last row to the target row (   dest) below  :start,end m dest moves the data from Start to end rows to the target row (dest).  :r filename reads the contents of the specified file into the line where the cursor is located.  ny The N-row data that starts at the cursor position  p copy the staging data on the next line of the cursor  p copy the staging data on the previous line of the cursor   &               nbsp; other commands  . Repeat the previous instruction  u cancel the previous instruction  ctrl + L Refresh screen display  :set number displays the line numbers of the file, but does not save the file  :set Nonum BER Release line number display  :set AI sets the starting position of each line (starting with the current position of the cursor)  :set noai The start position of the row is set  :f or <Ctrl> + G Tell the user about the current editing file data.

Notes about using commands with the VIM editor

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.