当前位置:网站首页>Editor use of VI and VIM
Editor use of VI and VIM
2022-07-05 08:58:00 【Wanderer001】
Reference resources Editor -vi、vim Use - cloud + Community - Tencent cloud
Catalog
1、vi brief introduction
vi Editor yes Linux and Unix The most basic Text editor , Working in character In mode . Because you don't need a graphical interface ,vi It's a very efficient text editor . Although in Linux There are also many graphical interface editors available on , but vi In the system and Server management The functions in are those Graphic editor Incomparable .
vi Editor It is often referred to as vi, and vi again “Visual interface” For short . It's in Linux Status in the world is like Edit The program is in DOS It's the same . It can perform output 、 Delete 、 lookup 、 Replace 、 Block operations and many other text operations , And users can customize it according to their own needs , This is the other Edit the program Not available .
vi The editor is not a typesetting Program , It is not like Word or WPS That way, it's possible to 、 Format 、 Arrange paragraphs and other attributes , It's just a text editor . No menu , Only the command , And there are many orders .vi Yes 3 Basic working mode : Command line mode 、 Text input mode and last line mode .
Vim yes vi The enhanced , Than vi Easier to use .vi Almost all of your commands can be found in vim Upper use .
2、vi Working mode
vi There are three basic modes of work : Command mode 、 Text input mode 、 Last row mode .

vi Working mode
2.1、 Command mode
anytime , No matter what mode the user is in , Just press ESC key , Can make Vi Enter command mode ; We are shell Environmental Science ( The prompt is $) Lower input start Vi command , When you enter the editor , Also in this mode . In this mode , Users can enter all kinds of legal Vi command , For managing your own documents . Any character entered from the keyboard is interpreted as an edit command , If the input character is legal Vi command , be Vi After receiving the user's command, complete the corresponding action . But it should be noted that , The command entered is not displayed on the screen . If the input character is not Vi The legal order of ,Vi Will ring the alarm .
2.2、 Edit mode
Enter the insert command in command mode i( Insert current position )、a( Insert at the next position after the current position ) 、o( Insert... In the next line ) You can enter text input mode . In this mode , Any character entered by the user is vi Save it as file content , And show it on the screen . In the process of text input , If you want to go back to command mode , Key ESC that will do .
2.3、 Last row mode
In command mode , User presses “:” Key to enter the last line mode , here Vi In the last line of the display window ( It's usually the last line of the screen ) Display a “:” As a prompt for the last line mode , Wait for the user to enter the command . Most file management commands are executed in this mode ( Write the contents of the edit buffer to a file ). After the last command is executed ,Vi Automatically return to command mode .
If you want to change from command mode to edit mode , You can type commands a perhaps i; If you need to return from text mode , Then press Esc Press the key . Enter... In command mode “:” You can switch to the last line mode , Then type the command .
3、vi Basic manipulation
3.1、 Enter edit mode
| command | meaning |
|---|---|
| i and I | i Insert... In front of the cursor ,I Insert at the beginning of line |
| a and A | a Insert... After the cursor ,A Insert at end of line |
| o and O | o Insert... On the next line below the line where the cursor is located ,O Insert... On the line where the cursor is located |
3.2、 Move the cursor
| command | meaning |
|---|---|
| h | Move the cursor to the left |
| j | Cursor down |
| k | Move the cursor up |
| l | Move the cursor to the right |
| H、M、L | The cursor moves to the first line of the visible screen (H)、 Middle row (M)、 The last line (L) |
| ^ and $ | ^ Move to beginning of line ,$ Move to the end of the line |
| G and gg | G The last line of the document ,gg The first line of the document |
| ctrl+f、ctrl+b | Flip the screen forward 、 Flip the screen back |
| ctrl+d、ctrl+u | Forward half 、 Half back |
| { and } | { Move up a section ,} Move back a bit |
| w and b | Move a word forward , Move a word back |
3.3、 The delete command
| command | meaning |
|---|---|
| X and x | x Delete the character after the cursor ,X Delete the character before the cursor , Contains cursor position characters |
| dd and n dd | dd Delete the line ,5 dd Delete the specified number of rows |
| d0 and D | d0 Delete all the contents of the line before the cursor ,D Delete all the contents of the line after the cursor is deleted , Contains cursor position characters |
| dw | Delete the word where the cursor is located , Contains the characters of the position of the light table |
3.4、 Revocation order
| command | meaning |
|---|---|
| u | Undo step by step |
| ctrl + r | Counter cancellation |
3.5、 Repeat the order
| command | meaning |
|---|---|
| . | Repeat the command of the last operation |
3.6、 Copy and paste
| command | meaning |
|---|---|
| yy | and n yy and y$ y^ yy Copy the current row ,5 yy Copy 5 That's ok |
| p | Paste a new line down at the cursor |
3.7、 Select text
| command | meaning |
|---|---|
| v and V | v Select a single character ,V Select entire line |
| << and >> | After selecting the text , Indent left , Indent right |
3.8、 Search and replace
| command | meaning |
|---|---|
| In command mode ,r and R | r Replace the current character ,R Replace the character after the cursor |
| In last line mode ,/ + str | n Find the next one ,N Find the previous |
| In last line mode ,%s/abc/123/g | Put all the abc Replace with 123 |
| In last line mode ,1, 10s/abc/123/g | Put the first line to 10 Between lines abc Replace with 123 |
边栏推荐
- Mengxin summary of LIS (longest ascending subsequence) topics
- uni-app 实现全局变量
- nodejs_ 01_ fs. readFile
- 某公司文件服务器迁移方案
- Yolov4 target detection backbone
- 使用arm Neon操作,提高内存拷贝速度
- Jenkins Pipeline 方法(函数)定义及调用
- Introduction Guide to stereo vision (2): key matrix (essential matrix, basic matrix, homography matrix)
- Golang foundation -- map, array and slice store different types of data
- [牛客网刷题 Day4] JZ55 二叉树的深度
猜你喜欢
![Introduction Guide to stereo vision (5): dual camera calibration [no more collection, I charge ~]](/img/68/6bfa390b0bedcdbc4afba2f9bd9c0f.jpg)
Introduction Guide to stereo vision (5): dual camera calibration [no more collection, I charge ~]

Halcon color recognition_ fuses. hdev:classify fuses by color

My university

nodejs_ fs. writeFile

Halcon shape_ trans
![[beauty of algebra] singular value decomposition (SVD) and its application to linear least squares solution ax=b](/img/ee/8e07e2dd89bed63ff44400fe1864a9.jpg)
[beauty of algebra] singular value decomposition (SVD) and its application to linear least squares solution ax=b

我从技术到产品经理的几点体会
![[matlab] matlab reads and writes Excel](/img/80/78e4c7fcd27473526e480d4b930e2c.jpg)
[matlab] matlab reads and writes Excel
![[code practice] [stereo matching series] Classic ad census: (5) scan line optimization](/img/54/cb1373fbe7b21c5383580e8b638a2c.jpg)
[code practice] [stereo matching series] Classic ad census: (5) scan line optimization

Programming implementation of subscriber node of ROS learning 3 subscriber
随机推荐
IT冷知识(更新ing~)
Meta标签详解
How many checks does kubedm series-01-preflight have
Adaboost使用
Attention is all you need
np.allclose
生成对抗网络
Pearson correlation coefficient
Configuration and startup of kubedm series-02-kubelet
Typescript hands-on tutorial, easy to understand
Halcon wood texture recognition
使用arm Neon操作,提高内存拷贝速度
皮尔森相关系数
Rebuild my 3D world [open source] [serialization-3] [comparison between colmap and openmvg]
C [essential skills] use of configurationmanager class (use of file app.config)
Redis implements a high-performance full-text search engine -- redisearch
Dynamic dimensions required for input: input, but no shapes were provided. Automatically overriding
location search 属性获取登录用户名
[technical school] spatial accuracy of binocular stereo vision system: accurate quantitative analysis
资源变现小程序添加折扣充值和折扣影票插件