Monday, June 4, 2012

Re: Repeat gq from : command line?

On Sun, 3 Jun 2012, Tim Chase wrote:

> 1) the 2nd "/" ends the search, but it looks like you have a "repeat
> 3+ times" token outside that. I suspect you want
>
> :/^[[:lower:][:punct:]]\{3,}/ norm...

That is correct, my typing error. But there is still something wrong
with this expression. For instance, when I do simple search with this
expression like this:

/^[[:lower:][:punct:]]\{3,}/

Vim selects lines that begin with a Capitol letter like these:

Administration: $108
Graphic Science
SOURCE:NATIONALSCIENCEFOUNDATION
Graphic by Arno Ghelfi
Politicians argue over the federal budget
every time Congress reconvenes in Janu-
ary. But the money that the government

The search should only locate lines that start with at least 3 lower case
letters or punctuation. I do not understand how vim highlights lines
that start with words like SOURCE or Politician. I seem to get what I
want if I use something like /^\l and then a character class with \{3,}.
It is as if \{3,} works differently with character classes than
it does following simple atoms like \l.

> 2) the space after "gq" seems particularly suspect. At a minimum, I
> think you mean to write
>
> normal gq/^\L^M

Does not seem to matter, and does not work eithe way when I try it.
>
>
> The infinite looping is likely a result of not moving the cursor
> combined with not modifying the line as you intend.

Perhaps correct, if the command does not work, the cursor will not move
and the while loop will go on forever. The reason I do not use a g or
global command, is vim would mark each line and try the formating. I
want it to mark one range of lines, do the gq command, move the cursor
to the end of the filtered lines, and then repeat the sequence till the
end of file.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: