在使用vscode 或者jupyterlab的时候,可能会习惯将编辑器的键盘布局映射为vim的,但出现了一个问题,macbook的长按‘hjkl’移动光标的功能好像不能用了,想要移动光标只能一下一下的敲,非常不方便,全局开启\关闭和分应用开启\关闭这个功能的方法如下:
# 全局开启
>>> defaults write -g ApplePressAndHoldEnabled -bool false
# 全局关闭
>>> defaults write -g ApplePressAndHoldEnabled -bool true
# vscode开启
>>> defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false
>>> defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool true
# firefox开启
>>> defaults write org.mozilla.firefox ApplePressAndHoldEnabled -bool false
# firefox关闭
>>> defaults write org.mozilla.firefox ApplePressAndHoldEnabled -bool true
那么另一个问题来了,命令中com.microsoft.VSCode、org.mozilla.firefox这些怎么知道呢?
这就需要导出defaults文件,在里面找
# 导出
>>> defaults read > defaults.txt
还有就是强烈建议修改mac的键盘设置,你会发现键盘的打字速度和以前相比简直快得飞起!!!
参考:
https://www.theguild.nl/how-to-enable-or-disable-the-press-and-hold-menu-in-mac-os-x/
http://blog.fireyang.com/2018/01/16/mac-visual-studio-code-vim-hold-key-bug/