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

Re: Automatic scrolling / normal commands in non-active buffers

Expand Messages
  • Claus Reinke
    ... instead of busy-waiting on the vim side, you could try to get your data provider to notify vim when something happens. in my own experiments on running an
    Message 1 of 7 , Sep 28, 2007
    • 0 Attachment
      > Now, being the newbie that I am, I've run into another problem: ii
      > writes the output of irc-channels to regular textfiles, which can
      > then, obviously, be opened in VIM. Having the autoread option set and
      > using :checktime in a (quasi)asynchronous loop, all "channel buffers"
      > are automatically updated every second. The problem is then to get the
      > window into which a channel buffer is loaded, to automatically scroll
      > to the last line, so that the most recent message is shown.

      instead of busy-waiting on the vim side, you could try to get your
      data provider to notify vim when something happens. in my own
      experiments on running an asynchronous subprocess while feeding
      it command input from vim and reading its output in a dedicated
      vim buffer, i currently use something like this (needs changes if
      you want buffers to remain hidden):

      function! Render(buffer)
      if bufexists(a:buffer)
      setlocal switchbuf+=useopen
      exe "sbuffer ".a:buffer
      else
      exe "new ".a:buffer
      endif
      setlocal ar
      checktime
      normal G
      redraw
      wincmd p
      endfunction

      and when the subprocess has anything new, it does:

      vim -es --servername GVIM --remote-expr Render("mybuf")

      claus




      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    Your message has been successfully submitted and would be delivered to recipients shortly.