Linux 开发运维系列(二)

VI 常用命令

:%s/abcd/efg/g           查找所有abcd并替换为efg

:n,d 删除从第n行到当前行的内容
:m,nd  删除第m到第n行

0 Move to beginning of current line
$ Move to end of current line
]]Move to end of file
[[ Move to beginning of file
n+方向键   往指定方向移动n字符或者移动n行
^ 代表Ctrl键
^f PageDown
^b PageUp
- Move to the beginning of last line
+ Move to the beginning of next line
M Move to center line of current page
fx Move forword to 'x' in current line
d$ Delete to end of current line
d0 From beginning delete to current cursor
0,$d 删除所有内容

要退出:模式,按^c
 如 :10,20d   若不想执行该命令(删除10至20行)则按^c退出

最常用set命令
set nowrapscan 搜索到文件末尾停止
set nu Show line number
set nonu Unshow line number
set tab=n Set table width n spaces
set ai Set autoindent
set noai Cancel autoindent
set all Get brief help of set

yy Copy current line
nyy Copy n lines (从当前行往下数)
y$ Copy to end of line
y0 From beginning of current line copy to cursor
:20,30y    复制第20到第30行之间的内容
p paste after current cursor or current line

J Link following line to current line  (将下一行合并到当前行)
   u  undo last modify
o Make a new line after current line
:n   编辑下一个文件

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9044178/viewspace-1458689/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/9044178/viewspace-1458689/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值