Vim: Hexdump

Today, I had the need of being able to view multiple iterations of a csv file in hex, as I keep updating/saving it. That’s when I came across vim’s xxd command.

So, I decided to bind the command to another key and display the hex output in a vim split.

Here’s the function:

function! TerminalPreviewHexDump()
	new % | terminal ! xxd %
endfu

map <silent> <leader>h :call TerminalPreviewHexDump()<CR>

Now, typing + `h` opens the hexdump of the current file in a vim split view.

For advanced usage type :help xxd for more information