Today, I’m back to Linux and some VSCode keyboard shortcut not working
Today, decided to back to Linux after using Mac for years , bring back Thinkpad laptop and install Linux distro on it. Btw, Thinkpad keyboard is awesome, really like it !!!
Back to topic, my daily activity is mostly writing code. Try to write some code using VSCode… and… BOOOMM 🔥 .. some keyboard shortcut not working 😢
Hmmmm.. i like shortcut Ctrl
+ D
for copy line down, it’s useful for me. Already try to use some solution and still not working.
Ctrl
+Shift
+ArrowDown
❌Ctrl
+Shift
+ArrowUp
❌
After searching again, found other solution.. just need to add custom keyboard shortcut.
Let’s fix it
Open keyboard shortcut setting
You can use Ctrl
+ Shift
+ p
for open search bar and type shortcut
, click Preferences: Open Keyboard Shortcuts (JSON)
for add new custom keyboard shortcut.
Now, write mapping shortcut
Honestly, it’s simple for adding new shortcut, just need to edit the JSON file and add these lines.
// Place your key bindings in this file to override the defaults
[
{
"key": "ctrl+d",
"command": "editor.action.copyLinesDownAction",
"when": "editorTextFocus"
}
]
Mapping key
with command
, and now Ctrl
+ D
working again 🔥
Conclusion
In VSCode, we can add custom keyboard shortcut by mapping in JSON shortcut config.
Thanks for reading, hope it will help you too.