On Mon, 4 Jun 2012, John Little wrote:

while line(".") < line("$")

but there's no guarantee that the cursor should ever move to the last line.

True, the last lines may not get selected by my pattern. So that is a
necessary improvement.

Also \L matches anything that's not a lowercase character, including
whitespace and punctuation.

Correct again. I was fooled by an analogy - figuring if \l is lower case
\L would be upper case. What I really want is /^\u

Assuming you meant

while line(".") < line("$")
:/^[[:lower:][:punct:]]\{3,}/normal gq/^\u^M
endwhile

This works, I think, if the last line matches /^\L/.

Nope does not work, even when I put a capitol letter on the last line. I
get the infinite regress, I get lines selected that start with a capitol
letter, and when I interrupt the script, it seemed to get stuck on line
2. In some the format command seems not be working.

Anyway, I bet you've got wrapscan set, so that the search wraps round
the beginning of the file, and so never fails, stopping the loop.

When I set nowrapscan, the search hits bottom and gives the error
message:

Search hit bottom without finding /^[[:lower:][:punct:]]\{3,}/

But I KNOW there are nots of lines in that file that start with 3 lower
case letters. So I do not see the problem with the above regular
expression.

:.,$g/^[[:lower:][:punct:]]\{3,}/normal gq/^\L^M

I tried that initially but will mark every single line starting with
lower case letters, even severl consequtive lines, and then try the
format. I need it to mark BLOCK lines that starting with one that begins
with a lower case letter, and ends with an upper case one. Global will
not do that. In fact, if there were a way to highlight to select
multiple blocks like this in visual and select mode, and then do a gq on
each block -- that would be perfect.

--
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

Reply via email to