It's quite long ago since I last added a new macro to my .vimrc but today I saw a simple
solution to use
vim as a hex editor to edit binary files.
map <Leader>hon :%!xxd<CR>
map <Leader>hof :%!xxd -r<CR>
where Leader is ',' (defined by let mapleader="," ) and xxd is shipped in a vim installation.