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

Feature requests: InsertCharPre and repeating CursorHold events

Expand Messages
  • Nico
    Hello, Over the past 6 months or so I ve been working on a plugin which turns a Vim buffer into a terminal emulator and allows users to run a shell in that
    Message 1 of 1 , Feb 4, 2010
    • 0 Attachment
      Hello,

      Over the past 6 months or so I've been working on a plugin which turns
      a Vim buffer into a terminal emulator and allows users to run a shell
      in that buffer:

      http://www.vim.org/scripts/script.php?script_id=2771

      It works OK, but depends on several ugly kludges. If Vim added the
      these two events these kludges could be removed and plugin writers
      would be freed up considerably. Since adding a shell window is at the
      very top of the list of voted features, I hope the fine developers of
      Vim would consider making these a priority :-)

      The first is the "InsertCharPre" event, described around line 3301 of
      todo.txt:

      InsertCharPre - user typed character Insert mode, before inserting
      the
      char. Pattern is matched with text before the
      cursor.
      Set v:char to the character, can be changed.
      (not triggered when 'paste' is set).

      Having this event would allow a plugin to capture all input in insert
      mode and send it to the terminal, for true full-duplex behavior.
      Currently you are required to map all keys, which is only sane if you
      limit yourself to the extended ASCII character set. Having an insert
      char event that works with multi-byte characters would allow users to
      write a plugin which works in all locales.

      There is already a GetChar event patch on vim.org which may be close,
      however the way it's described in todo.txt is much cleaner.

      The second event is repeatable CursorHold/I, described around 3252 of
      todo.txt:

      8 Add an event like CursorHold that is triggered repeatedly, not
      just once after typing something.

      This gives a clean way of polling a background shell or debugger.
      Continuous polling is critical for making a shell plugin work, and the
      current feedkeys() workarounds barely work and suck up too much cpu.

      If I knew C I would attack these myself, but until then thanks for
      considering this request.

      Nico Raffo

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