Edit a file in hex using Vim

From AdminWiki

(Difference between revisions)
Jump to: navigation, search
 
Line 6: Line 6:
  :%!xxd -r
  :%!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 %.
* 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}}

Latest revision as of 17:03, 12 May 2009

  • 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