1. First download the sogou Input Method
Http://pinyin.sogou.com/linux/
See the following article for help: http://pinyin.sogou.com/linux/help.php
2. then install sublime Text 3
Download idea.
3. Install related dependent Software
sudo apt-get install build-essential libgtk2.0-dev
4. Start to enable sublime to support Chinese input methods.
Prerequisites: this experience is in the Ubuntu kylin14.04 environment. You have installed sogou Input Method for Linux and sublime Text 3 on your computer.
[Email protected]: Cd ~ [Email protected]: Touch sublime_imfix.c (Be sure to underline, rather than horizontal bars)
5. paste the following code into the sublime_imfix.c file (Be sure to paste it all, especially after the paste, the first statement may not be complete)
#include <gtk/gtkimcontext.h>
void 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);
}
6. Compile the above files
[email protected] : cd <pre name="code" class="plain"> [email protected]: <em><strong>gcc -shared -o libsublime-imfix.so sublime_imfix.c `pkg-config --libs --cflags gtk+-2.0` -fPIC</strong></em>
7. After the compilation is successful, execute the following command to move the fileLibsublime-imfix.soCopySublime_textFolder
[email protected]:sudo mv libsublime-imfix.so /opt/sublime_text/
8. Modify the file/usr/bin/subl content
sudo gedit /usr/bin/subl
Set
#! /Bin/sh
Exec/opt/sublime_text "[email protected]"
Change
#! /Bin/sh
Ld_preload =/opt/sublime_text/libsublime-imfix.so exec/opt/sublime_text "[email protected]"
In this case, execute
SublYou can use Chinese input from sogou for Linux
9. To enable Chinese input when right-clicking a file, you also need to modify the content of the file sublime_text.desktop.
//command
sudo gedit /usr/share/applications/sublime_text.desktop
// The string in [Desktop Entry]
Exec = / opt / sublime_text / sublime_text% F
//change into
Exec = bash -c "LD_PRELOAD = / opt / sublime_text / libsublime-imfix.so exec / opt / sublime_text / sublime_text% F"
// The string in [Desktop Action Window]
Exec = / opt / sublime_text / sublime_text -n
//change into
Exec = bash -c "LD_PRELOAD = / opt / sublime_text / libsublime-imfix.so exec / opt / sublime_text / sublime_text -n"
// The string in [Desktop Action Document]
Exec = / opt / sublime_text / sublime_text --command new_file
//change into
Exec = bash -c "LD_PRELOAD = / opt / sublime_text / libsublime-imfix.so exec / opt / sublime_text / sublime_text --command new_file"
// Note: Please pay attention to double quotes "" when modifying, otherwise it will not be possible to open files with blank file names.
// Only modified /usr/share/applications/sublime-text.desktop here, but it can be used normally.
// The sublime-text.desktop in the opt / sublime_text / directory can be modified or not.
10. Haha, log out of your machine through the above steps, and then you will be surprised to find that sublime can enter Chinese, and it is still sogou's oh, dear !!!
Install sublime Text 3 in Ubuntu kylin14.04 and support Chinese Input