在Ubuntu上有些VSCode快捷键无法使用

14

我刚在Ubuntu上开始使用VSCode,并寻找与Mac上的Sublime中cmd+shift+D相当的功能(复制所选文本)。根据文档,我应该使用Ctrl+Shift+Alt+DownCtrl+Shift+Alt+Up,但这些键绑定对我不起作用。当我查看文件>首选项>键盘快捷键时,我看到了定义,但当我尝试使用它们时,没有任何反应。


不幸的是,当Windows用户打开链接时,他们会看到不同的按键绑定。我认为最好添加命令ID,例如editor.action.insertLineBefore。 然而,也许快捷键被全局覆盖了?如果您为要查找的命令定义自定义快捷键会发生什么呢? - Wosi
我已经尝试将定义复制到我的 keybindings.json 中,但快捷键仍然无法工作。有趣的是,如果我将快捷键更改为 Ctrl+Shift+Down,它就可以工作了!我想知道Ubuntu是否会因为同时按下太多键而感到困惑(就像我一样) :) - kpg
我也遇到了Alt+Shift+Down的问题(Shift键无法工作)! - Hamidreza
你是否有一款非美国键盘,其中一些键盘代码映射到不同的按键上? - tripleee
3个回答

12

Ubuntu使用这些快捷键来管理工作区。

您可以在“设置” -> “键盘” -> “查看和自定义快捷方式”中查找这些键绑定。

如果没有设置任何 Ctrl+Shift+Alt+*,您可以检查 gsettings

以下命令应该会找到绑定了使用 Up 键的组合键:

gsettings list-recursively | grep Up

在我这个案例中,有一些东西会干扰VS Code:

org.gnome.desktop.wm.keybindings move-to-workspace-up ['<Control><Shift><Alt>Up']
org.gnome.desktop.wm.keybindings switch-to-workspace-up ['<Control><Alt>Up']

按下键是一样的。

总之你可以通过以下命令取消它们:

gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-up "[]"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-down "[]"
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-up "[]"
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-down "[]"

如果您想将它们重置回默认值:

gsettings reset org.gnome.desktop.wm.keybindings switch-to-workspace-up
gsettings reset org.gnome.desktop.wm.keybindings switch-to-workspace-down
gsettings reset org.gnome.desktop.wm.keybindings move-to-workspace-up
gsettings reset org.gnome.desktop.wm.keybindings move-to-workspace-down

4

检查默认按键绑定,我发现 editor.action.insertCursorAboveeditor.action.insertCursorDown 各自都有两个按键绑定:ctrl+shift+up/downalt+shift+up/down

因此,我将 editor.action.copyLinesDownActioneditor.action.copyLinesUpAction 分别更改为 ctrl+shift+upctrl+shift+down。因为在我的Ubuntu系统中,ctrl+shift+alt+up/down 键会切换工作区。


-1

Ctrl+Shift+上箭头和Ctrl+Shift+下箭头可以使用。 检查您的VS键盘快捷方式: 单击设置图标>键盘快捷方式 输入图像描述


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接