In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "what are the basic knowledge points of vim". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what are the basic knowledge points of vim".
Generally speaking, centos or other Linux operating systems we use already have vim installed by default. You can check directly to see if it is installed. [root@zmgaosh ~] # rpm-qf which vimvim-enhanced-7.4.629-6.el7.x86_64vim editor has three working modes: command mode, input mode, and last line mode
Remember a few points:
Enter the file for the first time in command mode "insert" is in edit mode input: (lower left corner) is command line mode
Let's first look at the input mode:
Input mode
Method to enter edit mode: an i o An I O (any letter can be switched to edit mode)
Here's an explanation: (see table)
1) insertion mode
Note: press these letters not to enter a character, but to switch to insert mode. Press ESC to return to command mode, and sometimes you need to press esc twice to ensure that you can do so
What command line mode can do in command line mode: 1. Cursor positioning class:
H: left
J: lower
K: above
L: right
The number 0 and the home key indicate switching to the beginning of the line
The $and end keys indicate switching to the end of the line
Gg means to quickly navigate to the first line of a document
G: navigate to the last line
3gg or 3G means to quickly navigate to line 3
two。 Regular matching class:
/ ^ d looks for content that starts with what, here is to find content that starts with d
/ t $find content that ends in t
Tip: if you want to open the file and the cursor directly to the last line of the file, you can use + such as we want to open / etc/passwd, open and let the cursor on the last line vim + / etc/passwd3. Text editing class: copy, paste, delete, undo
4. Visual class operation
V: enter visualization mode
R: erase, rewrite, enter replacement mode
For example:
Add # CTRL+V to multiple lines-select the line to add #-enter uppercase I-add # to the first line-double-click esc
Last line mode operation:
1. Save exit command
two。 Invoke external commands
:! + command
For example, to view the current ip
R read the file and append it to the document
3. Text replacement (difficulty is also key)
Format: range (% all content) s delimiters old content delimiters new content (delimiters can be customized)
For example:
1 s/bin/gaosh 3 replace the first bin that appears in lines 1 to 3 to replace with gaosh:1,3 s/bin/gaosh/g replace all the bin found in lines 1 to 3 and replace it with gaosh:3 s/bin/aaaaa # only replace the contents in line 3
:% s/do/gaosh/g replaces all do in the text with gaosh:% s/do/gaosh/gi replaces all do in the text with gaosh and ignores the case of do:% s@a@b@g replaces all an in the text with b4. Customize the vim usage environment
Thank you for your reading, the above is the content of "what are the basic knowledge points of vim". After the study of this article, I believe you have a deeper understanding of what the entry knowledge points of vim have, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.