当前位置:网站首页>VIM common commands and shortcut keys

VIM common commands and shortcut keys

2022-06-25 12:21:00 lihongbao80

One 、vim

1、Vim insert text

From command mode to input mode to edit , Can be pressed I、i、O、o、A、a Wait for the key to complete , Using different keys , The position of the cursor is different

Shortcut key Function description
i Insert the text you entered later at the current cursor position , The text behind the cursor moves to the right
I Insert the following text at the beginning of the line where the cursor is located , The beginning of a line is the first non white space character of the line , It is equivalent to moving the cursor to the beginning of the line to execute i command
o Insert a new line below the line where the cursor is located . The cursor stops at the beginning of an empty line , Waiting for input text
O Insert a new line above the line where the cursor is located . The cursor stops at the beginning of an empty line , Waiting for input text
a Insert the following text after the current cursor position
A Insert the following text at the end of the line where the cursor is located , It is equivalent to moving the cursor to the end of the line and then executing a command
2、Vim Delete text
Shortcut key Function description
x Deletes the character where the cursor is located
dd Deletes the line where the cursor is located
ndd Delete current row ( Including this trip ) after n Line text
dG Delete everything from the cursor line to the end of the file
D Delete the cursor position to the end of the line
:a1,a2d Function from a1 Row to a2 The text content of the line

Be careful , The deleted content is not really deleted , It's all on the clipboard . Move the cursor to the specified position , Press down “p” key , You can paste the deleted content here again .

3、Vim Copy and paste text
Shortcut key Function description
p Paste the contents of the clipboard behind the cursor
P( Capitalization ) Paste the contents of the clipboard in front of the cursor
y Copy the selected text to the clipboard
yy Copy the cursor line to the clipboard , This command can be preceded by a number n, Multiple lines can be copied
yw Copy the word at the cursor position to the clipboard
原网站

版权声明
本文为[lihongbao80]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202200534500682.html

随机推荐