当前位置:首页 » 操作系统 » Linuxsublimetext

Linuxsublimetext

发布时间: 2023-09-24 03:41:38

linux 命令行怎么使用sublime

不同发行版的都有所区别,下面以ubuntu为例说明:假设你的sublime安装在/opt目录下首先建立软连接,使其能从终端启动sudoln-s/opt/Sublime\Text\2/sublime_text/usr/bin/sublime生成桌面图标sudosublime/usr/share/applications/sublime.desktop内容:[DesktopEntry]Version=1.0Name=SublimeText2#OnlyKDE4seemstouseGenericName,sowereusetheKDEstrings.#FromUbuntu'slanguage-pack-kde-XX-basepackages,version9.04-20090413.GenericName=TextEditorExec=sublimeTerminal=falseIcon=/opt/SublimeText2/Icon/48x48/sublime_text.pngType=ApplicationCategories=TextEditor;IDE;DevelopmentX-Ayatana-Desktop-Shortcuts=NewWindow[NewWindowShortcutGroup]Name=NewWindowExec=sublime-nTargetEnvironment=Unity然后修改默认程序,替换系统的gedit程序sudosublime/usr/share/applications/defaults.list内容:将里面默认的gedit.desktop全部用sublime.desktop替换即可。再次强调,这个仅适用于ubuntu,其他发行版,请修改对应的配置文件,如默认的程序列表defaults.list,等。

❷ Linux系统中Sublime Text无法输入中文怎么办

1.保存下面的代码为sublime_imfix.c
代码如下:
/*
sublime-imfix.c
Use LD_PRELOAD to interpose some function to fix sublime input method support for linux.
By Cjacker Huang
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
#include
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 = 0;
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 == 2 && 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 != 0 && height !=0) {
gtk_im_context_focus_in(context);
local_context = context;
}
gdk_window_add_filter (window, event_filter, context);
} 2.编译动态库:
代码如下:
gcc -shared -o libsublime-imfix.so sublime_imfix.c `pkg-config --libs --cflags gtk+-2.0` -fPIC
3. 设置 LD_PRELOAD 并启动 Sublime Text:
代码如下:
LD_PRELOAD=。/libsublime-imfix.so sublime_text
为了不用每次启动Sublime Text都打这么一长串东西,写了个启动Sublime的脚本
代码如下:
#!/bin/bash
SUBLIME_HOME=“/opt/sublime_text”
LD_LIB=$SUBLIME_HOME/libsublime-imfix.so
sh -c “LD_PRELOAD=$LD_LIB $SUBLIME_HOME/sublime_text $@”
把libsublime-imfix.so放到Sublime Text目录下并修改脚本中的SUBLIME_HOME,这样Sublime Text 就可以输入中文了。
上面就是Linux下Sublime Text 无法输入中文的解决方法的介绍了,只要按照上面的步骤,就能在Sublime Text 中输入中文了

❸ linux下怎么安装sublime text

安装方法1: 通过apt-get install来安装,可以如下来做: sudo add-apt-repository ppa:webupd8team/sublime-text-2 sudo apt-get update sudo apt-get install sublime-text-2 安装方法2: 1.官网下载安装包 2.解压并不难,随便找个目录解压就行,但考虑到后面要能在命令行下方便的快速启动,推荐解压到/usr/lib/目录下,我用的方法是先解压后搬移,命令如下: tar -xvf Sublime\ Text\ 2.0.1.tar.bz2 mv Sublime\ Text\ 2 /usr/lib/ 其中的\为转义符 这样做是因为$PATH这个环境变量自动涵盖了/usr/lib这个目录,不用专门去修改环境变量。 然后键入: ln -s /usr/lib/Sublime\ Text\ 2/sublime_text /usr/bin/sublime 3.侧边条LaunchBar设置 由于并非安装,缺少Ubuntu桌面运行的一些基本配置,比如不能将它加入桌面侧边的启动器,这个和通过软件安装中心安装的程序不太一样。要做到这一点,需要增加一个配置文件,放在/usr/share/appliations/路径下,比如增加sublime.desktop,文件内容如下: 参考配置 : [Desktop Entry] Version=2.0.1 Name=Sublime Text 2 GenericName=Text Editor Exec=sublime Terminal=false Icon=/usr/lib/Sublime Text 2/Icon/48x48/sublime_text.png Type=Application Categories=TextEditor;IDE;Development X-Ayatana-Desktop-Shortcuts=NewWindow [NewWindow Shortcut Group] Name=New Window Exec=sublime -n TargetEnvironment=Unity

热点内容
微信提示存储空间不足 发布:2025-01-24 01:19:53 浏览:963
安卓电脑管家如何清除缓存 发布:2025-01-24 00:55:42 浏览:148
怎么上传歌曲到qq音乐 发布:2025-01-24 00:45:30 浏览:65
养猫用什么配置 发布:2025-01-24 00:37:58 浏览:812
pythongps 发布:2025-01-24 00:37:51 浏览:813
办公编程鼠标 发布:2025-01-24 00:37:07 浏览:386
wpa加密类型 发布:2025-01-24 00:35:58 浏览:960
如何用批处理实现ftp映射盘符 发布:2025-01-24 00:25:45 浏览:954
win7sql版本 发布:2025-01-24 00:22:16 浏览:499
安卓手机市场有什么 发布:2025-01-23 23:48:56 浏览:26