visual-studio-code

Assign keyboard shortcut to `cut`


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?


Solution

  • 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.