linux vi 文本编辑器常用命令

1、启动文本编辑器

vi abc.txt
2、常用命令

//命令输入方法 先输入“: ”,然后输入相应命令
2.1 从命令模式切换到输入模式
 a/i   //change mode from comand to edit
2.2 从输入模式切换到命令模式
 ESC(key board)  // back to comand mode
2.3 退出和强制退出
q  // quit no save
q!  // force quit no save
2.4 退出保存和强制退出并保存
wq  //save and quit
wq! // save and force quit
2.5 单词搜索
 /WordOfSearch  // WordOfSearch is the word you will search , key Board N key search next

2.6 Jump to particular line that contains main() function from a shell prompt(直接跳到main函数那一行)

vi +/main initlib.c

2.7 Jump to particular line number from a shell prompt, enter:(直接跳到指定行)

vi +linenumber file.c

2.8 To display line numbers along the left side of a window, type any one of the following command while using text editor:(显示行号)

set nu

2.9 To turn off line number again enter the same command:(关闭显示行号)

set nu!

2.10 If you need number every time you start vi/vim, append following line to your ~/.vimrc file:(永久显示行号)

Append the following line:(在~/.vimrc文件后加上下面的命令,然后保存退出)

set nu
Save and close the file.


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值