如何解決在 MacOS VS Code/Cursor 按鍵無法連續輸入的問題
前言
筆者已經習慣 vim 的輸入模式。所以在使用 VS Code 或 Cursor 時,會安裝 vim 輸入模式的外掛。在鍵盤按鍵接住時,這些編輯器卻不會連續輸入。本文主要就是要來解決這個問題。
主要內容
解決方式
針對 VS Code
1defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false
針對 Cursor
1defaults write com.todesktop.230313mzl4w4u92 ApplePressAndHoldEnabled -bool false
如何找出應用程式的 Bundle Identifier
如果你不確定某個應用程式的 Bundle Identifier,可以使用 osascript
指令來查詢:
1osascript -e 'id of app "應用程式名稱"'
例如查詢 Cursor 的 Bundle Identifier:
1osascript -e 'id of app "Cursor"'
2# 輸出:com.todesktop.230313mzl4w4u92
如果要復原的話,則只要改成 true
就可以了。
VS Code 復原:
1defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool true
Cursor 復原:
1defaults write com.todesktop.230313mzl4w4u92 ApplePressAndHoldEnabled -bool true