Sublime Text是一个超好用的轻量级文本编辑器,可以支持很多语言。它使用注册许可证的方式收费(还蛮贵的),但也可以免费试用,只是偶尔在保存操作的时候会提示购买license(许可证)。中国人用惯了免费的,而且这个软件还很贵,自然不会去购买许可证。呵呵,之前我就一直使用的未注册版本,对于偶尔的注册提示还是可以接受。今天没有抱任何希望的心态搜索了下Sublime Text 2 的许可证,竟然真的有,果断用上,并记录在这里。
Sublime 2:(许可证来源:《Sublime Text 2 许可证》)
----- BEGIN LICENSE Alexander Single User License EA7E-814345 51F47F09 4EAB1285 7827EFF0 8B1207DC A76A6EA3 E1A1CA7A DC1F2703 14,897,784 8EDC1C82 3F2A58B9 1C0C8B24 67686432 281245B3 6233DE5C ADC5C2F9 61FB8A04 171B63EF 86BA423F 6AC884FD 3273A7AA 5F50A6DB CE7859AE D62D2B37 AEEDD8C2 078A8A20 70EEA791 84F48C1E 8ABA7DEB 0B3907C0 C9A3523B 0091A045 6F67AED8 ------ END LICENSE ------
Sublime 3: (许可证来源:http://www.xiumu.org/note/sublime-text-3.shtml)
—– BEGIN LICENSE —– K-20 Single User License EA7E-940129 3A099EC1 C0B5C7C5 33EBF0CF BE82FE3B EAC2164A 4F8EC954 4E87F1E5 7E4E85D6 C5605DE6 DAB003B4 D60CA4D0 77CB1533 3C47F579 FB3E8476 EB3AA9A7 68C43CD9 8C60B563 80FE367D 8CAD14B3 54FB7A9F 4123FFC4 D63312BA 141AF702 F6BBA254 B094B9C0 FAA4B04C 06CC9AFC FD412671 82E3AEE0 0F0FAAA7 8FA773C9 383A9E18 —— END LICENSE ——
以下是我的相关设置,记录下来共享下,也免得我忘记。
1.代码段设置:
<snippet> <content><![CDATA[ #include <iostream> #include <string.h> #include <cstdio> using namespace std; const int INF=10000000; const int MAXN=100; ${1:} int main() { ${2:} return 0; } ]]></content> <tabTrigger>haha</tabTrigger> <!-- Optional: Set a tabTrigger to define how to trigger the snippet --> <!-- <tabTrigger>hello</tabTrigger> --> <!-- Optional: Set a scope to limit where the snippet will trigger --> <!-- <scope>source.python</scope> --> </snippet>
2.个人喜好设置:
{ "color_scheme": "Packages/Color Scheme - Default/Mac Classic.tmTheme", "font_size": 16, "tab_size": 4, "translate_tabs_to_spaces": true, "update_check": false }
3.向鼠标右键菜单中添加 “Sublime打开”:
4.在命令行中显示运行结果:(来源:http://tieba.baidu.com/p/3481924547?pn=1)
以管理员身份运行sublime text 3,进入菜单工具-编译系统-新编译系统
输入如下内容,并将文件保存为CPP.sublime-build(注意不要修改文件名和大小写)。
{ "cmd": ["g++", "${file}", "-o","${file_path}/${file_base_name}"], "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:?(.*)$", "working_dir": "${file_path}", "encoding":"cp936", "selector": "source.c", "variants": [ { "name": "Run", "cmd": ["cmd","/C","start","cmd","/c", "${file_path}/${file_base_name}.exe &pause"] }, { "name": "Run < in.txt", "cmd": ["cmd","/C","start","cmd","/c", "${file_path}/${file_base_name}.exe < in.txt &pause"] } ] }