我使用vim插件,我通常通过按住j来滚动vim。在VSCode中,按住j只做一个j命令,不管它保持了多长时间。

即使在vanilla vscode中,这也不能工作-如果你试图输入###########################的长块作为注释分隔符,这是有问题的。你知道如何启用这个功能吗?


当前回答

Though I reset with above mentioned commands and even after reboot, Once I open
VSCode they are getting reset, so I had 'code' script to set them back
every time I open VSCode editor.

 $ cat code
VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $* &
defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false
defaults delete -g ApplePressAndHoldEnabled

其他回答

由于全局设置,Steve上面的回答对我不太适用。这也让我很好奇在哪里可以找到一个应用程序的com.microsoft.VScode域名。下面是对我有用的方法和一个通用的公式:

要为特定的应用(如VSCode)启用repeat,首先要确保没有覆盖全局设置。

默认delete -g ApplePressAndHoldEnabled

然后启用特定应用程序的设置,您可以通过在信息中找到应用程序的域名。plist文档在其安装的Contents文件夹下。

例子

<key>CFBundleIdentifier</key>
<string>com.microsoft.VSCode</string>

然后在命令行中进行设置。

默认写com.microsoft.VSCode ApplePressAndHoldEnabled -bool false

你也可以在其他应用程序的特定设置中使用这个模式。只要确保你的设置没有被全局覆盖。

有关默认值的更多信息,请键入默认值帮助。另外需要注意的是,如果您的用户已经是管理员,则不需要以sudo的方式运行此命令。

Though I reset with above mentioned commands and even after reboot, Once I open
VSCode they are getting reset, so I had 'code' script to set them back
every time I open VSCode editor.

 $ cat code
VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $* &
defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false
defaults delete -g ApplePressAndHoldEnabled

为了我的M1 MacBook Pro,我不得不跑路

sudo defaults write -g ApplePressAndHoldEnabled -bool false

就像苹果头说的那样

然后不得不重新启动/重新登录Mac。然后它开始正常工作。

VS Code的官方vim-plugin提到了如何在macOS上设置它

defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false
defaults delete -g ApplePressAndHoldEnabled  # If necessary, reset global default

史蒂夫的最佳答案并不适用于我的mac '默认写com.microsoft.VSCode ApplePressAndHoldEnabled -bool false',但下面对我有用:

sudo defaults write -g ApplePressAndHoldEnabled -bool false

参考:https://github.com/VSCodeVim/Vim/issues/345