The Chinese input problem of sublime text under Linux

Source: Internet
Author: User
Tags gtk sublime text

At night after the reference on-line solution, practice a bit, solve the sublime in Linux under the Chinese input problem


1: Switch to the ~ directory
and create a new sublime_imfix.c file

Touch sublime_imfix.c

2: Edit the Sublime_imfix.c file

Gedit sublime_imfix.c

Copy the following code into the open gedit

 #include &NBSP;<GTK/GTKIMCONTEXT.H>VOID&NBSP;GTK _im_context_set_client_window  (gtkimcontext *context,          gdkwindow    *window) { gtkimcontextclass *klass; g_return_if_ fail  (gtk_is_im_context  (context)); klass = gtk_im_context_get_class  (context);  if  (Klass->set_client_window)    klass->set_client_window  (context,  window);  g_object_set_data (G_object (context), "window", window);  if (! gdk_is_window  (WINDOW))    return; int width = gdk_window_get_width ( window);  int height = gdk_window_get_height (window);  if (width != 0  && height !=0)    gtk_im_context_focus_in (context);} 

3: Compile the copied code file sublime_imfix.c to libsublime-imfix.so file.

CD ~gcc-shared-o libsublime-imfix.so sublime_imfix.c ' pkg-config--libs--cflags gtk+-2.0 '-fPIC

To this step there might be a mistake saying what "gtk/gtkimcontext.h: No file or directory"

At this point you open a new terminal to execute apt-get install Libgtk2.0-dev


4: Next execution

Gcc-shared-o libsublime-imfix.so sublime_imfix.c ' pkg-config--libs--cflags gtk+-2.0 '-fPIC

5: then copy the compiled libsublime-imfix.so file to the folder where Sublime_text is located.

sudo mv libsublime-imfix.so/opt/sublime_text/

6: Modify the contents of a file/usr/bin/subl

sudo gedit/usr/bin/subl

will be #!/bin/sh

Exec/opt/sublime_text/sublime_text "[Email protected]"

Replaced by

#!/bin/sh

ld_preload=/opt/sublime_text/libsublime-imfix.so exec/opt/sublime_text/sublime_text "[Email protected]"


7:: You also need to modify the contents of the file Sublime_text.desktop.

sudo gedit/usr/share/applications/sublime_text.desktop

Set the string in [Desktop Entry]

Exec=/opt/sublime_text/sublime_text%F

Revision changed to

Exec=bash-c "ld_preload=/opt/sublime_text/libsublime-imfix.so exec/opt/sublime_text/sublime_text%F"

string in [Desktop Action Window]

Exec=/opt/sublime_text/sublime_text-n

Revision changed to

Exec=bash-c "Ld_preload=/opt/sublime_text/libsublime-imfix.so exec/opt/sublime_text/sublime_text-n"

string in [Desktop Action Document]

Exec=/opt/sublime_text/sublime_text--command New_file

Revision changed to

Exec=bash-c "ld_preload=/opt/sublime_text/libsublime-imfix.so exec/opt/sublime_text/sublime_text--command New_ File


8: Finally, finally, best, open sublime, switch to Chinese input, try


10:shutdown-h now

Sleep, sleep , sleep.

The Chinese input problem of sublime text under Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.