问题描述
如果您有选择,cut
(Ctrl+X) 将复制和删除选择.如果没有,它会复制整行并删除它.
If you have a selection, cut
(Ctrl+X) will copy and delete the selection. If not, it will copy the whole line and delete it.
我想禁用后者.它接近 save
(Ctrl+S),我不想在保存时删除整行.
I want to disable the latter. It is close to save
(Ctrl+S) and I don't want to delete my whole line when I want to save.
VSCode中cut
快捷键(Ctrl+X)的切线功能可以关闭吗?
Can you disable the cut line function of cut
shortcut (Ctrl+X) in VSCode?
在
cut
中添加when
子句:editorHasSelection
:
Keyboard Shortcuts
菜单如下所示:
我的keybindings.json
:
[
{
"key": "ctrl+x",
"command": "editor.action.clipboardCutAction",
"when": "editorHasSelection"
},
{
"key": "ctrl+x",
"command": "-editor.action.clipboardCutAction"
}
]
保存并重新打开 VSCode 后,cut
还是一样.
After saving and reopening VSCode, cut
still works the same.
从 keybindings.json
中删除第二个快捷方式:
Remove the second shortcut from keybindings.json
:
我的keybindings.json
:
[
{
"key": "ctrl+x",
"command": "editor.action.clipboardCutAction",
"when": "editorHasSelection"
}
]
Keyboard Shortcuts
菜单更改为:
保存并重新打开 VSCode 后,cut
还是一样.
After saving and reopening VSCode, cut
still works the same.
- Ubuntu 20.04
- Visual Studio Code 1.55.2 版
- 在代码上重新创建 - Insiders 1.56.0-insider (13f1aff, 2021-04-28T04:52:56.570Z)
推荐答案
这是一个错误,现在已修复并从 1.56.0 发布 (问题).
This was a bug which is now fixed and released as of 1.56.0 (Issue).
alexdima 来自 VSCode 团队的回应是:
alexdima from VSCode team's response is:
ctrl+x
只是特殊的,需要绑定到无操作以停止默认值.我添加了一个什么都不做的 noop
命令.
{
"key": "ctrl+x",
"command": "noop"
},
{
"key": "ctrl+x",
"command": "editor.action.clipboardCutAction",
"when": "editorHasSelection"
}
这篇关于VSCode 中的剪切快捷键(Ctrl+X)的剪切线功能可以关闭吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!