So, open a file in vi as usual. To switch into hex mode hit escape and type:
And when your done and want to exit from hex mode hit escape again and type:
Okay, so this isn’t actaully switching to vi’s ‘hex mode’; vi doesn’t have one. What the above actually does is to stream vi’s buffer through the external program ‘xxd’.