I have an IDE called Intellij that I'm using on Linux to code Java applications with. I have the editor mapped to VIM keys, using the IdeaVim plugin. What I don't like is when I get a popup dialog where I have to select from a list, that I can not use Vim keys to navigate through the list. This was reported with Intellij, but it hasn't been addressed for many years. The reason I want this, is because I want to keep my hands on the touch typing position, and not have to move and bent my right hand to the cursor keys. It slows me down and it's annoying. The only workaround I can think of, is to just globally map keys on the OS level. I was thinking of either mock with the key map or else have a script with some setxkbmap commands. What I want is to map:

Ctrl+Shift+Alt+J -> Down
Ctrl+Shift+Alt+K -> Up

How would you go about doing this?

  • 1
    I tried to map through the window manager's keyboard configuration tool, ctrl+shift+alt+k to this command: "xdotool key --clearmodifiers Up", that that did not work. Perhaps something to do with window focus. Tried using "--window %2". No effect... – Mike Oct 9 '15 at 17:07
  • You'll have to write your own custom option for setxkbmap. Search under the xkb tag, there are several answers by Pablo Saratxaga & myself, they should get you on the right track. – don_crissti Feb 3 '16 at 17:38
  • You can do this in IntelliJ by going to Settings -> Keymap, selecting the "Up" command (I clicked the "Find actions by shortcut" button and pressed the up arrow), then adding a new keyboard shortcut. The shortcut works for the editor as well as pop-up menus, but not for tree view. – Zevgon Feb 26 '19 at 3:06

I would try xmodmap. Try this:

1 - Test keycode

xmodmap -pke | grep -w J

Lets' assume the output is

keycode  44 = j J j J j J j J

2 - Remap keycode for testing

xmodmap -e "keycode 44 = j J k K l L m M n N o O"

3 - See whether you can get any non-j letter with your favourite modifiers (Alt+whatever)

If yes, edit the command in 2) to have Js as it originally had except where you found the correct modifier spot - replace by Down.

If not, you may need to remap modifiers. Post the output of

xmodmap -pm

and we'll see.

Please note that the xmodmap command maps keys until you log out. Put the command into a simple shell script and call this script whenever you log in (can be automated depending on your window manager).

  • This is not making sense to me. What you're proposing seems to be about mapping a key. But what I need is to map a key combination, or rather, a key with modifiers, to another key. What is also not making sense is how a key code equates to something like j J j J j J. Why so many J's? I'm guessing that the j key equates to code 44. So, how to map code 44 together with ctrl+shift+alt and make it produce the down key. – Mike Oct 14 '15 at 21:59
  • Have you tried what I suggested? Then you would have seen that in the xmodmap list, the first is the key only, the second one with shift, then with Ctrl, Alt etc. (order depends on your configuration). So, what I suggested is the most direct and easiest way of doing it. (You could also re-program the application you are using to interpret the key combination in a new way.) – Ned64 Oct 15 '15 at 11:12
  • PS: I get a "K" with AltGr+Shift+j . Would that work for you? Then, if your keyboard is like mine, you can set it with xmodmap -e "keycode 44 = j J j Down j J j J j J". – Ned64 Oct 15 '15 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.