In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail about the vim editor search and replacement commands, the content of the article is of high quality, so the editor to share to you for reference, I hope you have a certain understanding of the relevant knowledge after reading this article.
The vim find and replace commands are:
1. (command mode) colon + instruction
To exit in the vim command mode interface, you need to enter a colon and instruction
: wq save and exit: Q dimension modify exit: Q! Forced exit is not saved
2. (command mode) move the cursor
Cursor movement method in command mode in vim interface
1, use the up and down key 2, command mode: h to the left j up k l to the right space bar to the right Backspace to the left Enter move to the first of the next line-move to the beginning of the previous line. : set nu / / display line number: set nonu / / cancel display line number n + / / jump down n line n-/ / jump up n line nG / / jump to the line G with line number n / / jump to the bottom g / / of the file and jump to the file header
3. (insert mode) Edit mode
The following keys enter edit insert mode a / / add text to the right of the current cursor position I / / add text A / to the left of the current cursor position / add text at the end of the current line / add text at the beginning of the current line (the beginning of a non-empty character) O / / create a new line above the current line Create a new line below the previous line R / / replace (override) the current cursor position and several subsequent text J / / merge the line of the cursor and the next behavior line (still in command mode) ESC can exit edit mode
4. (command mode) delete and copy
In vim, in addition to modifying files in edit mode, you can delete and copy them in command mode
X / / Delete the current character nx / / Delete n characters from the cursor dd / / Delete the current line ndd / / delete the current line down n lines u / / undo the previous operation U / / undo all operations on the current line yy / / copy the current line to the cache, or use "ayy copy," an as the buffer A can also be replaced with any letter from a to z to complete multiple replication tasks. Nyy / / copies the current line down n lines to the buffer, or you can use "anyy copy," an is the buffer, or a can be replaced with any letter from a to z to complete multiple copy tasks. Yw / / copies characters from the beginning of the cursor to the end of the word. Nyw / / copy the n words starting with the cursor. Y ^ / / copy the content from the cursor to the beginning of the line. VPS detective y$ / / copies the content from the cursor to the end of the line. P / / paste the contents of the clipboard behind the cursor, if you use the previous custom buffer, it is recommended to use "ap" to paste. P / paste the contents of the clipboard in front of the cursor, if you use the previous custom buffer, it is recommended to use "aP to paste."
5. (command mode) search and replace
In command mode (esc exits insert mode)
/ keyword / / search the keyword string under the cursor, keyword can be a regular expression? keyword / / search the cursor for the keyword string n / / search the previous search action N / / search up the previous search action * (#) / / when the cursor hovers over a word, enter this command to find the next (top) word that matches the word. Similarly, type n to find the next match, and type N in the opposite direction to find .g * (g #) / / this command is similar to the previous command, except that it does not exactly match the word where the cursor is located. Instead, it matches all strings that contain the word.: s/old/new/ / replace the first occurrence of old:s/old/new/g in the line with new / / replace all old:n in the line with new M s/old/new/g / / replace all old:%s/old/new/g / / replace all old in the current file with new from lines n to m with new. This is where the commands for finding and replacing vim editors are shared. I hope the above content can be of some help to you and learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.