我正在调查一个主要是UTF-8文件,很多很长的线。但是,文件不是完全是文本文件,有一些垃圾。要找到我的兴趣点,我使用hd和grep。
所以在某些时候,我知道这是例如0000301a,所以我想快速打开Vim中的文件,并跳转到该位置。
me@here:~$ hd file | grep -C 10 \ 00\ 00000000 6c 69 6e 65 31 0a 6c 69 6e 65 32 0a 6c 69 6e 65 |line1.line2.line| 00000010 33 0a 6c 69 6e 65 34 0a 6c 69 6e 65 00 35 0a 6c |3.line4.line.5.l| 00000020 69 6e 65 36 0a 6c 69 6e 65 37 0a 6c 69 6e 65 38 |ine6.line7.line8| 00000030 0a 6c 69 6e 65 39 0a 6c 69 6e 65 31 30 0a |.line9.line10.| 0000003e me@here:~$
就在这里。这是正常模式命令去。
从:h go
:
[count]go Go to {count} byte in the buffer.
例如,42go跳转到字节42。
为了跳转到十六进制或八进制地址,您需要使用以下命令构建一个命令:normal! go或等效:goto和str2nr()或printf()函数。
:exe 'normal! ' . str2nr('0x2a',16) . 'go' :exe 'goto' str2nr('0x2a',16)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。