博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
vim 的一些 小tick(如%, !, $等 )
阅读量:3557 次
发布时间:2019-05-20

本文共 2791 字,大约阅读时间需要 9 分钟。

1. :$

直接敲$, 是当前行的末尾

$  or 
To the end of the line. When a count is given also go [count - 1] lines downward. inclusive motion. In Visual mode the cursor goes to just after the last character in the line.

前面加数字,  比如3$, 就是到该行下面第三行的末尾。

 

而:$ 

help :$$               the last line in the file                 :$

是到文件的末尾,  等价于G操作 (gg为文件头)


2. :%

比如替换命令时,

:%s/AAA/aaa/g

是全局将AAA替换成aaa。

 

help % - 

9. Various motions                              various-motions                                                                                                                                                                                                                                                                                                       %                                                                                              %                       Find the next item in this line after or under the                                                                                                     cursor and jump to its match. inclusive motion.

看不出啥意思

 

help :% 看下

Line numbers may be specified with:             :range E14 {address}                                                                                          {number}        an absolute line number                                                                                                               .               the current line                          :.                                                                                          $               the last line in the file                 :$                                                                                          %               equal to 1,$ (the entire file)            :%

即:%  相当于 :1,$, 即从第1行到最后一行

:%s/AAA/aaa/g 等价于 :1,$s/AAA/aaa/g

末尾的/g什么意思, help文档不太好看, 代表一行中的每一个...


 

3. :%!

有时使用:%!xxd

:%!xxd -r等命令

 

:%为全局操作,

:{range}![!]{filter} [!][arg]                           :range!                                                                                                              Filter {range} lines through the external program                                                                                                    {filter}.

加个!为调用第三方程序,

是的xxd不是vim内嵌的软件,

 

man xxd看下

XXD(1)                                                       General Commands Manual                                                       XXD(1)NAME       xxd - make a hexdump or do the reverse.

xxd是将text转换为hex 16进制格式...

转载地址:http://zvcrj.baihongyu.com/

你可能感兴趣的文章
计算机网络知识整理
查看>>
Java基础知识
查看>>
操作系统知识整理
查看>>
实现自己的权限管理系统(二):环境配置以及遇到的坑
查看>>
实现自己的权限管理系统(四): 异常处理
查看>>
实现自己的权限管理系统(十):角色模块
查看>>
实现自己的权限管理系统(十二):权限操作记录
查看>>
实现自己的权限管理系统(十三):redis做缓存
查看>>
实现自己的权限管理系统(十四):工具类
查看>>
JavaWeb面经(二):2019.9.16 Synchronized关键字底层原理及作用
查看>>
牛客的AI模拟面试(1)
查看>>
深入浅出MyBatis:MyBatis解析和运行原理
查看>>
Mybatis与Ibatis
查看>>
字节码文件(Class文件)
查看>>
java中的IO流(一)----概述
查看>>
StringBuilder
查看>>
集合,Collection
查看>>
泛型详解
查看>>
泛型实现斗地主
查看>>
List集合
查看>>