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

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


当前回答

操作系统:Mac

要启用重复键,请在终端中执行以下命令并重新启动VS Code:

$ defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false         # For VS Code
$ defaults write com.microsoft.VSCodeInsiders ApplePressAndHoldEnabled -bool false # For VS Code Insider
$ defaults write com.visualstudio.code.oss ApplePressAndHoldEnabled -bool false    # For VS Codium
$ defaults delete -g ApplePressAndHoldEnabled                                      # If necessary, reset global default

我们还建议增加系统首选项->键盘中的键重复和延迟直到重复设置。

这都在我们的自述文件https://github.com/VSCodeVim/Vim/blob/master/README.md#mac-setup

其他回答

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

defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false
defaults delete -g ApplePressAndHoldEnabled  # If necessary, reset global default
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

以上这些方法在我的新笔记本电脑上都不适用,相反,我必须使用:

defaults write -g ApplePressAndHoldEnabled -bool false

如果在mac上,你应该参考扩展的mac特定说明:https://github.com/VSCodeVim/Vim#mac

目前(2022年8月),它说:

要启用密钥重复,请在终端中执行以下命令,注销并重新登录,然后重新启动VS Code:

$ defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false              # For VS Code
$ defaults write com.microsoft.VSCodeInsiders ApplePressAndHoldEnabled -bool false      # For VS Code Insider
$ defaults write com.visualstudio.code.oss ApplePressAndHoldEnabled -bool false         # For VS Codium
$ defaults write com.microsoft.VSCodeExploration ApplePressAndHoldEnabled -bool false   # For VS Codium Exploration users
$ defaults delete -g ApplePressAndHoldEnabled                                           # If necessary, reset global default

我们还建议增加系统首选项->键盘中的键重复和延迟直到重复设置。

操作系统:Mac

要启用重复键,请在终端中执行以下命令并重新启动VS Code:

$ defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false         # For VS Code
$ defaults write com.microsoft.VSCodeInsiders ApplePressAndHoldEnabled -bool false # For VS Code Insider
$ defaults write com.visualstudio.code.oss ApplePressAndHoldEnabled -bool false    # For VS Codium
$ defaults delete -g ApplePressAndHoldEnabled                                      # If necessary, reset global default

我们还建议增加系统首选项->键盘中的键重复和延迟直到重复设置。

这都在我们的自述文件https://github.com/VSCodeVim/Vim/blob/master/README.md#mac-setup