On 2007-03-19, Mitch Wiedemann <[EMAIL PROTECTED]> wrote:
> Hi all,
> 
> I use VIM - Vi IMproved 7.0 (2006 May 7, compiled Feb 23 2007 22:17:23)
> to write mainly XHTML/PHP and I sometimes have to get content from word
> processed documents and paste it into Vim for HTML markup.  This usually
> results in having non-visually detectable characters (which I assume are
> high ASCII) which display strangely on the Web.
> 
> Is there a way I can have my Vim highlight these characters so I can see
> them and replace them with their HTML counterparts?
> 
> I've searched Google, the Vim e-mail archive, and I've helped Ugandan
> children :),  but I'm no closer to the answer.
> 
> Any hints?

One way to do this would be to

    :set isprint=

which will tell vim that only the characters in the range 32 - 126 
are "printable".  Vim will then highlight all the other characters 
as SpecialKey.  You can then search for these "non-printable" 
characters with

    /[^[:print:]]

Another, probably better, way would be to simply search for

    /[^Vx80-^Vxff]

where ^V means a literal Ctrl-V.  That will search for any character 
in the range 0x80 - 0xff and will highlight them all with the Search 
highlight if 'hlsearch' is set.  I think this way is better because 
it preserves vim's rendering of the non-ASCII characters, which may 
make it easier for you to choose their replacements.

HTH,
Gary

-- 
Gary Johnson                 | Agilent Technologies
[EMAIL PROTECTED]     | Mobile Broadband Division
                             | Spokane, Washington, USA

Reply via email to