- I created a small file testpoetry.txt with the aforementioned stanza
- I then typed :'<,'>s/$/\=repeat(' ', $COLUMNS-
strlen(getline('.')))/|'<,'>-1s/\n
- nothing happened, except a message :
4 substitutions on 4 lines
E486: Pattern not found: \n
- what did I do wrong (please have in mind my level in Vim is, well,
low) ?
Thanks again
Thierry
On Jun 20, 1:32 am, Tim Chase <v...@tim.thechases.com> wrote:
> On 06/19/2011 02:04 PM, ThG wrote:
>
> > I use Vim to write a book.
> > Each Vim line ended by a carriage return will be a paragraph of the
> > book. Thus a single Vim line (which is wrapped, e.g. with a 80
> > character screen in 10 screen lines) can end as a 15 line paragraph in
> > the book. But I have one problem : I want to make quotes of poetry,
> > such as (Coleridge RAM.2)
>
> A couple ideas occur to me. The first side-steps your problem by
> using something more regularly-used in text-flow: separate your
> paragraphs by 2 newlines as you did in your email (one blank line
> between paragraphs). You can then choose some other scheme to
> number your lines (whether just getting a line-count or actually
> inserting line-numbers in the text). Something like
>
> :let cnt=0|g/\n\n\+/let cnt+=1
> :echo cnt
>
> will tell you the number of double-breaks.
>
> > The only way I can think of is to type spaces to the end of the screen
> > line (e.g. 38 spaces for the first verse, 55 for the second, etc...),
> > which is both tedious and unable to cope with a 75 or 90 (whatever)
> > character screen
>
> This can be automated by selecting your poetic text and
> performing the following
>
> :'<,'>s/$/\=repeat(' ',
> $COLUMNS-strlen(getline('.')))/|'<,'>-1s/\n
>
> (all in one line) which right-pads each line with the missing
> number of spaces, and then (separated by the "|") joins the N-1
> lines by removing the newlines from them. You might have to
> strip trailing spaces before doing the whole thing if you issue
> the command multiple times over the same section after editing.
>
> > How can I proceed ? I have heard of elastic tabstops ? Are they
> > necessary ? Are they available for Vim ?
>
> I'm not sure what elastic tabstops are. I tried setting
> 'tabstop' to $COLUMNS with
>
> :let &ts=$COLUMNS
>
> and then joining each line, internally separated by tabs, but the
> result bound the tab to the character before it rather than the
> character after it, awkwardly coming out as
>
> The fair breeze blew, the white foam
> flew,
> The furrow followed
> free;
> We were the first that ever
> burst
> Into that silent sea.
>
> -tim
--
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:
Post a Comment