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 > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces what the vim command refers to, which has certain reference value and can be used for reference by friends who need it. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.
Vim command is a rich text editor, is an extended version of the vi editor, it can be used to edit a variety of text, especially the ability to edit procedures, compared with vi has many advantages, can be undone many times, you can open multiple windows for editing, syntax highlighting, command line editing, online help, visual selection, and so on.
Vim introduction
Vim is a rich text editor and an extended version of the vi editor. It can be used to edit all kinds of text, especially programs.
Compared with vi, it has many advantages, such as undoing multiple times, opening multiple windows at the same time, syntax highlighting, command line editing, online help, visual selection, etc.
Basic operation of vim
Open a file
Vim filename#example: open the a.txt file vim a.txt using the vim editor
If filename is empty, an empty file will be opened
Vim [options] [filelist] left and right square brackets represent a collection, that is, there can be multiple option and multiple list
Five modes of vim
Normal mode: this is the most basic mode, and you can return to normal mode by clicking Esc in any of the following modes
Insert mode: in this mode, you can enter a string through the keyboard. In normal mode, you can enter the insert mode by pressing iGraine a. I is inserted from the previous character of the current cursor, an is inserted from the next character of the current cursor, and o is inserted from the next line of the current cursor.
Visual mode: visual mode can select text, and then it is convenient to copy, paste and other operations. In normal mode, only one character can be selected at the same time. So if you want to delete multiple characters or multiple lines of characters, it is relatively inconvenient-of course, there are commands that can solve this problem in normal mode, but it is a bit more complicated than visual mode. Press v in normal mode to enter visual mode. Press V to enter the visual line mode, Ann Crtl+v can enter the visual block mode, you can practice the following, it is easy to find the difference between the three visual modes. In addition, in the visual mode, you can also switch between the three visual modes using vMagneVPhoneCrtltransiv.
Replacement mode: press R in normal mode to enter the replacement mode. Starting from the current cursor, the characters entered by the keyboard will replace the characters already in the text.
Last line mode: press: and / to enter the last line mode. The last line mode used / entered is mainly used to find the string, which is explained in detail below.
Detailed explanation of necessary commands in normal mode
H # move one character to the left l # move one character to the right j # move one line down k # move one line up dd # delete an entire line x # delete the character where the cursor is located u # delete the character u # delete the character yy # copy all characters above the current line # can be preceded by a number, representing the character that moves n characters to the left and then n Copy n lines, etc. 0 # move to the beginning of the line G0 # move to the beginning of the current screen H # move the cursor to the top line of the screen M # move the cursor to the middle line L # move the cursor to the bottom line of the screen gg # move to the head of the file G # move to the end of the file crtl + F # flip down one screen crtl + b # flip up one screen crtl + d # flip half screen crtl + u # flip n% # to file n% zz # move the current line to the center of the screen zt # move the current line to the top of the screen zb # move the current line to the bottom of the screen
Detailed explanation of common commands in last-line mode
Q # exits the current file and does not save it. Q is the abbreviation of quit: Q! # forcefully exits the current file: W # saves the current file, w is the abbreviation of write: W! # forcibly save changes for read-only files: wq # Save and exit: r filename # insert a file at the current location: r! date # insert the current date at the current location: r! command # insert the output of other shell commands at the current location:% s / target character / replacement character / g # replace the target character with the g at the end of the replacement character for global replacement % on behalf of all lines% s / target characters / replacement characters / gic # replace target characters with replacement characters % stands for all lines, the last g for global substitution, I for case ignorance, c for each substitution requires user confirmation: 1Magazine 4s / target character / replacement character / g # replace the target character from the first to the fourth line with the replacement character / string: look for the string in the following text
Detailed explanation of common commands in visual mode
D # delete selected character y # copy selected character p # paste selected character thank you for reading this article carefully, hope the editor to share vim command refers to what content is helpful to everyone, at the same time, I also hope you support a lot, pay attention to the industry information channel, find problems, detailed solutions are waiting for you to learn!
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.