coc-mozc
Mozc input method source for coc.nvim. It shows mozc suggestion to COC's completion list.
Why
In terminal, it is hard to input Japanese with OS standard IME. With coc-mozc, you can input Japanese just like code suggestion.
Install
Prerequisite
mozc_emacs_helper
is required!
For ubuntu:
sudo apt-get install emacs-mozc
CocInstall
Install coc-mozc via :CocInstall coc-mozc
Example settings
" Selects the first prediction by pressing Enter, meaning insert ひらがな
autocmd User MozcEnabled execute('inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm() : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"')
autocmd User MozcDisabled execute('inoremap <cr> <cr>')
" C-j toggles mozc mode
inoremap <expr> <C-j> execute(':CocCommand mozc.toggle')
" Disable mozc when insert leave
au InsertLeave * execute(':CocCommand mozc.disable')
Known Issues & TODO
- Unable to convert partially
- Ideally, cursor movement should trigger partial conversion
- No undo conversion feature
- SPACE should trigger conversion Kana to Kanji
Inspired By
- https://github.com/tonyfettes/coc-rime/blob/master/src/index.ts
- https://github.com/yasuyuky/SublimeMozcInput
License
MIT
This extension is built with create-coc-extension