参考资料: [https://blog.csdn.net/jsut\_rick/article/details/81945771](https://blog.csdn.net/jsut_rick/article/details/81945771)
relation between vi and vim, vi is the basics, vim is the advanced
vim: it has three modes:
![](https://box.kancloud.cn/caacf9e6ecf94880d183beaee640a9f9_742x465.png)
2.1 【default】Command mode(命令模式),
1. move the cursor
2. copy, cut/delete, past
a) copy current line: yy
b) paste:p
c) copy multiple lines: 3yy
d) delete current line: dd
e) delete current letter: x
f) delete from current position to the end of line: d$
g) delete multiple lines: 2dd
h) delete current line, but leave the empty space : D
3. undo(ctrl +z), undo undo (ctrl+y)
a) u to undo
b) ctrl + r to undo undo
2.2 endofline mode(末行模式)
1. save modification, and to quit
2. search for some content, and replace the content with something else
for :
a) save changes, :w :w newfilename
b) quit, to exit the file, :q
c) save and quit, :wq
d) to quit without saving changes, :q!
e) if you are using root, use :w! to even modify a readonly file
for /
after the search, to use n to find next match, to use N to find previous match
to replace, substitue
substitute current line, :s/target/xx (only substitue the firt match)
substitute current line, :s/target/xx/g (substitue all matches in current line)
substitue multiple lines, :n,ms/target/xx :n,$s/target/xx
2.3 edit mode(编辑模式)
1. modify by typing anything you like
i :cursor stays at original position, and letter will be inserted before the cursor.
I :cursor goes to the beginning of the line
o: cursor goes to next line
O:cursor goes to previous line
a :cursor goes to next position,and letter will be inserted after the cursor
A :cursor goest to the end of the line
- 第一章 Linux
- 1. Linux安装和网络配置
- 2. Linux基本命令
- 3. Xshell和winscp
- 4. VIM编辑器
- 5. 安装软件
- 5.1 安装JDK
- 5.2 安装TOMCAT
- 5.3 安装MySql
- 5.4 安装Nginx
- 5.5 部署工程
- 第二章 Nginx
- 1. 安装Nginx
- 2. 配置Nginx
- 2.1 配置静态服务器
- 2.2 配置反向代理
- 2.3 配置负载均衡
- 2.4 配置动静分离
- 2.5 跨域访问
- 第三章 Redis
- 1. 安装Redis
- 2. JAVA操作Redis
- 3. Redis事务
- 4. Redis持久化
- 5. 主从复制和集群
- 6. Redis实现Session共享
- 第四章 MySQL主从复制
- 4.1 MyCat安装
- 4.2 MySQL主从复制
- 4.3MySQL读写分离
- 第五章 ActiveMQ
- 5.1 Queue
- 5.2 Topic
- 第六章 FastDFS图片服务器
- 第七章