1

I am trying to get this pinyin keymap to load into vim.

I have placed this file into ~/.vim/keymap/pinyin.vim.

Questions

  1. How do I load this file automatically through a command in ~/.vimrc?
  2. How do I turn this mode on/off?
  3. How do I actually invoke these keymappings?

Answer

FDinoff's suggestion below is perfect. What I did on Mavericks was update to Snapshot 73 Vim 7.4.258, mv the old vim to /tmp and mv mvim to /usr/bin/mvim, create a symbolic link and I was all set.

Community
  • 1
  • 1
kfmfe04
  • 14,936
  • 14
  • 74
  • 140

1 Answers1

2

This file is already part of the vim runtime so you don't need to include it yourself.

You can change what keymap you are using by using set keymap=pinyin. You can turn it off with set keymap=

To invoke the key mappings just type them literally in insert mode.

So for example typing a2 will get you á

Take a look at :h keycap (Note this feature requires vim has been compiled with the keymap feature)

FDinoff
  • 30,689
  • 5
  • 75
  • 96
  • ty - this worked great in Ubuntu under vim 7.4, but fails in OSX under vim 7.3 - I suspect that the vim install on OSX somehow doesn't include that `pinyin.vim` file. I'm trying to diff the installs to see what is going on... – kfmfe04 Jul 02 '14 at 03:52
  • @kfmfe04 just see if the file `$VIMRUNTIME/keymap/pinyin.vim` exists. – FDinoff Jul 02 '14 at 03:53
  • I just tried `:!echo $VIMRUNTIME` within vim and found that, indeed, pinyin.vim is missing for OSX. After copying the file over to OSX, it still doesn't work. Maybe I need to update some other `.vim` file? – kfmfe04 Jul 02 '14 at 04:03
  • @kfmfe04 is vim compiled with `keycap`? `echo has("keymap")` should return 1. Or check the output of `vim --version for `+keymap` (`-` means it is not compiled). If not you need to recompile vim. – FDinoff Jul 02 '14 at 04:05
  • that's it - tyvm - `:version` from within vim shows `-keymap` - I will look for the source and recompile it myself with keymap. – kfmfe04 Jul 02 '14 at 04:10
  • @kfmfe04 It might be faster to download macvim and use the version of that it comes with. – FDinoff Jul 02 '14 at 04:12