Edit a file in hex using Vim

From AdminWiki

Jump to: navigation, search
  • To edit a binary file, start vim like so (:w and such will work like a charm then):
vim -b <file>
  • To edit a buffer in hex, use xxd this way:
:%!xxd
  • To return your buffer to normal (and make it save-able):
:%!xxd -r
  • To use xxd only for a part of your buffer, you can use your normal buffer selection methods, like visual - just omit the %.

Category:Vim Category:Editors Category:Shell Category:Snippet

Personal tools