[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vile] Is there something special about J[oin], or "why can't I do t

From: Chris G
Subject: Re: [vile] Is there something special about J[oin], or "why can't I do this?"
Date: Tue, 19 Aug 2008 12:35:52 +0100
User-agent: Mutt/1.5.17 (2007-11-01)

On Tue, Aug 19, 2008 at 12:29:41PM +0100, Chris G wrote:
> On Tue, Aug 19, 2008 at 12:26:21PM +0100, Chris G wrote:
> > I have a file which has a series of CRLF sequences in that I want to
> > change to a comma followed by a space.
> > 
> > When viewed in vile (as expected) the CRs appear as ^M so it seemed to
> > me that if I execute (on the command line, i.e. after entering :) the
> > following:-
> > 
> >     g/
> > /J
> > 
> > I should get what I want.  However it doesn't work, vile doesn't seem
> > to accept the J, it just echoes it and then refuses to accept any more
> > input.  Why isn't J acceptable there and, more to the point, how can I
> > do what I want to do?
> > 
> Oops, that ^M (a real CR) didn't work very well did it!  :-)
> The command sequence I'm entering is:-
>     :g/^M/J
> where the ^M above is actually entered as ^V^M.
Ah, I've found the answer to why it doesn't work:-

        The ":g" command can be followed by any of l (list), p (print),
        < (left shift), > (right shift), r (read file), d (delete),
        L (lower case), U (upper case), ~ (flip case), put (append
        yanked text), Put (prepend yanked text), s (substitute),
        trim (trim trailing whitespace).  For example, ":g/pattern/Put"
        will insert the contents of the default yank register just
        above every line containing "pattern".   The ":g" command can
        only be used over the entire file -- smaller regions are not

So, OK, how do I do what I want to do then, perform a J[oin] when a
pattern matches throughout a file?

Chris Green

reply via email to

[Prev in Thread] Current Thread [Next in Thread]