I have used the vi editor for several years, but I have never used some practical uses. After listening to the introduction of Linux in the python video today, I still learned a few new tricks. 1. :set nu displays line numbers 2. gg--------to the beginning of the file 3.G--------To the end of the file 4.u---------Undo operation 5.Ctrl+r-----Redo 6.:/better, press Enter to search for words matching better, press n to search for the next one 7.:s/better/dog, press Enter to replace the first "better" in this line with "dog" :s/better/dog, press Enter to replace all better in this line with dog :%s/better/dog Enter, replace all better in this file with dog 8. vi -O2 file1 file2 Use one screen to display both file1 and file2 for easy editing. Press ctrl+w to switch from one file window to another. Expanded content Common Linux commands - Learned cd (change the path) rm (followed by -rf to delete a file or folder) ls (view the files and folders in the current path) mkdir (create a folder) touch (create a file) Vim commonly used commands Cursor positioning; hjkl move up, down, left, and right 0 $ Jump to the beginning or end of the line gg shift+G jumps to the beginning or end of the entire file 1G, 2G, 3G........NG, jump to the beginning of line 1.2.3 N /String(n N can be looped) quickly locate a certain line, /^d quickly locates the line starting with d, /txt$ quickly locates the line ending with txt. Text editing (small amount) y copy. yy 3yy ygg yG (in lines) d delete dd 3dd dgg dG (in lines) p Paste x Delete the character where the cursor is D Delete from cursor to end of line u undo ^r redo Undo, redoCtrl + r r Modify a character Enter other modes a Enter insert mode, insert after the cursor i Enter insert mode, insert before the cursor o Insert into a new line A shift + A insert at the end of the current line : Enter last line mode (extended command mode) v Enter visual mode ^v Enter visual block mode Ctrl + v V Enter Visual Line Mode R Enter replace mode and perform batch replacement after the cursor, similar to Insert for text on Windows VIm keyword autocompletion in insert mode Ctrl + p / n The above are all the knowledge points and extended content introduced this time. Thank you for your learning and support for 123WORDPRESS.COM. You may also be interested in:
|
<<: A brief talk about Mysql index and redis jump table
The first one: Using the CSS position property &l...
Table of contents Standards for smooth animation ...
A simple calculator written in WeChat applet for ...
The async_hooks module is an experimental API off...
Promise is a new solution for asynchronous progra...
Today, when verifying the concurrency problem of ...
By default, Docker runs over a non-networked UNIX...
The Flexbox layout module aims to provide a more ...
Preface In Windows, you can start multiple MySQL ...
Copy code The code is as follows: <!DOCTYPE ht...
Often, we may need to export local database data ...
1. Count the number of users whose default shell ...
In MySQL, most indexes (such as PRIMARY KEY, UNIQ...
Table of contents Scene Setting Game Resources Tu...
This article introduces and shares the responsive...