VSCode 中的剪切快捷键(Ctrl+X)的剪切线功能可以关闭吗? [英] Can you disable the cut line function of cut shortcut (Ctrl+X) in VSCode?

查看:107
本文介绍了VSCode 中的剪切快捷键(Ctrl+X)的剪切线功能可以关闭吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您有选择,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 命令.

ctrl+x is just special and needs to be bound to a no-op to stop the default. I have added a noop command that does nothing.


    {
        "key": "ctrl+x",
        "command": "noop"
    },
    {
        "key": "ctrl+x",
        "command": "editor.action.clipboardCutAction",
        "when": "editorHasSelection"
    }

这篇关于VSCode 中的剪切快捷键(Ctrl+X)的剪切线功能可以关闭吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆