Skip to content

Instantly share code, notes, and snippets.

@oguna
Last active May 19, 2018 04:45
Show Gist options
  • Select an option

  • Save oguna/7de4e2a45ee13e66b694bcc94482fdbc to your computer and use it in GitHub Desktop.

Select an option

Save oguna/7de4e2a45ee13e66b694bcc94482fdbc to your computer and use it in GitHub Desktop.
Vim8のchannel機能を用いたMigemoプラグイン
scriptencoding utf-8
let g:migemo_path = $VIM . '/cmigemo.exe'
let g:migemo_dict_path = $VIM . '/dict/utf-8/migemo-dict'
if executable(g:migemo_path) == '0'
echo "Error: cmigemo is not installed"
endif
if !filereadable(g:migemo_dict_path)
echo "Error: a dictionary for migemo is not found"
endif
let migemo_args = '-v -n -q -d ' . g:migemo_dict_path
let migemo_job = job_start(g:migemo_path . ' ' . migemo_args)
let migemo_channel = job_getchannel(migemo_job)
func MigemoSearch(channel)
let word = input('MIGEMO:')
let pattern = ch_evalraw(a:channel, word . "\n")
call search(pattern)
endfunc
:nmap z :call MigemoSearch(migemo_channel)<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment