Another variation on the "Using Vim as a Hex Editor" question

14 views
Skip to first unread message

Philip Rhoades

unread,
Aug 10, 2020, 4:45:59 AM8/10/20
to vim_use
People,

I can't find a way to do _exactly_ what I want so here is the Q - I'm
guessing it might need a plugin:

- I want to display ASCII as normal

- I want to display the HEX codes for non-ASCII / Unicode chars inline -
maybe in square brackets, maybe coloured

- I don't want to display TABs or LFs (like with the :list command)

I just want to see what sort of characters are causing my alignment
problems - BEFORE I delete them . .

Does this make sense?

Thanks,

Phil.
--
Philip Rhoades

PO Box 896
Cowra NSW 2794
Australia
E-mail: ph...@pricom.com.au

Gary Johnson

unread,
Aug 10, 2020, 8:12:40 AM8/10/20
to vim_use
On 2020-08-10, Philip Rhoades wrote:
> People,
>
> I can't find a way to do _exactly_ what I want so here is the Q - I'm
> guessing it might need a plugin:
>
> - I want to display ASCII as normal
>
> - I want to display the HEX codes for non-ASCII / Unicode chars
> inline - maybe in square brackets, maybe coloured
>
> - I don't want to display TABs or LFs (like with the :list command)
>
> I just want to see what sort of characters are causing my alignment
> problems - BEFORE I delete them . .
>
> Does this make sense?

By some experimentation, playing with the settings I could think of,
I found that the following settings seem to do what you want.

:set encoding=latin1
:set display+=uhex
:set isprint=

That should display any non-ASCII characters as their hex values in
angle brackets, e.g., <a0>, and colored with the SpecialKey
highlighting.

HTH,
Gary

Philip Rhoades

unread,
Aug 10, 2020, 10:44:46 AM8/10/20
to vim_use, Gary Johnson
Gary,
Perfect! - thanks so much for that! - it was exactly what I wanted . . I
have put it in my .vimrc now.

Regards,
Reply all
Reply to author
Forward
0 new messages