本文共 2791 字,大约阅读时间需要 9 分钟。
1. :$
直接敲$, 是当前行的末尾
$ orTo 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/