Sublime 4/Vintage模式:仅在编辑模式下启用按键按住重复功能
Mac下Sublime Vim模式兼容按键重复与重音字符的解决方案
方案1:仅Sublime全局支持按键按住重复
- 打开终端,执行命令:
defaults write com.sublimetext.ApplePressAndHoldEnabled -bool false - 重启Sublime Text后,在Sublime内按住任意键都会触发重复(包括Vim模式的h/j/k/l快速移动),其他Mac应用仍可正常按住键调出重音字符。
方案2:仅对h/j/k/l启用按住重复
通过自定义Sublime Vintage(Vim模式)的键绑定实现:
- 打开
Preferences > Settings,添加以下配置:"vintage_use_ctrl_keys": true, "vintage_start_in_command_mode": true - 打开
Preferences > Key Bindings,添加以下键绑定规则:[ { "keys": ["h"], "command": "move", "args": {"by": "characters", "forward": false}, "context": [{"key": "setting.command_mode"}] }, { "keys": ["j"], "command": "move", "args": {"by": "lines", "forward": true}, "context": [{"key": "setting.command_mode"}] }, { "keys": ["k"], "command": "move", "args": {"by": "lines", "forward": false}, "context": [{"key": "setting.command_mode"}] }, { "keys": ["l"], "command": "move", "args": {"by": "characters", "forward": true}, "context": [{"key": "setting.command_mode"}] } ] - 终端执行以下命令并重启Sublime:
完成后,仅Vim命令模式下的h/j/k/l按住会触发重复移动,其他按键在编辑模式下仍可正常调出重音字符。defaults write com.sublimetext.ApplePressAndHoldEnabled -bool false
内容的提问来源于stack exchange,提问作者Spearfisher
相关产品推荐
相关产品推荐

