As romainl suggested, you can achieve so with the
conceal feature of vim.
Here is a script example that can be used:
let rules = [
\ ['01' , '☺'],
\ ['02' , '☻'],
\ ['03' , '♥'],
\ ['04' , '♦'],
\ ['05' , '♣'],
\ ['06' , '♣'],
\ ['07' , '•'],
\ ['08' , '◘'],
\ ['^A' , '¢'],
for [value, display] in rules
execute "syntax match vartest /".value."/ conceal cchar=".display
" Ensure the character is concealed
As you can see, I took some of the seriously mapping and your
Careful if you want to copy/paste this code, the
^A needs to be typed
What this code does is, it define for each
display pair a syntax matching.
syntax match vartest /08/ conceal cchar=◘
Will match every
08 sequence and the file and conceal them with the
You will see
◘, but the actual text in the file is
You can then take a list of rules and (with a fancy macro, i.e. for seriously:
0i\ ['^[f s', '^[lxf)s'],^[ld$) transforme each line into a usable vim array.
Also, if you want to type literal unicode with vim, you can use this workflow:
<C-V> u XXXX
XXXX is the unicode value, so typing
<C-V>u0001 will insert
^A as desired.
If you want to verify the content of the file, I recommend using a hex dump of the file, that you can have with xxd.
$ xxd a.txt
0000000: 0102 0a ...
You can see here your
01 and your
0a represents the new line at the end of the file)