Sublime3【插件】

1.Package Control

https://packagecontrol.io/installation

2.MarkdownEditing 通过Package Control安装

https://packagecontrol.io/packages/MarkdownEditing#package-control

3.Markdown Preview 通过Package Control安装

https://packagecontrol.io/packages/Markdown%20Preview

4.sublime中文输入法

  • 1.安装好搜狗输入法 for Linux和Sublime Text 3
  • 2.~目录下创建文件 sudo vi sublime_imfix.c,内容如下
#include 
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);
}
  • 3.安装编译依赖
sudo apt-get install build-essential
sudo apt-get install libgtk2.0-dev
  • 4.将上一步的代码编译成共享库libsublime-imfix.so
cd ~
gcc -shared -o libsublime-imfix.so sublime_imfix.c  `pkg-config --libs --cflags gtk+-2.0` -fPIC
  • 5.然后将libsublime-imfix.so拷贝到sublime_text所在文件夹
sudo mv libsublime-imfix.so /opt/sublime_text/
  • 6.修改文件/usr/bin/subl的内容
sudo gedit /usr/bin/subl

#!/bin/sh
exec /opt/sublime_text/sublime_text "$@"

修改为

#!/bin/sh
LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so exec /opt/sublime_text/sublime_text "$@"

此时,在终端执行subl可以使用搜狗中文输入了

  • 7.修改/usr/share/applications/sublime-text.desktop
将[Desktop Entry]中的字符串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"
将[Desktop Action Window]中的字符串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"
将[Desktop Action Document]中的字符串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"

此时,使用右键st打开的文件也可以使用搜狗中文输入了

  • 8.修改另一个sublime-text.desktop:~/.local/share/applications/sublime_text.desktop(具体位置要看安装路径)
将[Desktop Entry]中的字符串Exec=/opt/sublime_text/sublime_text修改为
Exec=bash -c "LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so exec /opt/sublime_text/sublime_text %F"

此时,在启动器打开st也可以使用搜狗中文输入了
有时在搜狗输入法下,backspace键会直接删除sublime中的文本,而不是输入法中的拼音。此时重启sublime即可

5.sublime3注册码

—– BEGIN LICENSE —–  
TwitterInc  
200 User License  
EA7E-890007  
1D77F72E 390CDD93 4DCBA022 FAF60790  
61AA12C0 A37081C5 D0316412 4584D136  
94D7F7D4 95BC8C1C 527DA828 560BB037  
D1EDDD8C AE7B379F 50C9D69D B35179EF  
2FE898C4 8E4277A8 555CE714 E1FB0E43  
D5D52613 C3D12E98 BC49967F 7652EED2  
9D2D2E61 67610860 6D338B72 5CF95C69  
E36B85CC 84991F19 7575D828 470A92AB  
—— END LICENSE —— 
```leale

你可能感兴趣的:(Sublime3【插件】)