Linux vim

 1. 显示行号: :set nu
2. 去掉行号: :set nonu
3. 默认每次使用vim有行号:
回家目录:cd
修改文件:vi vimrc
添加内容:set number
4. 回句首:0 / ^
5. 去句末:$
6. 单词跳动:w
7. 剪切模式:d(行:d;单词:w;当前到结尾:$)
8. 复制模式:y(行:d;单词:w;当前到结尾:$)
9.粘贴:p(光标后面) P(光标前面)
10. 正向查询:/   
查下一个:n
查上一个:N
11. 反向查询:?
查下一个:N
查上一个:n
12. 撤销之前改动:u
13. 重做改动:Ctrl+r
14. 字符串替换::%s/原字符串/新字符串/gc
g:全局替换
c:替换前确认
15. 拆分窗口
纵向拆分::vsplit
横向拆分::split
光标在拆分窗口切换:Ctrl+w
取消拆分::q
16. 在括号之间跳动:%
17. 大面积选择模式:
大面积行模式:V
大面积模式:v
大面积快模式:Ctrl+v
18. 调出之前操作记录:q:
19. 添加模式:i
20. 删除模式:x
21. 修改模式:r
22. 保存退出::wq
23. 不保存退出::q!
24. show grammery: syntax on/off
 
ctags: use to find the function of C language file
1. preparation: check ctags package installed or not;
2. ctags -R <path>: review all the files for next usage;
3. enter the c language file and choose the function, use "Ctrl+[" to find the  related information;
Ctrl+T come back to original file
:ts: go to the result list

Multiple replace in whole file 
Example /class2/mysql --> /class/my3306
:%s#/class2/mysql#/class/my3306#g

Comments

Popular posts from this blog

Nginx Proxy & Load Balance & LNMP

Snort+barnyard2+Snorby CentOS 6.5_64 Installation

ORACLE Error