当前位置:网站首页>VIM uses tips
VIM uses tips
2022-07-22 20:30:00 【Simplicity_】
You can operate the contents in the benchmark :
ci’、ci"、ci(、ci[、ci{、ci< - Change the text content in these paired punctuation marks separately
di’、di"、di( or dib、di[、di{ or diB、di< - Delete the text content in these paired punctuation marks respectively
yi’、yi"、yi(、yi[、yi{、yi< - Copy the text content of these paired punctuation marks separately
vi’、vi"、vi(、vi[、vi{、vi< - Select the text content in these paired punctuation marks respectively
(ps: However, I can't achieve it here )
Common mode
roaming
j Down
30j Move down the 30 That's ok
k Up
h towards the left
l towards the right
0 To the beginning of the line
^ To the first character at the beginning of the line , If there's a space in front of it
$ end
gg Fast to the header
G Fast to the end of the file
100G Jump to the first place 100 That's ok
Copy :y
yy Duplicate a row
10yy Copy down 10 That's ok
yw Copy a word at the beginning of the cursor
y$ Copy the cursor to the end of the line
yfB Copy the cursor to the first uppercase B In the middle
y2fB Copy the cursor to the second uppercase B In the middle
shear : x
x Cut one character at a time , If it's at the end of the line , It's cutting forward
3x Cut three
xp Exchange two characters at the end of a non line , If you follow bs become sb
Delete :d
The deleted content is put on the clipboard , Press p You can paste it to other places
dd Delete a line
200dd Delete 200 That's ok
dw Delete a word ( I like it best )
df” Delete to the first double quotation mark that appears
Paste : p
p Paste copied or cut content
3p Cut or paste the content three times
Visualization mode
Visualization pattern is a very useful pattern , Press... In normal mode v You can enter .
Use h、j、k、l To roam , Select the appropriate content .
ctrl+v Block mode
Realization : Add every line in the file to ArrayList in :
1) In command mode , perform %s/$/");/g, Appending data at the end of a line
2) Press ESC Enter normal mode , And use gg Back to the beginning of the line
3) Press ctrl+v Enter visualization mode , Then press G To the end of the file
4) Ignore the editor reaction , Press I Enter insertion mode , Input list.add("
5) Press ESC Back to normal mode , It can be found that the above input has taken effect in each line
Command mode
%s/$/sth/ Add... At the end of the line sth
%s/\^M//g Replace dos A newline ,\^M Use ctrl+v + Enter You can enter
:g/\^\s*$/d Delete empty lines and lines with only spaces
%s/#.*//g Delete # The following characters
Find string
Regular knowledge can also be applied *
In normal mode , Press down / Go straight to , Enter the corresponding string and press OK .
n Find the next match
N Find the last match
2n Find the second match below
According to the line Numbers :set nu
Macro recording (cool man~)
1) Press down gg To the beginning of the line
2) Press down qa Macro recording ,a It's a tag name that we started
3) Press I Enter insertion mode , Input list.add("
4) Press ESC Enter normal mode , Then press $ Jump to the end of the line
5) Press j Go to the next line , Then press ^ Back to the beginning of the line
6) Press again q End macro recording
7) Input @a Trigger macro to test the recording effect
8) Input [email protected] Repeat macro 100 Time , That is to say, it affects the following 100 That's ok
other
r Replace character
ggVG Future generations
u Restore changes
J Merge the next line
gU Turn to uppercase at the cursor
ggguG Capitalize the whole article into lowercase
% Jump to the next match , If in <div> Press up %, Then jump to the corresponding </div>
:e /tmp/a Open in the same editor /tmp/a file . The same editor's buffer is shared by the clipboard , Easy to copy in multiple files
bp Jump to the previous buffer
bn Jump to the next buffer
Exit editor
wq Save the current file and exit
wqa Save all files and exit
q! Do not save , immediate withdrawal
qa! There are multiple files open , Exit at the same time
Reference resources :
https://zhuanlan.zhihu.com/p/70874396
边栏推荐
- 正则表达式学习笔记
- rp文件chrome浏览器查看插件
- What are the ways for Baidu homepage to be hijacked by TN? There are two ways to solve Baidu hijacking
- Core concepts of elastic search learning Introduction (4)
- 1087 All Roads Lead to Rome (30 分)
- LeetCode912——sort an array—— quick sort algorithm
- How to deal with DNS hijacked? Five ways to deal with it
- Cmake+opencv+mingw
- Websites jump inexplicably. What is website hijacking from Baidu? DNS hijacking (domain name hijacking) what is DNS hijacking
- 机器学习入门:逻辑回归-2
猜你喜欢
本地镜像发布到私有库
What are the definitions and principles of domain name hijacking and the solutions to domain name hijacking
vimplus修改终端字体为Droid Sans Mono Nerd Font
Leetcode0002——Add Two Numbers——Linked List
docker搭建mysql主从复制
专访Women in AI学者黄惠:绘图形之梦,寻突破之门
The well-known software adsafe conceals malicious code to hijack traffic from many websites
AMBert
《预训练周刊》第39期: 深度模型、提示学习
Introduction to machine learning: Logistic regression-2
随机推荐
Getting started with CSDN markdown editor
Kubernets原理分解
Leetcode206 - reverse linked list
flask 跨域
CPU亲和力
她力量系列二丨UCLA李婧翌:女性最不需要做的就是「怀疑自己」
信号降噪方法
redission扣库存demo
How to repair DNS hijacking perfectly? How to solve DNS hijacking and how to repair it perfectly
Advent of code 2020 -- 登机座位问题
1034 Head of a Gang (30 分)
mysql索引
When using CV2 to realize face recognition, Chinese is displayed on the recognition frame
Iptables for load balancing
她力量系列四丨读博6年两次换导师,靠一点点“倔”,俞舟成为social chatbot的开拓者之一
1080 Graduate Admission (30 分)
Leetcode0002——Add Two Numbers——Linked List
AMBert
Flask Cross - Domain
rp文件chrome浏览器查看插件