On 27/09/09 20:39, Tim Garton wrote: > > All, > Does anyone know of a way to perform an action when the Ctrl key > is released? Specifically I would like to write a plugin that while > holding down Ctrl, you could press 'j' or 'k' to move forward or > backwards through a the list of open buffers sorted in MRU order. > Upon releasing the Ctrl key, the list would be resorted in MRU order. > Alternatively, if there is a plugin that already does something > similar to this, that would be great. > > My goal here is to jump between buffers in MRU order with as little > keystrokes as possible. I know bufexplorer already allows you to move > between buffers in MRU order, but I feel there are two unnecessary > keystrokes involved - opening the explorer window, and once the buffer > you want is selected hitting<return> to open it. Thanks. > > -Tim Garton
Short answer: you can't. Longer answer: keydown and keyup events happen at a much lower level than Vim's keyboard I/O; also, they are much less portable. Vim has no knowledge at all of when a modifier key (including the Caps Lock key BTW) was pressed or released, all it knows is that a certain character was sent, or that a certain non-printing key or key combo was hit: to Vim, Ctrl-D is not (Ctrl down) (D down) (D up) (Ctrl up), it is not even (Ctrl down) D (Ctrl up), it is just 0x04 -- ONE event. In a sense this is better, because at the level where keydown and keyup events happen, a single event would mean q-down on a QWERTY keyboard, a-down on an AZERTY, and yet another letter down on a Dvorak. Remember also that there is not only gvim, there is also Console Vim, which has only limited access to keyboard events and must remain compatible (via the termcap/terminfo interface on Unix) with all possible terminals. Best regards, Tony. -- "Hit any key to continue" is a lie. --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
