On Tue, 22 Feb 2011, Adam Monsen wrote:
I use irssi for IRC. I like to quickly browse (local) logs (in vim)
sometimes before sending a message. I've got a rather clunky way of
browsing them, and I'm fishing for ideas on how to improve the
process.
Here's a log snippet:
--- Day changed Fri Feb 11 2011
00:12 < foo> this should help: http://www.example.com
00:13 < bar> that's great, thanks
...snip several hundred messages...
14:23 < me> hey guys, have you seen http://www.example.com ?
To figure out when X was last discussed, usually I
* open the file in Vim
* use "G" to skip to the bottom of the file
* search backward for X
* search backward again for [some part of] the phrase "^--- Day changed"
Anyone have ideas on better/faster ways to do this?
Personally, I would do, in irssi:
/SET log_timestamp %Y-%m-%d %H:%M:%S
(with a trailing space)
Doesn't really solve your current problem, since old logs would remain
"day + H:M"-dependent, but IMO it's vastly preferable.
One thing that would be nice if there was an easy way to always force
the first line of the editor to be the nearest "^--- Day changed" line
above the current line. Or just to have it displayed on the/a status
bar or a preview window or something.
Something like this should work:
==> ~/.vim/plugin/irssi-log-date.vim <==
fun! FindPriorDay()
let l=line('.')
while l
let date=matchlist(getline(l), '--- \%(Log opened\|Day changed\) \(.*\)')
let l-=1
if !len(date)
continue
endif
return date[1]
endwhile
return '(no date)'
endfun
set stl=%{FindPriorDay()}
========================================
But, that blasts the entire status bar which I find annoying. YMMV, or
just incorporate the %{FindPriorDay()} portion into your own 'stl'
setting. (See: :help 'stl' for much more.)
--
Best,
Ben
--
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