Satyajit Roy
Satyajit Roy

Reputation: 547

How to use shift+alt+arrow-down for copy the selected lines just under the selected lines in Visual Studio Code

Previously I used Windows 10 operating system. I am a beginner and I am learning HTML, CSS. I used Visual Studio Code on Windows 10. There I used the shift + alt + arrow-down key to duplicate some selected lines just under the selected lines. I recently shifted to Ubuntu and the shift + alt + arrow-down key is not working like windows. It is not duplicating the selected lines.

How can I make these keys working like windows or is there any other key to do the same work?

Help me, please.

Upvotes: 11

Views: 30282

Answers (5)

ellie
ellie

Reputation: 11

You can add this shortcut yourself because it is not enabled in Linux by default.
Press Ctrl + Shift + P in VsCode.
Then find Duplicate Selection in the list and press setting icon next to it.
Then you can add Ctrl + Alt + Down to be the shortcut!

Upvotes: 1

IngoHe
IngoHe

Reputation: 81

This can be solved with the Windows default keybindings extension.

Also run the following in your terminal to stop the window manager from intercepting the alt+up/down/left/right shortcuts, more info on the extension page.

# ubuntu
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 switch-to-workspace-down "['']"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-up "['']"

Upvotes: 6

Paullaster Okoth
Paullaster Okoth

Reputation: 87

On ubuntu, you can use this combination to Copy Line Down and Copy Line Up Ctrl + Shift + D and Ctrl + Shift + Alt + UpArrow respectively. You can can also update these keys to your preferred keys as hinted by @Syed Muhammad Moiz

Upvotes: 0

justFIDEL
justFIDEL

Reputation: 11

On windows you can use Ctrl + Shift + D to Copy Line Down.

Upvotes: -1

Syed Muhammad Moiz
Syed Muhammad Moiz

Reputation: 445

For Linux:

Ctrl+Shift+Alt+Down and Ctrl+Shift+Alt+Up

You Might need to use numpad Down and Up for Linux

You can also go to: File > Preferences > Keyboard Shortcuts. and search for: Copy Line Down or Copy Line Up, change the keyboard shortcut for this command by right clicking on the command and selecting Change Keybinding

Upvotes: 13

Related Questions