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

42214python and vim questions

Expand Messages
  • Aaron
    Aug 2, 2003
    • 0 Attachment
      Hi all,
      I am subscribed to lilypond developers list and have been asked to
      forward some questions to the vim users list.

      First a little background Lilypond is a ascii music notation system. The
      two editors with modes for it are emacs and vim.

      some programers developed a way to link each 'note' entered in emacs to
      midi playback so that as you type you can hear each note. They also made
      a way so that during regular playback the cursor will scan the notes
      karoke style.

      This has been done with python and emacs so far. They would like to do
      this also for VIM as well but they are both emacs people and I am pretty
      much a newbie to vim.

      So here are the questions:

      " Suppose one has to type something like (I do not know `vim', so this
      is only
      approximative syntax):

      23,30:py lilypond.vim_play_region()

      for playing lines 23 through 30. This is very tedious to write, in my
      opinion, especially if used often. We need something shorter. One
      possibility would be to make an abbreviation in Python space once, like:

      :py r = lilypond.vim_play_region

      and then use:

      23,30:py r()

      which is better already, from user standpoint. However, it would be
      to bind even simpler keys, if there is a way in `vim' for this. One
      bind <F7> (the function key) to `:py lilypond.vim_play_region()' and
      merely use:


      So <F7> hides the real details of the `:py' command. My question is
      how to do this with `vim', if possible."
      2. "
      > > According to the `vim' documentation, it should be equally easy to
      > > implement for `vim', _given_ there is some way to force an immediate
      > > `vim' redisplay.

      > What do you mean by an immediate vim redisplay???

      If one calls a Python function from `vim' for playing a dozen notes, the
      function returns to `vim' once all twelve notes have been played. There
      a Python statement, supported by the `vim'-Python interface, for
      the cursor position. We could use this function for positioning the
      over the note being played, in real time. However, for most editors,
      and I
      would presume `vim' is no exception, the actual change of display
      appearance, including the location of the cursor, is delayed until the
      editor becomes idle waiting for user input, and all display operations
      suspended in meantime for not slowing down the actual computation which
      taking place. I would presume that, while Python is in control and
      notes, `vim' considers that the editor is _not_ idle.

      I wonder if there is a way, from within Python, to ask `vim' to perform
      immediate redisplay, that is, to get the display and cursor position to
      become synchronised right now, not waiting until are notes have been
      If we cannot defeat the `vim' probable optimisation to position the
      only once to the final position after the whole Python command, we will
      completely miss the karaoke effect you suggested."
      These are quotes from their emails if further clarifaction is needed
      please let me know.

    • Show all 3 messages in this topic