On 03/21/2011 11:58 PM, c b wrote:
Hi Tom,
s/Tom/Tim/
:)
On Mon, Mar 21, 2011 at 5:31 PM, Tim Chase<[email protected]> wrote:
On 03/21/2011 01:43 PM, sanjay ravat wrote:
[2011-03-21T18:45:46.004-07:00] [Other info]... log message
[2011-03-21T18:45:46.008-07:00] [Other info]... log message
[2011-03-21T18:45:46.607-07:00] [Other info]... log message
Thanks for the example data and better description. After experimenting
with it, I came up with the following:
:set foldmethod=expr
foldexpr=(getline(v:lnum)[:19]==getline(v:lnum+1)[:19])?1:'<1'
Change the 19 according to which depth you want:
Seconds: 19 (above example)
Minutes: 16
Hours: 13
Days: 10
Months: 7
Years: 4
1. How can we expand this so that multiple nesting (based on
timestamp) will be supported? i.e. if we have logs for two
days 2011-03-20 and 2011-03-21, the first level would have
only two lines shown (when folded) viz. 2011-03-20 and
2011-03-21. Then upon opening one of the folds, each would
have upto 24 folds (one for each hour), then each hour would
have upto 60 folds (one for each minute) and so on.
You can tweak the expression to chain them...something ugly like
set
foldexpr=(getline(v:lnum)[:19]==getline(v:lnum+1)[:19])?6:((getline(v:lnum)[:16]==getline(v:lnum+1)[:16])?'<6':((getline(v:lnum)[:13]==getline(v:lnum+1)[:13])?'<5':((getline(v:lnum)[:10]==getline(v:lnum+1)[:10])?'<4':((getline(v:lnum)[:7]==getline(v:lnum+1)[:7])?'<3':((getline(v:lnum)[:4]==getline(v:lnum+1)[:4])?'<2':'<1')))))
looks like it works for me.
2. The [Other info] in the example is info I don't really
care about. Isthere a concept of a vertical fold/any way to
hid the [Other info] fields?
As others have mentioned on the thread, there's a "conceal"
feature recent builds of Vim. My Debian-stable Vim7.1 doesn't
have it, and so I can't tell you much about it other than point
you at the docs mentioned in the other thread.
-tim
PS: as noted in the footer of each message, please respect the
list policies and refrain from top-posting.
--
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