> If the goal is to fold each entry to a single line, why not have Vim
> do that automatically? You could put a modeline near the top or
> bottom of your journal like this example:
>
> vim: foldmethod=expr foldexpr=getline(v\:lnum)=~'^\\(Mon\\|Thu\\)\ \\(Jan\\|Jun\\)\ \\d\\d\ \\d\\d\:\\d\\d\:\\d\\d\ \\u\\u\\u\\\d\\d\\d\\d$'?'>1'\:'1'
>
> That uses a fold expression that matches dates of the form output
> from the Unix 'date' command. It starts a new fold at every line
> that matches that expression and sets the fold level of every
> subsequent line to be the same. The result looks like this:
>
> +-- 4 lines: Thu Jun 16 15:01:39 PDT 2011--------------------------
> +-- 4 lines: Thu Jun 16 15:01:56 PDT 2011--------------------------
> +-- 4 lines: Thu Jun 16 15:02:47 PDT 2011--------------------------
Thanks, Gary.
That's what I want, though I'd want to leave out the time report if I could. I wonder, also, how this way of doing it would be affected by editing of an entry at a later date. Would it change the date of the fold? And what if, as is likely, the edited was to just one paragraph of an entry. Would it get separated off into its own fold? I wouldn't want either.
I'd be willing to give it a try, just to see how it works, if I knew how to fill out the expression for the rest of the year. As non-programming Vim novice, I haven't a clue how to go about that.
------------------------------------------------------------------------------------------
Eric Weir
Decatur, GA USA
eeweir@bellsouth.net
--
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