3 ms·
I recently used xxd to illustrate the concept of text encoding, and put together a little vimscript to make it easier to visualize: "Toggle hex edit mode n
by kibwen 13y ago
I recently used xxd to illustrate the concept of text encoding, and put together a little vimscript to make it easier to visualize:
"Toggle hex edit mode
nmap <Leader>h :call ToggleHex()<CR>
let g:hex_mode_on = 0
function! ToggleHex()
if g:hex_mode_on
execute "%!xxd -r"
let g:hex_mode_on = 0
else
execute "%!xxd"
let g:hex_mode_on = 1
endif
endfunction
Stick this in your .vimrc, type something, use \h to convert it to hex, change a value, then \h to convert it back and observe how the text has changed. Not super useful, but a neat party trick.