How to make a valid input for “xxd -r” in vim when removing a byte?

断了今生、忘了曾经 提交于 2019-12-01 21:16:36

You've discovered on your own that removing the byte offset column and text column allows you to use :%!xxd -r -p to get what you want. So how about creating a custom command to remove those columns and then do the conversion? :%!xxd -r -p is too much to type, anyway.

Something like:

:command MyXXDR %s#^[^:]*: \(\%(\x\+ \)\+\) .*#\1# | %!xxd -r -p

This exact command may cause problems if you have messed up the format of the file too much with your edits (i.e. if the substitute command doesn't match to remove the necessary text), but you get the idea.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!