admin管理员组

文章数量:1122832

While customizing VSCode's keyboard shortcuts, somehow I removed the shortcut for cut. Now I don't know what shortcut it is.

I assigned ctrl+x to editor.action.clipboardCutAction, cut, and default:cut, but still I can't cut a text with ctrl+x. When I select a text and press ctrl+x, it removes the text, but the text is not in the clipboard

Also, in the edit menu, there's no shortcut in front of the cut. (copy and paste have their default shortcuts.)

What command is the cut in VSCode?

While customizing VSCode's keyboard shortcuts, somehow I removed the shortcut for cut. Now I don't know what shortcut it is.

I assigned ctrl+x to editor.action.clipboardCutAction, cut, and default:cut, but still I can't cut a text with ctrl+x. When I select a text and press ctrl+x, it removes the text, but the text is not in the clipboard

Also, in the edit menu, there's no shortcut in front of the cut. (copy and paste have their default shortcuts.)

What command is the cut in VSCode?

Share Improve this question edited yesterday Uwe Keim 40.7k61 gold badges185 silver badges302 bronze badges asked yesterday AidinAidin 1,35315 silver badges20 bronze badges 2
  • 1 Use the keyboard troubleshooting (command palette: Developer: Toggle Keyboard Shortcuts Troubleshooting) to test what keys are being matched to what commands in your case. To me it seems you have the right action - but is it really being invoked? – topsail Commented yesterday
  • The command is cut, to check that, you can select your text and call the command cut via the command palette (I just tried, and the text is well copied on the clipboard). To remap the keybind, you can investigate like @topsail wrote to check if the command you defined is called when you press ctrl+x. – vimchun Commented yesterday
Add a comment  | 

1 Answer 1

Reset to default 0

Thanks to the comment of @topsail, I've found the issue. I opened the command palette and entered Developer: Toggle Keyboard Shortcuts Troubleshooting. It showed me that ctrl+x is invoking default:cut command. The File -> Preferences -> Keyboard Shortcuts listed its source as user. I removed that, and a cut command (all lowercase) again with source=user.

Now ctrl+x invokes Cut (with capital C) which cuts the text correctly.

I'm not sure where those default:cut and cut commands came from. Maybe when I upgraded from a very old VSCode version? Because I wasn't using VSCode in a while, and just upgraded it.

本文标签: visual studio codeAssign keyboard shortcut to cutStack Overflow