Loading ...
Sorry, an error occurred while loading the content.

Re: Using vim as a colourized 'tail'?

Expand Messages
  • Preben Guldberg
    [Bohdan, it seems that your copy to the vim list is missing] ... Yep, that could be a pain. ... As I understand autoread (and the FileChangedShell autocmd),
    Message 1 of 8 , Nov 30, 2001
    View Source
    • 0 Attachment
      [Bohdan, it seems that your copy to the vim list is missing]

      Thus wrote Bohdan Vlasyuk (bohdan@...) on [011129]:
      > On Thu, Nov 29, 2001 at 05:17:23PM +0100, Preben Guldberg wrote:
      > > :se lz | while 1 | silent e! | syn on | $ | redraw | endwhile
      > it would work not so fine with longish files.

      Yep, that could be a pain.

      > probably sticking with
      > somethingon top of 'autoread' and autocommand BufReadPost will do the
      > same thing in less convenient but faster way.

      As I understand 'autoread' (and the FileChangedShell autocmd), you
      would have to run a shell command somehow to trigger it. For me that
      is anywhere between several times a minute and once every other hour -
      and the tail effect is sort of lost.

      I suspect a function like this is better for the purpose:

      fun! Tail(delay, ...)
      " Don't bother with a backup, you have to <C-C> out anyway
      setlocal lazy
      if a:0 >= 1
      let maxlines = a:1
      else
      let maxlines = 0
      endif
      let lasttime = localtime()
      while 1
      if getftime() > lasttime
      let lasttime = localtime()
      silent e!
      syn on
      $
      exec 'syntax sync maxlines=' . maxlines
      redraw
      exec 'sleep ' . a:delay
      endif
      endwhile
      endfun

      At any rate, I don't think vim is the right tool for the job. I'd
      probably use swatch (http://www.oit.ucsb.edu/~eta/swatch) as a filter
      that could highlight some lines differently; though I bet there are
      other, possibly better tools out there.

      Peppe
      --
      "Before you criticize someone, walk
      Preben "Peppe" Guldberg __/-\__ a mile in his shoes. That way, if
      c928400@... (o o) he gets angry, he'll be a mile away
      ----------------------oOOo (_) oOOo-- - and barefoot." --Sarah Jackson
    Your message has been successfully submitted and would be delivered to recipients shortly.