kpg
kpg

Reputation: 7966

Some VSCode Keybindings not working in Ubuntu

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.

Upvotes: 17

Views: 12277

Answers (4)

chantey
chantey

Reputation: 5827

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 "[]"

Upvotes: 1

Adrian Bienias
Adrian Bienias

Reputation: 987

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

Upvotes: 19

rajeshtva
rajeshtva

Reputation: 550

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.

Upvotes: 4

Al Mamun Khan
Al Mamun Khan

Reputation: 737

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

Upvotes: -1

Related Questions