Leslie wrote:
I don't know what to make of this. For one thing I can't type it
without "trailing characters" errors. Is it all one line? Is it an ex
command? I tried inserting the ^M's with ctrl-q-ctrl-m but it
immediately terminated the command.
It is 2 lines, and the ^M is indeed a ctrl-M, that can be typed as you did, or
by ctrl-q<ENTER>. Depending on your vim options you may also be able to use
<CR> or \n to get the same effect. Let me explain: Lets say you have sections
each of which begins with a line that has the word, Topic: . Since email
digests have an initial portion that is not marked as a Section, my first ex
command, inserts a line with the word, Topic: as the first line of the file.
This is the command:
1s/^.*$/Topic: ^M&/
In words, ``Substitute for any line on line 1 of the file, a line with the
word, Topic:, followed by the original line 1''. So line 1 becomes line 2
and a line with, Topic:, is now line one. You probably do not need this
command, if every one of your sections begins with some line you can identify.
Now, in words, mark lines that start with a line containing, Topic:, and end
one line prior to the next line that contains, Topic: . For the last block of
text, start the block at a line that contains, Topic:, and end the block with
the last line of the file. Do a fold for each block of text, so marked. The
second ex command that does all of this is:
g/^Topic: */,/^Topic: *\|\%$/-1fold
If you put these two commands in a script, they will be executed, when you
source the script, so you need not prepend a colon or hit return for each
command. Again, you may be interested only in the second command.
Clear I hope?
--
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