It will be nice if we can edit binary file directly in vim. VIM provides basic support which has a few restrictions.
(1) Open a binary file
vim -b datafile
or
:set binary
(2) Many characters are unprintable. You can see the Hex format by using:
:set display=uhex
Or you can use ga command to see the value of current character.
(3) To see current position, use
g CTRL-G
The output is verbose:
Col 6 of 38; Line 31 of 31; Word 94 of 96; Byte 747 of 780
(4) Move to a specific byte offset:
234go
(5) xxd can be used to convert the file into hex dump format
%!xxd
Result should look like this:
0000000: 6262 630a 6465 660a 6768 696b 0aab de0a bbc.def.ghik....
There are two parts: hex part and printable character part.
Go back:
%!xxd -r
Note: only changes in hex part have effect. Changes in printable text part are ignored.
Of course, tool xxd can be used independently in command line.