Git Product home page Git Product logo

deoplete-mozc's Introduction

deoplete-mozc

sonomasakada

Mozc(Google日本語入力)の候補をVimの補完候補として出すプラグインです。

mozc_emacs_helperのインストール

macOS

まず、自分がインストールしているGoogle日本語のバージョンを調べる。バージョンはIMEのアイコンから「Google 日本語入力について」をクリックして調べる事ができる。

次に、ソースコードをチェックアウトする。それぞれのバージョンのソースコードのチェックアウト方法はmozc/release_history.md at master · google/mozcに書いてある。例えば、Google日本語のバージョンが2.20だった場合は以下のコマンドでチェックアウトする。

git clone https://github.com/google/mozc.git -b master --single-branch
cd mozc
git checkout 280e38fe3d9db4df52f0713acf2ca65898cd697a
git submodule update --init --recursive

コードを以下のように修正する

$ git diff
diff --git a/src/build_mozc.py b/src/build_mozc.py
index a7a534a4..f64dadf3 100644
--- a/src/build_mozc.py
+++ b/src/build_mozc.py
@@ -167,6 +167,8 @@ def GetGypFileNames(options):
   # Include subdirectory of win32 and breakpad for Windows
   if options.target_platform == 'Windows':
     gyp_file_names.extend(glob.glob('%s/win32/*/*.gyp' % SRC_DIR))
+  elif options.target_platform == 'Mac':
+    gyp_file_names.extend(glob.glob('%s/unix/emacs/*.gyp' % SRC_DIR))
   elif options.target_platform == 'Linux':
     gyp_file_names.extend(glob.glob('%s/unix/*/*.gyp' % SRC_DIR))
     # Add ibus.gyp if ibus version is >=1.4.1.
diff --git a/src/mac/mac.gyp b/src/mac/mac.gyp
index 7a843fb0..ba56d05d 100644
--- a/src/mac/mac.gyp
+++ b/src/mac/mac.gyp
@@ -585,7 +585,6 @@
             ['branding=="GoogleJapaneseInput"', {
               'dependencies': [
                 'DevConfirmPane',
-                'codesign_client',
               ],
             }],
           ],

コンパイルする。mac_sdk, mac_deployment_targetは自分のmacOSのバージョンに合わせる。

cd mozc/src
GYP_DEFINES="mac_sdk=10.13 mac_deployment_target=10.13" python build_mozc.py gyp --noqt --branding=GoogleJapaneseInput
python build_mozc.py build -c Release unix/emacs/emacs.gyp:mozc_emacs_helper

コマンドを打って、以下のように表示されればOK。

$ echo -e '(0 CreateSession)\n(1 SendKey 1 a)' | out_mac/Release/mozc_emacs_helper
((mozc-emacs-helper . t)(version . "2.20.2673.101")(config . ((preedit-method . roman))))
((emacs-event-id . 0)(emacs-session-id . 1)(output . ()))
((emacs-event-id . 1)(emacs-session-id . 1)(output . ((id . "9104245599720096124")(mode . hiragana)(consumed . t)(preedit . ((cursor . 1)(segment ((annotation . underline)(value . "
あ")(value-length . 1)(key . "あ")))))(candidates . ((size . 2)(candidate ((index . 0)(value . "ア")(annotation . ((description . "[全] カタカナ")))(id . 0))((index . 1)(value . "あ
")(annotation . ((description . "ひらがな")))(id . 1)))(position . 0)(category . suggestion)(display-type . main)(footer . ((label . "Tabキーで選択")))(page-size . 9)))(status . ((activated . t)(mode . hiragana)(comeback-mode . hiragana)))(all-candidate-words . ((candidates ((id . 0)(index . 0)(value . "ア")(annotation . ((description . "[全] カタカナ"))))((id . 1)(index . 1)(value . "あ")(annotation . ((description . "ひらがな")))))(category . suggestion))))))

もしも

互換性のない変換エンジンプログラムに接続しています。新しい Google 日本語入力を利用するためにコンピュータを再起動してください。問題が解決されない場合は、お手数ですが一度アンインストールしてから再インストールしてください。

というメッセージがポップアップで出てきたら、コンパイルしたバージョンが違うので、コンパイルし直す。

mozc_emacs_helperは適宜PATHの通った場所に置く。

設定

g:deoplete#sources#mozc#mozc_emacs_helper_path

mozc_emacs_helperのパスを設定します。環境変数PATHにあるディレクトリにおいてある場合は設定する必要はありません。

参考資料

謝辞

Mozc classのコードはyasuyuky/SublimeMozcInputのコードを参考にさせていただきました。

deoplete-mozc's People

Contributors

tmsanrinsha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

karchz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.