Skip to content

Instantly share code, notes, and snippets.

@SAW4
Last active December 4, 2017 07:46
Show Gist options
  • Save SAW4/c12e29ea76d8cd66a78e41ff7b454099 to your computer and use it in GitHub Desktop.
Save SAW4/c12e29ea76d8cd66a78e41ff7b454099 to your computer and use it in GitHub Desktop.
Sublime Text 3 imfix ( Fictix IM ) with SAKURA Terminal

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 :
 gcc -shared -o libsublime-imfix.so sublime_imfix.c  `pkg-config --libs --cflags gtk+-2.0` -fPIC
  1. Copy the .so lib to /opt/sublime_text
  2. Update subl in /usr/bin/ with following contents:
#!/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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment