On Thursday 16 June 2005 03:04 pm, Stewart Stremler wrote:
> begin  quoting boblq as of Thu, Jun 16, 2005 at 12:51:53PM -0700:
> > OK, one good vi question deserves another.
> >
> > I seem to get 0xA0 i.e. hex A0 often in files where spaces
> > should be. I can remove them with something like
> > cat file.txt | tr "\240" " " >file.txt.clean
>
> Hm... That's not ASCII, and there's no "man ansi".
>
> > I would like to use the substitute command in vi
> > but cannot figure out how to hit on an arbitrary
> > hex character. Anyone know the incantation?
>
> Wouldn't "%s/^V_/ /g" work, where _ is the actual value of that
> character, typed in the way you'd generate they character on the
> keyboard normally? (e.g. some sort of alt-keypad entry)

But I don't generate it normally from the key board. It
occurs as a result of pasting from a copy in another app. 

I have tried various ways to use ctrl V so far with no luck. 

> Hm.
>
> You could also piple the paragraph/document through tr from
> within vi to 'clean' it.  For example, in command-mode (i.e.
> edit mode, not ex-mode):
>
> !}tr "\240" " "
>
> Will run the current paragraph through tr.
>
> Use  "!G" instead of "!}" to get the whole document. Wrap the
> tr-expression into a script ("foo") so you just have to type
> !Gfoo^M to "fixup" the whole document.  Find a key-combo you
> don't use and use :map to map that key-combo to do this.

Yeh there are a bunch of ways to do it with tr. 

> -Stewart "There ought to be a way to do it entirely within vi" Stremler

boblq "my sentiments exactly" 



-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to