Menu

#65 ESC is not recognized when pressed with modifiers

open
nobody
NetBeans (18)
5
2010-07-20
2010-07-19
No

Hi there!

First of: jVi is just awesome! I always thought I had to decide between Netbeans and VIM. Now I get a cool combination of both, which is really fantastic!

My 'bug report'/request: I notice that the Escape key is only recognized when it's pressed without any modifiers. This behaviour is different to what I see in VIM, where pressing something like AltGraph+ESC goes into command mode regardless.

This might seem like an unimportant detail, so let me elaborate: As a lot of VIM users I find the Escape key is way too far out of reach for such an important action. I know of the alternative Ctrl+[ but unfortunately that's not an option for me. I'm on a German keyboard layout where Ctrl+[ requires three keys to be pressed - hardly an improvement.

So my solution: I use xkb to switch my AltGraph and Caps Lock keys and also extend the 'j' key to create Escape when pressing AltGraph+j. This allows me to use my Caps-Lock key (now functioning as AltGraph) in combination with j to go into command mode. That's a very convienent workaround. (The added benefit is that I can also use the Caps Lock key now to invoke various AltGraph-combinations that create such characters as [ ] { } on a German keyboard layout - much faster than on a standard German keyboard).

Long story short, this doesn't seem to work in jVi for Netbeans. I assume the reason is, that AltGraph+j does in fact create an Escape, but the modifier is still pressed so Netbeans/jVi sees AltGraph+Escape and nothing happens.

Would it be possible to modify jVi in such a way that Escape is recognized regardless of what modifiers are pressed? This would also be consistent to how VIM operates.

I understand that this might not be something that affects a lot of people. So I'm happy to just hack my own version of jVi. I browsed the code a little bit, but didn't really see a good way to hack this in. If you could provide me with some hints on how I can hack jVi/nbvi to recognize AltGraph+Escape as an additional Escape I would appreciate that a lot. :-)

Best regards!
Jan

Discussion

  • Ernie Rael

    Ernie Rael - 2010-07-20

    The first thing is to check and see what jVi is seeing. You can turn on the debug option Menu>Tools>Options>jViConfig>Debug>debugKeystrokes. This outputs something for each key that jvi sees, for example entering "j<ESC>" on my installation outputs

    CharAction: 'j' 6a(106) 0
    KeyAction: ViEscapeKey: 1b(27) 0

    This should get you going...

    (moved this issue to feature request)

     
  • Ernie Rael

    Ernie Rael - 2010-07-20
    • labels: 948553 --> NetBeans
    • milestone: 101030 -->
     
  • Jan Vornberger

    Jan Vornberger - 2010-07-20

    Thx for the tip - I tried that and while I can see outputs for all sorts of keys, pressing AltGraph+j (or any AltGraph combination) unfortunately produces no output at all.
    Am I out of luck then? Is there some place where I can extend which keys are handled by jVi? maybe I need to add an extra modfier mask to have it recognized?

     
  • Ernie Rael

    Ernie Rael - 2010-07-21

    There is also the Ctrl-KeyBinding and KeyPadBinding jVi options. But if the AltGraph is the problem not sure that will make a difference.

    You'll probably have to modify the source to add a binding for what you want, and then make sure it gets mapped into an ESC.

    Guess you'll need to build your own version.

     

Log in to post a comment.

MongoDB Logo MongoDB