Sublime Text Optimized configuration

Source: Internet
Author: User

Often used notepad++, recently because of the need for a long time in the Linux environment for C Development, the use of sublime Text 2, here does not introduce the basic mainly for my experience in the use of some summary.

1.pacage Control Installation

This should be a necessary option, the use of this plugin can be very convenient to manage other plugins. The installation is simple:

ctr+`Bring up the console and paste the following Python code:

Sublime Text 2

Import Urllib2,os,hashlib; h ='eb2297e1a458f27d836c04bb0cbaf282'+'d0e7a3098092775ccb37ca9d6b2e4b7d'; PF ='Package Control.sublime-package'; IPP = Sublime.installed_packages_path (); Os.makedirs (IPP)ifNot Os.path.exists (IPP)ElseNone; Urllib2.install_opener (Urllib2.build_opener (urllib2. Proxyhandler ())); by = Urllib2.urlopen ('http://packagecontrol.io/'+ Pf.replace (' ','%20'). read (); DH = hashlib.sha256 (by). Hexdigest (); Open (Os.path.join (IPP, PF),'WB'). Write (by)ifDH = = hElseNone; Print'Error validating download (got%s instead of%s), please try manual install'% (DH, h)ifDH! = hElse 'Restart Sublime Text to finish installation')

Sublime Text 3

Import Urllib.request,os,hashlib; h ='eb2297e1a458f27d836c04bb0cbaf282'+'d0e7a3098092775ccb37ca9d6b2e4b7d'; PF ='Package Control.sublime-package'; IPP = Sublime.installed_packages_path (); Urllib.request.install_opener (Urllib.request.build_opener (Urllib.request.ProxyHandler ())); by = Urllib.request.urlopen ('http://packagecontrol.io/'+ Pf.replace (' ','%20'). read (); DH = hashlib.sha256 (by). Hexdigest (); Print'Error validating download (got%s instead of%s), please try manual install'% (DH, h))ifDH! = hElseOpen (Os.path.join (IPP, PF),'WB'). Write (by)

If the installation is successful, you can see that the package Control indicates that the installation was successful!

2. Chinese support

Sublime text Support UTF-8 encoding, to support Chinese words need to install a plug-in

Ctr+shift+p Enter the PCI, then enter ConvertToUTF8, download the installation is ready.

3. Equal-width font settings and cursors

I am using Ubuntu, used to use Ubuntu Mono

Preferences->setting-user

Edit:

["Caret_style":"Phase",    "Font_face":"Ubuntu Mono",    "font_size":15.0,    "Highlight_line":true,    "Highlight_modified_tabs":true]

"Caret_style": "phase": Soft cursor

"Font_face": "Ubuntu Mono": Setting fonts

"Highlight_line": true: Highlight selected rows

"Highlight_modified_tabs": Highlighted Files tab in edit

4. Setting the theme

When the file directory tree (ctr+k,ctr+b) is displayed, the left side is white by default and feels very uncoordinated. I chose another good theme Theme-flatland:

This topic can be downloaded and installed with the package Manager

Figure 2 The default directory tree topic

Figure 3 Theme-flatland Theme

Then configure it to OK

   theme  : "   Flatland dark.sublime-theme   ,  Span style= "color: #800000;" > " color_scheme  " :  " packages/theme-flatland/flatland monokai.tmtheme   " ,  "  flatland_sidebar_tree_small  : true ,
5. Chinese Input Method

This is very serious, and then Ubutu under the use of Sogou input method is unable to input Chinese, need to compile their own shared library.

My sublime installation directory is in /opt/sublime_text_2

First you need to download the gtk lib file

sudo apt-get install LIBGTK2. 0-dev

Then edit the file:sublime_imfix.c

#include <gtk/gtkimcontext.h>voidGtk_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; intwidth =gdk_window_get_width (window); intHeight =gdk_window_get_height (window); if(Width! =0&& Height! =0) gtk_im_context_focus_in (context);}

and then compile

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

If it succeeds, it will appear. libsublime-imfix.so File

Then move this file to the sublime installation directory, my/opt/sublime_text_2

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

Edit the/usr/bin/subl file, which is a shell script

The contents are as follows, and individual places are prepared according to their own circumstances:

#!/bin/bashld_preload=/opt/sublime_text_2/libsublime-imfix.so exec /opt/sublime_text_2  "[email protected]"

Then execute the script Subl

Now you can sublime it into Chinese.

This article refers to: 1.https://packagecontrol.io/installation#st3 package Management Organ Network

2. http://www.linuxeden.com/html/softuse/20130726/141753.html a good Operation tutorial

3. Http://jingyan.baidu.com/article/f3ad7d0ff8731609c3345b3b.html solve the problem of Chinese input method

4.http://www.cnblogs.com/figure9/p/sublime-text-complete-guide.html#3164492 a good tutorial on how to operate

Sublime Text Optimized configuration

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.