标签:
转载自 http://doc.polarwin.cn/tutorial/Ubuntu_sublime3_chinese_input.html
-------------本文完全复制的上面的文章--------------------
首先添加源:
sudo add-apt-repository ppa:webupd8team/sublime-text-3
然后更新:
sudo apt-get update
然后安装:
sudo apt-get install sublime-text-installer
首先安装必需的软件包:
sudo apt-get install build-essential libgtk2.0-dev
然后建立一个名为sublime_imfix.c的c文件,内容如下:
#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); }
然后进行编译:
gcc -shared -o libsublime-imfix.so sublime_imfix.c `pkg-config --libs --cflags gtk+-2.0` -fPIC
然后将libsublime-imfix.so拷贝到sublime_text所在文件夹:
sudo mv libsublime-imfix.so /opt/sublime_text/
修改/usr/bin/subl 文件:
sudo vim /usr/bin/subl
内容如下:
LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so exec /opt/sublime_text/sublime_text "$@"
然后进入目录/usr/share/applications/,修改文件sublime-text.desktop:
sudo vim /usr/share/applications/sublime-text.deskto
将Exec=/opt/sublime_text/sublime_text %F 修改为:
Exec=bash -c "LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so exec /opt/sublime_text/sublime_text %F"
将Exec=/opt/sublime_text/sublime_text –n修改为:
Exec=bash -c "LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so exec /opt/sublime_text/sublime_text -n"
将Exec=/opt/sublime_text/sublime_text –command new_file修改为:
Exec=bash -c "LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so exec /opt/sublime_text/sublime_text --command new_file"
同样的将/opt/sublime_text路径下的sublime_text.desktop按照相同的方式修改。
Preferences菜单Settings-User: {
“font_face”: “Courier New”, “font_size”: 14.0
}
标签:
原文地址:http://my.oschina.net/denglz/blog/526153