資料來源:https://askubuntu.com/questions/412046/unable-to-use-intellij-idea-keyboard-shortcuts-on-ubuntu
讀過一些資料後我才意識到,IntelliJ IDEA 是一款「以鍵盤為中心」的 IDE——熟練的使用者幾乎可以完全不用滑鼠完成所有操作,前提當然是快捷鍵得先能用。我也找到了 keymap 的設定位置,但真正的問題出在 Ubuntu 系統層級的綁定搶走了 IDEA 需要的按鍵組合。
以下列出會與 IDEA 動作衝突的預設系統綁定(括號內為受影響的 IDEA 功能),逐一停用或改鍵即可:
Disable the Shade window action, assigned to Ctrl + Alt + S (Settings 設定對話框) Change or disable the Lock Screen action, Ctrl + Alt + L (Reformat code 重新格式化) Change or disable the Launch terminal action, Ctrl + Alt + T (Surround with 包圍) Change or disable the Switch to workspace action, Ctrl + Alt + Arrow Keys (Navigation 導航) Disable the Move window action, assigned to Alt + F7 (Find usages 尋找用法) Change or disable the Resize window action, Alt + F8 (Evaluate expression 求值)
在 Ubuntu 中,這些設定位於 System Settings → Keyboard → Shortcuts。找到對應的分類(視窗管理、系統、導航等),把衝突的項目設為 Disabled 或改成其他不常用的組合,然後回到 IDEA 就能正常使用。
如果改壞了也不必擔心,Ubuntu 可以隨時把快捷鍵還原成預設值,只要在同一頁面按下「Restore Default」即可。