Some VSCode Keybindings not working in Ubuntu
Asked Answered
P

4

15

I have just started with VSCode on Ubuntu and was looking for the equivalent of cmd+shift+D in Sublime on the Mac (duplicate selected text) . According to the docs I should use Ctrl+Shift+Alt+Down or Ctrl+Shift+Alt+Up but these keybindings are not working for me. When I look in File > Preferences > Keyboard Shortcuts, I see the definitions, but when I try to use them, nothing happens.

Pridgen answered 10/11, 2015 at 18:0 Comment(4)
Unfortunately Windows-Users see different keybindings when they open the link. I think it's better to add the command id like editor.action.insertLineBefore. However, maybe the shortcuts are overwritten globally? What happens when you define custom shortcuts for the commands you are looking for?Blowing
I have tried copying the definitions to my keybindings.json and the shortcuts still don't work. Interestingly though, if I change the shortcut to Ctrl+Shift+Down, it does work! I wonder if Ubuntu is confused (as I probably would be) by so many keys being pressed at the same time :)Pridgen
I have same problem with Alt+Shift+Down (Shift key not working)!Fewell
Do you have a non-US keyboard where some keyboard codes are mapped to different key caps?Giagiacamo
P
17

Ubuntu uses those shortcuts for managing workspaces.

You can look for those keybindings in Settings -> Keyboard -> View and Customize Shortcuts

If there's nothing set to Ctrl+Shift+Alt+*, you can check gsettings

The following command should find shortcuts bonded to combinations with Up key:

gsettings list-recursively | grep Up

In my case there are those, which interfere with VS Code:

org.gnome.desktop.wm.keybindings move-to-workspace-up ['<Control><Shift><Alt>Up']
org.gnome.desktop.wm.keybindings switch-to-workspace-up ['<Control><Alt>Up']

The same goes with Down key.

After all you can unset them by the following commands:

gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-up "[]"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-down "[]"
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-up "[]"
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-down "[]"

In case you would want to reset them back to defaults:

gsettings reset org.gnome.desktop.wm.keybindings switch-to-workspace-up
gsettings reset org.gnome.desktop.wm.keybindings switch-to-workspace-down
gsettings reset org.gnome.desktop.wm.keybindings move-to-workspace-up
gsettings reset org.gnome.desktop.wm.keybindings move-to-workspace-down
Polypary answered 11/11, 2022 at 22:38 Comment(0)
D
4

upon checking my default keybinding, i found that editor.action.insertCursorAbove and editor.action.insertCursorDown each has two keybindings ctrl+shift+up/down and alt+shift+up/down.

so i changed editor.action.copyLinesDownAction and editor.action.copyLinesUpAction to ctrl+shift+up and ctrl+shift+down respectively. because in my ubuntu system ctrl+shift+alt+up/down keys were toggling the workspace.

Daphene answered 1/1, 2020 at 11:51 Comment(0)
D
0

I was able to solve this by disabling all workspace shortcuts, which override ctrl+alt+left etc:

gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-up "[]"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-down "[]"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left "[]"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-right "[]"
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-up "[]"
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-down "[]"
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-left "[]"
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-right "[]"

Damson answered 23/7, 2024 at 4:36 Comment(0)
D
-1

Ctrl+Shirt+up and Ctrl+Shirt+down will work. Check your VS keyboard Shortcuts: Click settings icon>keyborad shortcuts enter image description here

Durston answered 8/11, 2021 at 6:23 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.