Vscode: Keyboard shortcut for copy of line doesn't work on Linux

Created on 8 May 2016  路  8Comments  路  Source: microsoft/vscode

  • VSCode Version: 1.0.0
  • OS Version: Ubuntu 16.04 LTS

Steps to Reproduce:

  1. Click into a text line
  2. Press Ctrl + Shift + Alt + UpArrow or Ctrl + Shift + Alt + DownArrow

Expected result:

  • line is duplicated up/down

Actual result:

  • nothing happens

Workaround:

  • run the command from the command palette

Most helpful comment

@mirao You can also rebind them in File > Preferences > Keyboard Shortcuts. E.g.:

{ "key": "shift+alt+down",        "command": "editor.action.copyLinesDownAction",
                                     "when": "editorTextFocus" },
{ "key": "shift+alt+up",          "command": "editor.action.copyLinesUpAction",
                                     "when": "editorTextFocus" },

All 8 comments

@mirao You can also rebind them in File > Preferences > Keyboard Shortcuts. E.g.:

{ "key": "shift+alt+down",        "command": "editor.action.copyLinesDownAction",
                                     "when": "editorTextFocus" },
{ "key": "shift+alt+up",          "command": "editor.action.copyLinesUpAction",
                                     "when": "editorTextFocus" },

VSCode Version: 1.8.1
Has same problem.

There are a number of reasons why certain keybindings would not reach VS Code. e.g.: the OS binds OS functionality to them, other installed sofware "captures and steals" them, etc.

It is your responsibility to manage your system and identify what sofware / OS setting causes this behaviour. If we don't receive a keybinding, there is nothing we can do about it.

To find out if a keybinding arrives in VS Code:

  1. Open Preferences > Keyboard Shortcuts
  2. Click on Define Keybinding
  3. Press your desired key combination
    (e.g. doing it for Ctrl+Shift+1):
    image
  4. If the key combination does not reflect what you press or shows "unknown", it means VS Code is not receiving these key down events.

Rebinding a command to a different keybinding

  1. Identify the keybinding you would like to rebind (e.g:)
{ "key": "ctrl+shift+1",          "command": "editor.action.replaceOne",
                                     "when": "editorFocus && findWidgetVisible" },
  1. Copy paste it to your keybindings.json with a different "key" that does make its way to VS Code:
{ "key": "ctrl+shift+2",          "command": "editor.action.replaceOne",
                                     "when": "editorFocus && findWidgetVisible" },

@alexandrudima : Yes, that's the case on my Ubuntu, I get "unknown" for arrow in such combination (Ctrl + Shift + Alt + unknown).
Is the reported combination working on some Linux distro ? Because if not, it shouldn't be offered as a default on Linux.

I can confirm that the remapped combination shift+alt+down and shift+alt+down works well and I have been using it for long time in VScode on Win/Linux.

@mirao It is difficult to find default keybindings that work across all distributions. But that is why all our keybindings are configurable.

If you would like to help, you can look into creating a good PR for #509 or create a keymap extension that targets a specific distribution (e.g. of a keymap extension https://github.com/Microsoft/vscode-sublime-keybindings).

Removing 'bug' label as it doesn't look like we made a change for this?

Shift+ctrl+alt+(up, down, left, right) are reserved shortcuts on Ubuntu for moving windows to different workspaces. Disabling those will enable default vscode shortcuts to work as expected.

I changed it mine in ubuntu as shown below

C + A + S + - instead of C + S+ A+ Down Arrow
C + A+ S + = instead of C + S + A + Up Arrow

Was this page helpful?
0 / 5 - 0 ratings

Related issues

borekb picture borekb  路  3Comments

omidgolparvar picture omidgolparvar  路  3Comments

sirius1024 picture sirius1024  路  3Comments

trstringer picture trstringer  路  3Comments

VitorLuizC picture VitorLuizC  路  3Comments