我刚刚开始在 Ubuntu 上使用 VSCode,并正在寻找 Mac 上 Sublime 中的
cmd+shift+D
的等效项(重复选定的文本)。根据 the docs 我应该使用 Ctrl+Shift+Alt+Down
或 Ctrl+Shift+Alt+Up
但这些键绑定对我不起作用。当我查看 File > Preferences > Keyboard Shortcuts
时,我看到了定义,但是当我尝试使用它们时,没有任何反应。
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']
Down
键也是如此。
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
检查我的默认键绑定后,我发现 editor.action.insertCursorAbove 和 editor.action.insertCursorDown 每个都有两个键绑定 ctrl+shift+上/下 和 alt+shift+上/下。
所以我将 editor.action.copyLinesDownAction 和 editor.action.copyLinesUpAction 分别更改为 ctrl+shift+up 和 ctrl+shift+down 。因为在我的 ubuntu 系统中 ctrl+shift+alt+up/down 键正在切换工作区。
我能够通过禁用所有工作区快捷方式来解决此问题,这些快捷方式会覆盖
ctrl+alt+left
等:
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 switch-to-workspace-left "[]"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-right "[]"
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-up "[]"
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-down "[]"
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-left "[]"
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-right "[]"
Ctrl+衬衫+向上和Ctrl+衬衫+向下即可。 检查你的 VS 键盘快捷键: 单击设置图标>键盘快捷键 在此输入图片描述