# Sublime Text 3 imfix & fix with Terminal plugin problem ## How to apply imfix? Get the source from here, it should be the most complete one (with cursor follow fix): https://github.com/lyfeyaj/sublime-text-imfix , then just follow the guide to install (no need to compile) If you want to DO IT BY YOURSELF, then follow the instructions below: 1. COPY the src code from the link above (the sublime-imfix.c file), save as `sublime-imfix.c`, whatever. 2. Install the gtk2 build tools. 3. Compile the code : ```bash gcc -shared -o libsublime-imfix.so sublime_imfix.c `pkg-config --libs --cflags gtk+-2.0` -fPIC ``` 4. Copy the .so lib to /opt/sublime_text 5. Update `subl` in /usr/bin/ with following contents: ```bash #!/bin/sh export LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so exec /opt/sublime_text/sublime_text "$@" # The '$@' sign here is important, for direct open file by double clicking file icon ``` ## Further Problem : Termainl fail to launch after imfix preload Since the imfix .so lib is compile with gtk2, if you use Terminal plugin or call a terminal (e.g. SAKURA) from build system, it will be fail and system will notify you gtk2 and gtk3 lib cannot be used in same process. ### Solution: Open config of Terminal plugin `Terminal.sublime-settings`, add : ` "env": {"LD_PRELOAD": null} // Unset LD_PRELOAD because it may cause problems for sublime with imfix` Reference : https://www.zhihu.com/question/39397539 http://html5beta.com/page/ubuntu-14-04-install-fcitx-sougoupinyin-sublime-text-3-chinese-input-fix.html