0

Short question: Is there a way to force VSCode to just follow the keymapping defined by xkb? It seems to have a keymapping of its own when it comes to the right-shift and up arrow, this ruins my touch typing.

Precondition: My Lenovo Flex 4 Ideapad's keyboard has an unusual layout. Its UP key (UpArrow/PgUp) is where one would typically find the RTSH key (Right Shift), and the RTSH key is further to the right of UP arrow key. This has caused many costly errors in commands and text documents: touch typing has become dangerous. The laptop runs Ubuntu 20.4

I swapped the key mapping back to a sane position, first by editing /usr/share/X11/xkb/symbols/pc, and making.

key <RTSH> {    [ Up            ]   };
key   <UP> {    [ Shift_R       ]   };

That worked just fine for all my purposes. All applications accepted that the UP key now is has Shift functions, and RTSH works as Up, I rarely use the cursors anyway. Years went by without problems.

Problem: I started using VSCode at work, and I liked it.

But in my Ideapad, VSCode consistently interprets my pressing of the UpArrow key as Shift+Up instead of Shift, which is a shortcut to "command": "cursorUpSelect". This happens even in VSCode's Vim mode. I just want VSCode to follow my keymapping and assign this command to Shift+Up.

What I have already tried as solution: I did a palliative trying to turn this shortcut off by editing the keybindings.json. But the best I can do is create another shortcut for this command, the UP key still does not act as the Shift modifier. Disabling or reassigning the key shortcut will make the cursor keep still, but the shift modifier only works if I press the modified key twice (UP+A+A instead of UP+A). This still hinders touch typing.

I tried further editing the /usr/share/X11/xkb/symbols/pc, editing

    modifier_map Shift  { Shift_L, Shift_R};

into

    modifier_map Shift  { Shift_L, Up};

but this had the effect of killing the right-shift modifier. So I changed xkb/symbols/pc back to its original "factory" state and edited /usr/share/X11/xkb/keycodes/evdev instead. Everything else works as I intended in every application, only VSCode still selects text AND moves the cursor up every time I summon the shift modifier by pressing the UP key.

2
  • Should I leave xkb alone? I may try to solve this issue entirely through xmodmap, as suggested in superuser.com/questions/522723/… I shall turn this into an answer if it works.
    – Mrlsts
    Mar 29, 2021 at 11:48
  • The answer in the link above also changes the keymapping as desired for all of the applications I have tried, except VSCode. Therefore, I shall go back to editing xkb.
    – Mrlsts
    Apr 21, 2021 at 14:36

1 Answer 1

1

in vscode setting -> application -> keyboard

select "KeyCode" in "Keyboard: Dispatch"

this works for me

1
  • 1
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Jun 12, 2022 at 15:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .