Thanks a lot, the first one worked fine.
I still don't understand why \n[a-z didn't work with substitute.

On Mar 13, 12:01 pm, Tim Chase <[email protected]> wrote:
> > I have wrapped text and I want to unwrap it. Actualy I want to find
> > each line that start with small letter and join it to previous line,
>
>    :g/^\s*[a-z]/-j
>
> that translates as
>
> g     on every line that matches
> /     the following pattern
> ^     "start of line"
> \s*   "optional whitespace"
> [a-z] "a lowercase letter"
> /     perform the following command
> -     on the previous line
> j     join it with the following line
>
> > or find <end of line> followed by [a-z] and replace it with <space>
> > and that letter.
>
> And in a similar variant:
>
>    :g/[a-z]\s*$/j
>
> g     on every line that matches
> /     the following pattern
> [a-z] "a lowercase letter"
> \s*   "optional whitespace"
> $     the end-of-line
> /     perform the following command
> j     join it with the following line
>
> > So because I am not very used to Vim first I tried to find end line
> > and letter. ( /\n[a-z] ).
> > This worked fine.
> > Than I tried to find and replace it with some text ( :s/\n[a-z]/
> > TEST). This should join two lines with word TEST. But it does'nt work.
> > It says it can't find text \n[a-z]. I don't know where is the problem.
>
> >  (based on my best knowledge, the final command should looks like :%s/
> > \n\([a-z]\)/ \1 )
>
> That expression should also work, assuming you actually have a
> line that starts with [a-z].  If there's extra whitespace, you
> may have to change your pattern to
>
>    \n\s*[a-z]
>
> Hope this gives you some ideas,
>
> -tim
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to