Detailed instructions for linuxvi common commands

  
First, the cursor moves j to move down one line; k moves up one line; h moves one character to the left; l moves one character to the right; ctrl+b moves up one screen; ctrl+f moves down one screen ;$ moves to the end of the line; gg moves to the beginning of the document; GG moves to the end of the document; 0 moves to the beginning of the line; #G, for example, 5G, means move the cursor to the first line of the fifth line of the article, insert mode I Insert at the beginning of the line where the cursor is located; A at the end of the line where the cursor is located; O Insert a line above the line where the cursor is located; o Insert a line below the line where the cursor is located; S Delete the line where the cursor is located, then enter the insertion Mode; Third, the deletion of text content x delete a character; #x delete a few characters, # represents a number, such as 3x; dw delete a word; #dw delete a few words, # by number, such as 3dw means delete three Word; dd ​​delete a line; #dd delete multiple lines, # represents a number, such as 3dd means delete the cursor line and the next two lines of the cursor; d$ delete the cursor to the end of the line; J clear the cursor is located The space between the line and the next line, the cursor line and the previous line are connected together; Fourth, find and replace the string /keyword to find the string, press Enter to highlight all the keywords found; :s /SEARCH/REPLACE/g Note: Replace the SEARCH word in the line where the cursor is currently on with REPLACE and highlight all SEARCH;:%s /SEARCH/REPLACE Note: Replace all SEARCH in the document with REPLACE;:#, # s /SEARCH/REPLACE/g Note: The ## indicates a number indicating how many lines from how many lines, replacing SEARCH with REPLACE;
Copyright © Windows knowledge All Rights Reserved