Linux下安装,一种办法是从官网下载 tar.bz ,手动安装。另一种是使用apt-ge安装

这里介绍用 apt-get 自动安装方法:

1.添加sublime text 3的仓库:

 sudo add-apt-repository ppa:webupd8team/sublime-text-

2.更新软件库:

 sudo apt-get update  

3.安装Sublime Text 3:

 sudo apt-get install sublime-text-installer

命令结束后,一切搞定!

4.Ubuntu下对中文的支持

貌似不支持ibus,我用的 fcitx+sogou

步骤1:安装gtk环境

 sudo apt-get install libgtk2.-dev pkg-config

步骤2:新建 sublime_imfix.c文件,内容如下

/*
sublime-imfix.c
Use LD_PRELOAD to interpose some function to fix sublime input method support for linux.
By Cjacker Huang <jianzhong.huang at i-soft.com.cn> gcc -shared -o libsublime-imfix.so sublime_imfix.c `pkg-config --libs --cflags gtk+-2.0` -fPIC
LD_PRELOAD=./libsublime-imfix.so sublime_text
*/
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
typedef GdkSegment GdkRegionBox; struct _GdkRegion
{
long size;
long numRects;
GdkRegionBox *rects;
GdkRegionBox extents;
}; GtkIMContext *local_context; void
gdk_region_get_clipbox (const GdkRegion *region,
GdkRectangle *rectangle)
{
g_return_if_fail (region != NULL);
g_return_if_fail (rectangle != NULL); rectangle->x = region->extents.x1;
rectangle->y = region->extents.y1;
rectangle->width = region->extents.x2 - region->extents.x1;
rectangle->height = region->extents.y2 - region->extents.y1;
GdkRectangle rect;
rect.x = rectangle->x;
rect.y = rectangle->y;
rect.width = ;
rect.height = rectangle->height;
//The caret width is 2;
//Maybe sometimes we will make a mistake, but for most of the time, it should be the caret.
if(rectangle->width == && GTK_IS_IM_CONTEXT(local_context)) {
gtk_im_context_set_cursor_location(local_context, rectangle);
}
} //this is needed, for example, if you input something in file dialog and return back the edit area
//context will lost, so here we set it again. static GdkFilterReturn event_filter (GdkXEvent *xevent, GdkEvent *event, gpointer im_context)
{
XEvent *xev = (XEvent *)xevent;
if(xev->type == KeyRelease && GTK_IS_IM_CONTEXT(im_context)) {
GdkWindow * win = g_object_get_data(G_OBJECT(im_context),"window");
if(GDK_IS_WINDOW(win))
gtk_im_context_set_client_window(im_context, win);
}
return GDK_FILTER_CONTINUE;
} 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); if(!GDK_IS_WINDOW (window))
return;
g_object_set_data(G_OBJECT(context),"window",window);
int width = gdk_window_get_width(window);
int height = gdk_window_get_height(window);
if(width != && height !=) {
gtk_im_context_focus_in(context);
local_context = context;
}
gdk_window_add_filter (window, event_filter, context);
}

步骤3:编译文件

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

步骤4:运行

 LD_PRELOAD=./libsublime-imfix.so subl

步骤5:为了避免每次使用sublime都输入这么长的命令,从而进一步处理

(1)把 sublime_imfix.so  放在sublime安装目录 (我的在 /opt/sublime_text/)

(2)在 /usr/local/bin 或者其他PATH下 新建一个文件sublime写入:

 LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so /opt/sublime_text/sublime_text

或者修改文件usr/bin/subl

将内容改为:

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

注意:后面的"$@"需要加上。

(3)然后就可以在控制台使用sublime或subl命令,打开sublime text软件了

6.在/usr/share/applications修改sublime-text.desktop文件

(1)打开sublime-text.desktop文件:

sudo gedit /usr/share/applications/sublime-text.desktop

(2)修改内容为:

 [Desktop Entry]
Version=1.0
Type=Application
Name=Sublime Text
GenericName=Text Editor
Comment=Sophisticated text editor for code, markup and prose
#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"
Terminal=false
MimeType=text/plain;
Icon=sublime-text
Categories=TextEditor;Development;Utility;
StartupNotify=true
Actions=Window;Document; X-Desktop-File-Install-Version=0.22 [Desktop Action Window]
Name=New Window
#xec=/opt/sublime_text/sublime_text -n
Exec=bash -c "LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so exec /opt/sublime_text/sublime_text -n"
OnlyShowIn=Unity; [Desktop Action Document]
Name=New File
#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"
OnlyShowIn=Unity;

Ubuntu14.04 安装 Sublime Text 3的更多相关文章

  1. Ubuntu 14.04 安装 Sublime Text 3

    1. 实验环境 Ubuntu 14.04 + Sublime text 3 2. sublime text介绍 ublime Text 是一款流行的文本编辑器软件,有点类似于TextMate,跨平台, ...

  2. Linux入门(8)——Ubuntu16.04安装sublime text 3并配置Python开发环境

    打开终端,添加sublime text 3的仓库: 按enter键继续 更新软件库: sudo apt-get update 安装Sublime Text 3: sudo apt-get instal ...

  3. Ubuntu14.04下Sublime Text 3解决无法输入中文

    在Ubuntu 14.04中安装了SublimeText 3之后发现既然不支持输入中文,于是在网上搜罗一下,发现很多人遇到了同样的问题,但是解决办法大该就只有一个.下面根据自身的安装及解决办法总结如下 ...

  4. centos7 & ubuntu14.02安装sublime 3

    Centos7安装Sublime Text 3.0正式版 1.安装 GPG 公钥rpm -v --import https://download.sublimetext.com/sublimehq-r ...

  5. 在Ubuntu16.04 64bit上安装sublime text 3

    安装sublime text 3 根据官网上提供的安装说明 https://www.sublimetext.com/docs/3/linux_repositories.html  进行安装, 首先是 ...

  6. Ubuntu14.04安装中文输入法以及解决Gedit中文乱码问题

    1 设置中文显示环境 1. 打开System Settings 2. 打开Personal-> Language Support. 会弹出如下对话框,提示你“语言支持没安装完整”. 点击“Rem ...

  7. Ubuntu 14.04 安装sublime

    参考 How do I install Sublime Text 2/3? Ubuntu 14.04 安装sublime 通过apt-get包管理器安装sublime. sublime2.0: sud ...

  8. Ubuntu 16.04 LTS sublime text 3 解决不能输入中文

    sublime text 3 安装完成后不能输入中文,让人很是不爽.下面内容可以解决使用问题! 一.首先要注意几个问题. 1)sublime_imfix.c 文件放在home目录下面. 2)如果你在步 ...

  9. Ubuntu安装sublime Text 3并配置可以输入中文

    使用Ubuntu系统后,想找一个顺手的编辑器,sublime作为我的首选编辑器,在安装和配置可输入中文时遇到各种个样的问题,总结一些: 1:问题: 我的系统是Ubuntu 18.04 LTS,尝试多次 ...

随机推荐

  1. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第5章编程练习6

    #include <iostream>#include <string>using namespace std;struct car{ string pro; int  yea ...

  2. __x__(39)0909第五天__ 表格 table

    表格 表示一种格式化的数据,如课程表,银行对账单... ... 在网页中,使用 table 创建一个表格. html代码: <!doctype html> <html> < ...

  3. BOM 浏览器对象模型_window.navigator

    window.navigator 对象 包含浏览器和系统信息的 Navigator 对象. 通过这个属性 了解用户的环境信息 window.navigator.userAgent 返回浏览器的 Use ...

  4. wamp 环境安装php_mongo 或 mongodb的扩展

    特别注意:momgo 与mondb 是两个不同的扩展,不是同一个,这是一个坑 1.查看你的php版本,Compiler,Thread safety版本 2.下载地址 https://pecl.php. ...

  5. linux 标注主机别名

    vi /etc/bashrc # Turn on checkwinsize  shopt -s checkwinsize  [ "$PS1" = "\\s-\\v\\\$ ...

  6. Design Principle, Design Patterns And Refactoring

    https://refactoring.guru/smells/feature-envy https://stackoverflow.com/questions/1242994/effective-c ...

  7. 虚拟机设置IP

    方式NAT 版本信息VMware(14.1.1 build-7528167)和centos7 一,设置网络适配器: 二.设置虚拟网络 三.配置虚拟机(/etc/sysconfig/network-sc ...

  8. WithOne 实体关系引起 EF Core 自动删除数据

    最近遇到了一个 EF Core 的恐怖问题,在添加数据时竟然会自动删除数据库中已存在的数据,经过追查发现是一个多余的实体关系配置引起的. modelBuilder.Entity<Question ...

  9. Ultimate Facebook Messenger for Business Guide (Feb 2019)

    Ultimate Facebook Messenger for Business Guide (Updated: Feb 2019) By Iaroslav Kudritskiy November 2 ...

  10. Multi-Projector Based Display Code ---- Download

    The code providing are for your reference. Please download the code according to your hareware confi ...