Centos安装sublime3

一、安装sublime3

1.下载
下载sublime软件包,(官网链接:http://www.sublimetext.com/3)
2.安装
这里我们将sublime安装到opt目录下,进入opt目录;
# cd /opt
# tar jxvf sublime_text_3_build_3143_x64.tar.bz2
# cd /opt/sublime_text_3
# ./sublime_text
# rm -rf sublime_text_3_build_3143_x64.tar.bz2
3.创建桌面快捷方式
# cp /opt/sublime_text_3/sublime_text.desktop /usr/share/applications
# vim /usr/share/applications/sublime_text.desktop
4.安装package  control
使用 [Ctrl + `]打开控制台,将下面的代码粘贴到控制台里:
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())

5.安装插件
 1. 按下Ctrl+Shift+P调出命令面板。
 2. 输入install 调出 Install Package 选项并回车。
 3. 在列表中选中要安装的插件,或者输入插件名,根据命令面板中的过滤结果,选择要安装的插件。

 

二、我安装的插件

SublimeCodeIntel:

点击preferences中的browse Packages,进入到SublimeCodeIntel,在当前的路径下新建.codeintel文件夹(windows中文件命名的时候为 .codeintel. ),之后进入到 .codeintel文件夹中,新建文件“config.log”,配置文件中输入(下文以路径“E:/Program Files/python34/”为例,实际配置时请根据具体安装路径修改):
"python3":{
     "python":"/usr/local/python3/bin/python3.6",
     "pythonExtraPaths":[ ]
}


SublimeTmpl:

新建文件模板插件
 1.在settings-user中设置上自己的信息:
{
    "disable_keymap_actions": false, // "all"; "html,css"
    "date_format" : "%Y-%m-%d %H:%M:%S",
    "attr": {
        "author": "",
        "email": "",
        "link": ""
    }
}
2.将Python的创建模板命令也做修改,在key bindings-user中添加了以下信息,意思是ctrl+alt+n就可以创建一个新的Python模板
{
        "caption": "Tmpl: Create python", "command": "sublime_tmpl",
        "keys": ["ctrl+alt+n"], "args": {"type": "python"}
}


SublimeREPL:

直接运行当前文件,可以方便调试,与Terminal可以联合使用
在key bindings-user中添加了以下信息:
{
        "keys": ["f5"],
        "caption": "SublimeREPL: Python - RUN current file",
        "command": "run_existing_window_command",
        "args": {
            "id": "repl_python_run",
            "file": "config/Python/Main.sublime-menu"
        }
}
接下来我们就要试着运行一个我们的程序了,我建议是上面的工作做完了,重新打开一下subime text3 ,设置一下View—Layout—Columbus 2(这个可以将屏幕分成2个,左边编程,右边输出结果,为了看着方便建议这样设置一下),在左边编写上我们的程序
然后点击选择Tools -> SublimeREPL -> Python -> RUN current file 运行一下
因为上面已经设置了快捷键,所以可以用快捷键f5

 

Anaconda:

自动匹配关键字等实用功能,有效提高开发效率1.由于Anaconda插件本身无法知道Python安装的路径,所以需要设置Python主程序的实际位置。选择Settings-Default选项,搜寻“python_interpreter” key,并键入python主程序的磁盘位置。
2.选择Settings-Users选项,键入以下json数据。保存,重启ST3即可。
{
    "python_interpreter":"/usr/local/python3/bin/python3.6",
    "suppress_word_completions":true,
    "suppress_explicit_completions":true,
    "complete_parameters":true,
}
3.接下来,就会发现,ST3编写python代码时会有提示功能。

'swallow_startup_errors' to 'true' in your configuration file.

 

三、sublime3环境设置

{
 "color_scheme": "Packages/Boxy Theme/schemes/Boxy Ocean.tmTheme",
 "default_line_ending": "unix",
 "draw_minimap_border": true,
 "font_face": "monaco",
 "font_size": 14.0,
 "highlight_line": true,
 "highlight_modified_tabs": true,
 "ignored_packages":
 [
  "Vintage"
 ],
 "line_padding_bottom": 1,
 "line_padding_top": 1,
 "tab_size": 2,
 "theme": "Boxy Ocean.sublime-theme",
 // 设置tab的大小为4
 "tab_size":4,
 // 使用空格代替tab
 "translate_tabs_to_spaces": true,
 // 侧边栏文件夹显示加粗,区别于文件
 "bold_folder_labels": true,
 // 窗口失焦立即保存文件
 "save_on_focus_lost": true,
 // 保存时自动增加文件末尾换行,这样 git 提交时不会生产额外的 diff
 "ensure_newline_at_eof_on_save": true,
 "trim_trailing_white_space_on_save": true,
 "update_check": false,
 "word_wrap": "true"
}

主题来自知乎上的一个回答(A File Icon + Boxy Theme + SideBarEnhancements)

posted @ 2018-02-12 20:50  慕河河  阅读(434)  评论(0)    收藏  举报