Ubuntu Install sublime text and enter Chinese

Source: Internet
Author: User
Tags gtk sublime text

Sumblime Text3 is a legendary god-level code Editor with the following features:

1, code highlighting, their own active complement

2, various plug-in extension

3. Simple and comfortable appearance

4. Cross-platform (Windows,linux,os X)

In short, it's a really addictive editor. Without further ado, immediately describe how to install it in Ubuntu and enable it to enter Chinese


Test environment: Ubuntu Kylin 14.04

Steps:

1. Install Sogou Input Method

2, install sublime Text3

3, install the package control (not required, but recommended installation)

4, change sublime_imfix.c

5. Compile sublime_imfix.c into a shared library

6, make double hit open sublime text can input Chinese


First step: Install Sogou Input Method

Get the Sogou for Linux deb package and install it on the Sogou input judge net

Step two: Install Sublime Text3

Open Terminal (Ctrl + Alt + t) and enter the following code:

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

Press ENTER


Enter the following code and return:

sudo apt-get update

After the upgrade is complete. Enter the following code and return

sudo apt-get install Sublime-text-installer

Await sublime text installation complete


Step Three: Install the package control (not required, but recommended)

(Package control is a tool for managing various plugins in sublime text, for easy use of sublime text.) Recommend that you install it)

Create a shortcut to sublime text on the desktop and open sublime text (in the File Manager go to the/usr/share/applications folder and copy the icon to the desktop )

Then press the shortcut key CTRL + ' (ESC the following key), enter the following information in the popup command input form and return

<span style= "Color:rgb (51, 51, 51); font-family: ' Microsoft Yahei ', Microsoft Ya-Black, Arial, song body, Sans-serif; font-size:16px; line-height:28px; text-align:justify; " >import urllib.request,os;pf= ' package control.sublime-package '; Ipp=sublime.installed_packages_path (); Urllib.request.install_opener (Urllib.request.build_opener (Urllib.request.ProxyHandler ())); Open (Os.path.join ( IPP,PF), ' WB '). Write (Urllib.request.urlopen (' http://sublime.wbond.net/' +pf.replace (', '%20 '). Read ()) </span >
Then wait for the package control to finish installing again Sublimetext 3, and then use the shortcut key CTRL + Shift + p, and in the pop-up input box you can see the install Package's options for Python development students directly ctrl+b to execute the Python program. It is recommended to learn C/C + + students to install snipptes. Converttoutf8,sublimeastyleformatter and other plug-ins, these are explored by you.

Fourth Step: Change sublime_imfix.c

Open Terminal, enter

Gedit sublime_imfix.c

Change the Open text to the following code:

#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);}


Press Save and close text

Fifth step: Compile sublime_imfix.c into a shared library libsublime-imfix.so

(so file is a dynamic library file for Linux.) Windows-like DLL files)

Compiling requires GTK toolkit. About 100M, it is recommended that you have a good network situation and choose the right software source.

In Terminal input:

sudo apt-get install Gnome-core-devel

The code is then compiled into a shared library. No response to this step is the best response:

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


then enter the following code to copy the libsublime-imfix.so to the directory where Sublime_text resides. This step is the same as no reaction is the best reaction

sudo mv libsublime-imfix.so/opt/sublime_text/


Sixth step: Make double hit open sublime text can input Chinese

(This step is actually adding the code to perform the previous compilation of the Libsublime-imfix.so in the sublime text shortcut)

Enter the following command in the terminal:

sudo gedit/usr/share/applications/sublime_text.desktop


Change the Open text to the following code:

[Desktop Entry] Version=1.0type=applicationname=sublime textgenericname=text editorcomment=sophisticated textexec=bash-c "LD_ preload=/opt/sublime_text/libsublime-imfix.so exec/opt/sublime_text/sublime_text%F "Terminal=falseMimeType=text/ Plain;icon=sublime-textcategories=texteditor;development; Utility; Startupnotify=trueactions=window;document; [Desktop Action Window] Name=new windowexec=bash-c "Ld_preload=/opt/sublime_text/libsublime-imfix.so exec/opt/sublime_text/sublime_text-n "Onlyshowin=unity; [Desktop Action Document] Name=new fileexec=bash-c "ld_preload=/opt/sublime_text/libsublime-imfix.so exec/opt/sublime_text/sublime_text-- Command New_file "onlyshowin=unity;
create a shortcut again. Restart Sublime text. Press CTRL + SPACE to activate the Sogou input method, you can happily input Chinese.


PS: Some students like to use the command line in the terminal to open sublime text, which requires the following steps:

(principle with Sixth step)
In the terminal input

sudo gedit/usr/bin/subl

Change the Open text to the following code:

#!/bin/shld_preload=/opt/sublime_text/libsublime-imfix.so exec/opt/sublime_text/sublime_text "[Email protected]"


Press Save and close text as usual
This input subl in the terminal will be able to use Sogou input Chinese

This is my first time to write a blog, inevitably there are shortcomings, please all the way the great God to provide advice and advice, I appreciate it.

Special Acknowledgement: Lock brother



Ubuntu Install sublime text and enter Chinese

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.