VS code on win 10 - create keybinding for capslock+i/j/k/l to act as arrow buttons
Asked Answered
B

1

1

I have a 60% mechanical keyboard where the capslock works as an fn button. By pressing FN + i/j/k/l, it works as the arrow buttons.

I would like to replicate this behavior on the laptop's keyboard (for the sake when I don't have the keyboard with me), but by what I saw so far it won't work (sharpkeys and keytweak), so I had hoped to do it at least on the VS code, which is the place where I miss this at most.

I've tried to add it as keybinding on the keybindings.json, but I must be doing something wrong. Does anybody knows if it's possible and how to do it?

Bigner answered 18/4, 2020 at 22:13 Comment(6)
I can get it to work but you have to hit the capslock button for each character move - is that what you expect or just engage capslock and iii moves 3 characters left?Willowwillowy
I would like exactly the first, so it will work as the mechanical keyboard. The second option is fancy but it’s not required at all. Thanks!Bigner
I tried a lot of combinations with the capslock key and its oem_14 and you had to keep pressing the capslock key everytime - seems a little buggy to me. Sorry.Willowwillowy
But I indeed want to press the capslock everytime! Could you please share what you’ve done?Bigner
I mean it is capsloak+i to move one character left. Press capslock+i to move another and so on - is that what you want? As many capslock presses as i presses?Willowwillowy
yes @Mark, it is. As I said on my first comment, I want to press as many capslock presses as i presses.Bigner
W
2

Here are some of the things I tried, and the one that "worked":

{
  // "key": "shift+capslock shift+i",         // works once at a time  
  // "key": "0x14 + i",                       // DOESN'T WORK
  // "key": "VK_CAPITAL+i",                   // DOESN'T WORK
  // "key": "VirtualKeyCode.VK_CAPITAL+i",    // DOESN'T WORK
  // "key": "oem_14 i",                       // DOESN'T WORK  
  // "key": "[CapsLock]+i",                   // DOESN'T WORK
  // "key": "capsLock+i",                     // DOESN'T WORK

  "key": "capsLock i",                        // Works one key at a time

  "command": "cursorLeft",
  "when": "textInputFocus"
},

As you clarified in the comments, an acceptable solution is that you press capslock (and then must release it), then press i to move the cursor one character at a time. I made the command cursorLeft but you can make it whatever you want. It works whether caps are being locked or unlocked at the time.

The gif isn't the best at showing all the keystrokes, but (1) press capslock, (2) release the button, and (3) press i. Repeat.

capslock in a keybinding

Willowwillowy answered 27/4, 2020 at 3:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.