sublime安装配置

https://packagecontrol.io/installation

 

1 import 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)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
View Code

 

 

打华东师范大学校赛的时候,学长谈论到这个编辑器。自定义背景多行多光标同时编辑酷炫爆了。感觉这是一个万能的文本编辑器。通过配置可以写多种语言,支持vim模式,而且只有不到10M。

安装首先安装package control安装,ctrl+`(tab上面键) 粘贴安装选项。然后ctrl+shift+p安装。然后可定制包

1,首先要配置能打acm的环境。自带编译环境修改为dos环境。

配置编译环境变量。

tool –> Build System –> New Build System

重命名,然后改代码,记得设置bin环境变量

{
    "encoding": "utf-8",
    "working_dir": "$file_path",
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "selector": "source.c, source.c++",
    "cmd": "g++ -g -Wall -std=c++11 -O2 -o \"${file_path}/${file_base_name}\" \"${file_path}/${file_name}\"",
    "variants": 
    [
        {
            "name": "build-with-std=c++11-O2 and run in cmd",
            "shell_cmd": "g++ -g -Wall -std=c++11 -O2 -o \"${file_path}/${file_base_name}\" \"${file_path}/${file_name}\" && start cmd /c \"\"${file_path}/${file_base_name}\" & pause\"",
        },
        {
            "name": "build-with-std=c++11 and run in cmd",
            "shell_cmd": "g++ -g -Wall -std=c++11 -o \"${file_path}/${file_base_name}\" \"${file_path}/${file_name}\" && start cmd /c \"\"${file_path}/${file_base_name}\" & pause\"",
        },  
    ]

}
View Code

 

 

2,装package control包,view->show console 敲入代码

import urllib2,os;pf='Package Control.sublime-package';ipp=sublime.installed_packages_path();os.makedirs(ipp) if not os.path.exists(ipp) else None;open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read())

 

 

 

在linux 下,官方下载安装包,是deb的 到下载目录dpkg -i <***> 搞定

装插件管理

 

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())
View Code

 

一个c++可用的编译设置

{
    
   "cmd": ["g++", "-std=c++11", "${file}", "-o", "${file_path}/${file_base_name}"], // For GCC On Windows and Linux
     //"cmd": ["CL", "/Fo${file_base_name}", "/O2", "${file}"],  // For CL on Windows Only
     "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
     "working_dir": "${file_path}",
     "selector": "source.c, source.c++",
 
     "variants":
     [
          {
               "name": "Run",
               "cmd": ["bash", "-c", "g++ -std=c++11 -pthread '${file}' -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}'"]  // Linux Only
               // "cmd": ["CMD", "/U", "/C", "g++ -std=c++11 ${file} -o ${file_base_name} && ${file_base_name}"]  // For GCC On Windows Only
               //"cmd": ["CMD", "/U", "/C", "CL /Fo${file_base_name} /O2 ${file} && ${file_base_name}"]   // For CL On Windows Only
          }
     ]

}
View Code

 拼了老命找到的linux编译c++并用bash运行的代码。还魔改啦一下。

{
    "shell_cmd": "g++ -std=c++11 \"${file}\" -o \"${file_path}/${file_base_name}\"",
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "source.cpp",

    "variants":
    [
        {
            "name": "Run",
            "shell_cmd": "gnome-terminal -x bash -c \"if [ -f '${file_path}/${file_base_name}' ]; then rm '${file_path}/${file_base_name}'; fi; g++ -std=c++11 '${file}' -o '${file_path}'/'${file_base_name}'; '${file_path}'/'${file_base_name}'; read -p 'Process Exit, Press any key to quit...'\""
        }
    ]
}
View Code

 

最后效果图,热身赛的某扫雷的开头

 

posted @ 2017-05-13 18:04  Q1143316492  阅读(228)  评论(0编辑  收藏  举报