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. SpringCloud教程 | 第三篇: 服务消费者(Feign)

    上一篇文章,讲述了如何通过RestTemplate+Ribbon去消费服务,这篇文章主要讲述如何通过Feign去消费服务.一.Feign简介 Feign是一个声明式的伪Http客户端,它使得写Http ...

  2. MongoDB 简单操作

    MongoDB操作 之 原生ORM,根本不存在SQL语句,数据之间不存在联系 查看数据库(查看磁盘中的数据库) > show databases; 使用数据库 > use local 创建 ...

  3. mobile_音悦台

    音悦台 less 可以 width = 1080/67.5rem; /**** 变量定义 ****/ @px: 67.5rem; /**** Start ****/ #wrap { width: 10 ...

  4. ffmpeg日志调式

    1.播放器打印输出调试日志:ffplay -v debug $URL2.播放器打开详细调试日志:./ffplay -loglevel 563.修改源码修改日志级别:    1)log.c中:stati ...

  5. Java演算法-「馬踏棋盤問題」

    /* * 馬踏棋盤問題:(貪婪法求解) * 棋盤有64個位置,“日”字走法,剛好走滿整個棋盤 */ //下一個走法的方向類 class Direction{ int x; int y; int way ...

  6. PAT甲级1049 Counting Ones【规律】

    题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805430595731456 题意: 给定n,问0~n中,1的总个数 ...

  7. 浅谈 R_S触发器

    1.. 1.要点 就是S R端谁是0谁就掌握了绝对权力,因为与门的缘故. 对于上图 S在左边,所以只要S是0 ,Q必定是1.另外对于R 只要R是0,Q非才能是1,q非又是S端的关键与信号,所以只有R为 ...

  8. Java第四次实践作业

    1 编写“电费管理类”及其测试类.  第一步 编写“电费管理”类 1)私有属性:上月电表读数.本月电表读数 2)构造方法:无参.2个参数 3)成员方法:getXXX()方法.setXXX()方法 4 ...

  9. LVS,Keepalived,HAproxy区别与联系

    LVS,Keepalived,HAproxy区别与联系 LVS 全称Linux Virtual Server,也就是Linux虚拟服务器,由章文嵩(现就职于于淘宝,正因为如此才出现了后来的fullna ...

  10. vue-cli 创建项目失败

    vue-cli 创建一个vue项目报错 npm code 404. 尝试解决方法都有,我是第3种方法生效 更新npm 重新安装nodejs vue-cli@3.0.1 在创建项目的时候,不能开启其他v ...