As we all know, Sublime is a powerful editor, with a refreshing interface, a huge amount of sophisticated plug-ins and self-snippet and other practical features. Here's a tutorial that's written specifically for Oiers to prepare to install and use sublime on your MacBook.
1. Download:
On Sublime official website https://www.sublimetext.com/3 direct download can, temporarily the latest version is 3143 version.
After downloading to the download folder, double-click the program to install it automatically.
2. Modify the default open mode:
After installation can be used directly (but there will be a Unregisterd logo in the upper right corner, indicating that this is an unpaid trial version, you can search the Internet using cracked version (personally think not necessary), the economic license can purchase the official version.
If for a certain type (extension) of the file, it is hoped that this file all open with sublime, you can follow this method:
Right-click File--Show info--Open with->sublime-> all changes
3. Open by default in the same window:
The default file opened with sublime will automatically reopen a window instead of opening a new tab in the original window, which is a hassle, and the workaround is:
Toolbar->preferences->preferences.sublime-settings-user
{
"Font_size": 20
}
To add a line of code, change to:
{
"Open_files_in_new_window": false,
"Font_size": 20
}
Watch the comma!!
This will allow you to open the same window after restarting sublime.
4. Plugin Download:
Plug-ins are the most important factor in Sublime's power, but you must modify the sublime internal configuration before downloading the plugin by:
Click on the Https://packagecontrol.io Install Now, and copy the following code:
1Import Urllib.request,os,hashlib; h ='6f4c264a24d933ce70df5dedcf1dcaee'+'ebe013ee18cced0ef93d5f746d80ef60'; 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)
Then control+ ' Open the Run box and paste the code in the bottom box, restart sublime after running, and you can see the package control option in the preference of the toolbar to indicate that the installation was successful.
5. Change the theme:
Sublime Official website has a large selection of themes, including eye protection theme and so are very good choice, you can go to the official website preview, here is recommended word of mouth very good Brogrammer theme:
Command+shift+p can open the package Control, where you can find plugins directly
Command+shift+p, Install Package--Theme Brogrammer
Preferences, color scheme, Brogrammer
This makes it possible to change the theme.
6. Shortcut key to open terminal
In the game often need to write scripts, gdb debugging and other test code, then need the code in the folder to open the terminal, sublime terminal plug-in can meet the needs.
Install Package-Terminal
You can then command+shift+t open the terminal of the folder where the code files are located.
7. Automatically sync background colors like sidebar
Open the sidebar will find the background color is white, and the Code edit box black background is very uncoordinated, we can download SYNCEDSIDEBARBG Auto Sync Sidebar, compile the run bar and other background colors are the same as the theme background color (of course, the font foreground color will automatically make corresponding changes, very convenient)
8. Common shortcut keys
Command+b Compilation (Command+shift+b can choose to run, but cannot enter data into the Run box)
Command+k+b Show Sidebar
Support the general editor of all the shortcut keys (copy and paste, etc.), the remaining dozens of are not mentioned here, there is a need to search the Internet.
9.snippet
One of the most appealing features of sublime is the ability to write only a few letters and then go to auto-complete with the Enter or TAB key.
Developer, Tools---New Snippet ...
Note that the <scope> is source.c++!.
After the completion of the code in the bracketed brackets, write the trigger code in Tabtrigger, ${1} indicates the cursor position (go to the next tab key), ${2:hello} means "Hello" and the automatic cursor is selected here.
After editing, the file suffix name is. Sublime-snippet, which is stored in the folder it defaults to you.
Here are two copies of my own code, the first is a quick read into the template, and the second is the header file.
1 <snippet>
2 <content><![CDATA[
3 templates<typename T>inline void rd(T &x){
4 int t; char ch;
5 for (t=0; !isdigit(ch=getchar()); t=(ch==‘-‘));
6 for (x=ch-‘0‘; isdigit(ch=getchar()); x=x*10+ch-‘0‘);
7 if (t) x=-x;
8 }
9
10 ]]></content>
11 <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
12 <!-- <tabTrigger>hello</tabTrigger> -->
13 <tabTrigger>rd</tabTrigger>
14 <!-- Optional: Set a scope to limit where the snippet will trigger -->
15 <!-- <scope>source.python</scope> -->
16 <scope>source.c++</scope>
17 </snippet>
<snippet>
<content><![CDATA[
#include<cstdio>
#include<cstring>
#include<algorithm>
#define rep(i,l,r) for (int i=l; i<=r; i++)
typedef long long ll;
int main(){
freopen("${1:a}.in","r",stdin);
freopen("${2:a}.out","w",stdout);
${3}
return 0;
}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<!-- <tabTrigger>hello</tabTrigger> -->
<tabTrigger>ii</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
<scope>source.c++</scope>
</snippet>
commonly used plug-ins are generally these, the rest can be Google or to the official website to understand. I hope this article will be helpful to you oiers.
Download, configuration and plugin recommendations for Sublime Text 3 on MAC OS X (for oiers)