[Top][All Lists]

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

Re: [Groff] End-of-line whitespace.

From: Ted Harding
Subject: Re: [Groff] End-of-line whitespace.
Date: Sun, 09 May 2010 09:58:47 +0100 (BST)

Hi Ralph,
I think your points are mostly matters of taste and convenience!

On 09-May-10 00:09:53, Ralph Corderoy wrote:
> Hi Ted,
>> Using the 'vim' editor, I can easily strip trailing spaces from a file
>> I am editing with the command
>>   :1,$s/ [ ]*$//
> I'm not sure why the second space is a character class, but I do the
> same thing with
>     :%s/  *$

I use my method because it's clearer to the eye exactly what is happening
(i.e. "one space followed by zero or more spaces"). Compare (even using
your "%"):

  :%s/  *$

  :%s/ [ ]*$

Here I have it thrown in my face that there is a second space there.
I don't readily detect that there are two spaces in your version!
I know one should be aware of whether one's fingers have typed
one or two spaces, but from experience I tend to distrust what I
think my fingers have typed!

> `%' is a shorthand for `1,$'.  And since I want to delete the matched
> text, there's no need to specify a replacement.

Again, I like to spell it out ... !

> I could match / *$ but it seems more logical to insist on an least
> one space being present, as you do.

Matching a single space would be fine if you were confident of at
most one trailing space. NBut it's more than "logical", it is
very practical in many cases, to allow for more than one.

I often prepare typeset documents from material in web pages
(again copying over by mouse frfom the web-page). Here, you can
often end up with many trailing spaces at the end of a line.

>> (which I could have done with that posting to the list, if I had
>> been alert to the possible presence of trailing spaces).
> If you've syntax highlighting turned on in vim then you can specify
> that end of line spaces are an `error' and they'd be highlighted,
> e.g. with a red background.  See `:he nroff.vim' for something
> similar, although I don't agree with its advice to only have one
> space after end of sentance punctuation.
> Cheers,
> Ralph.

Here it may well be simply a matter of taste. For myself, I dislike
the "visual clutter" resulting from highlighting, so keep it to a
minimum. I value the basic highlightling of matching (), [] and {},
both when programming in a computational language, and in groff when
using eqn and pic (where getting it wrong can abort the whole thing);
and if there is a mis-match then the highlighting is useful in giving
information about where the missing item should be.


E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 094 0861
Date: 09-May-10                                       Time: 09:58:44
------------------------------ XFMail ------------------------------

reply via email to

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