itgoyo / 500Days-Of-Github

⭐ 瞎JB折腾Mac/Linux/Windows过程中遇到的所有问题和解决方式 ⭐
https://itgoyo.github.io/500Days-Of-Github
139 stars 13 forks source link

Vim完美解决了normal和insert切换时候的输入法问题 #197

Open itgoyo opened 4 years ago

itgoyo commented 4 years ago

https://zhuanlan.zhihu.com/p/49411224

git clone https://github.com/myshov/xkbswitch-macosx
cp xkbswitch-macosx/bin/xkbswitch /usr/local/bin
git clone https://github.com/myshov/libxkbswitch-macosx
cp libxkbswitch-macosx/bin/libxkbswitch.dylib /usr/local/lib/
install plugin: https://github.com/lyokha/vim-xkbswitch
itgoyo commented 4 years ago
Plugin 'lyokha/vim-xkbswitch'

let g:XkbSwitchLib = '/usr/local/lib/libxkbswitch.dylib'

let g:XkbSwitchEnabled = 1
let g:XkbSwitchIMappings   = ['cn']
  let g:XkbSwitchIMappingsTr = {'cn': {'<': '', '>': ''}}

  " gVim 在我的笔记本上切换到中文输入法(QQ 五笔)时,默认还是英文状态
  " 加上这两行配置可以解决,原因未知,如果没遇到这个问题,可以不加
  if !has('nvim') && has('win32') && has('gui_running')
    autocmd InsertEnter * set iminsert=2
  endi

这样子配置就可以自动默认执行了