Vim Operation Command

Source: Internet
Author: User

Edit the build file with the vi text editor****** most basic usageVI somefile.41, first will enter the "General mode", this mode only accept a variety of shortcut keys, can not edit the contents of the file2, press the I key, will be from the general mode into the editing mode, this mode, typed is the file content3, after editing, press ESC to exit the edit mode, return to the general mode;4, then press:, enter the "Bottom line command mode", enter the WQ command, carriage return can ****** Some common shortcut keyssome useful shortcut keys (used in general mode):A after the cursor one begins insertingA in the last insert of the lineI Insert at the front of the lineGG jumps directly to the first line of the fileG jump directly to the last line of the filedd Delete Row, if 5dd, then delete the cursor 5 lines at onceyy copies the current row, copies multiple rows, then 3yy copies the 3 rows near the current rowp Pastev Enter the character selection mode, select Done, press Y to copy, press p to pasteCtrl + V into block selection mode, select Done, press Y to copy, press p to pasteshift+v Enter row selection mode, select Done, press Y to copy, press p to paste  Find and replace (entered in command mode in the bottom line) %s/sad/88888888888888 effect: Find all sad in file, replace with 88888888888888 /you Effect: Find you in the file and navigate to the first found place, press N to navigate to the next matching position (press N to the previous one) 0: Beginning of the current line of the file$: The end of the current line of the fileG: Start of the last line of the file1 + G to first line9 + G to line Nineth =: 9 DD: Delete a row3DD: Delete 3 rowsyy: Copy one line3yy: Copy 3 Rowsp: PasteU:undoCtrl + R:redo "a shear plate a"B Shear Plate Bthe AP Pastes the contents of the Clipboard a every time you enter VI, there's a line number.VI ~/.VIMRCSet Nu : W a.txt Save As: w >> a.txt content append to A.txt : e! restored to its original state  : 1, $s/hadoop/root/g replace hadoop with Root on the first line to the Chase line : 1, $s/hadoop/root/c replace the first line of Hadoop with the following line with root (hint) * * Create a file touch somefile.1 create an empty file echo "I miss You,my Baby" > Somefile.2 uses the redirection ">" function to write the output of an instruction to a file, overwriting the original file content Echo "Huangxiaoming, gun Dan" >> somefile.2 appends the output of an instruction to a file without overwriting the contents of the original file

Vim Operation Command

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.