Sublime Text打造全栈开发环境

python自动补全

  1. 通过快捷键 ctrl+` 或者 View > Show Console 菜单打开控制台
  2. 粘贴对应版本的代码后回车安装

    • 适用于 Sublime Text 3:

      1
      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())
    • 适用于 Sublime Text 2:

      1
      import urllib2,os;pf='Package Control.sublime-package';ipp=sublime.installed_packages_path();os.makedirs(ipp)ifnotos.path.exists(ipp)elseNone;urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler()));open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read());print('Please restart Sublime Text to finish installation')
  3. 自动补全

    • cmd+shift+p调用出窗口:输入Install Package
    • 输入Jedi

命令行使用sublime打开

subl

sublime 配置

更改用户配置文件

Sublime Text > Preferences > Settings – User

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{
"auto_complete": false,
"auto_complete_commit_on_tab": false,
"auto_match_enabled": true,
"bold_folder_labels": true,
"caret_style": "solid",
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"detect_indentation": true,
"draw_indent_guides": true,
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
"*.DS_Store",
"*.pyc",
"*.git"
],
"find_selected_text": true,
"fold_buttons": false,
"folder_exclude_patterns":
[
],
"font_face": "Menlo",
"font_options":
[
"no_round"
],
"font_size": 13,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages":
[
"Vintage"
],
"indent_to_bracket": true,
"line_padding_bottom": 0,
"line_padding_top": 0,
"match_brackets": true,
"match_brackets_angle": false,
"match_brackets_braces": true,
"match_brackets_content": true,
"match_brackets_square": true,
"new_window_settings":
{
"hide_open_files": true,
"show_tabs": true,
"side_bar_visible": true,
"status_bar_visible": true
},
"remember_open_files": true,
"remember_open_folders": true,
"save_on_focus_lost": true,
"scroll_past_end": false,
"show_full_path": true,
"show_minimap": false,
"tab_size": 2,
"theme": "Adaptive.sublime-theme",
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,
"use_simple_full_screen": true,
"vintage_start_in_command_mode": false,
"wide_caret": true,
"word_wrap": true
}

针对python配置

Sublime Text > Preferences > Settings – More > Syntax Specific – User

1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
// editor options
"draw_white_space": "all",
// tabs and whitespace
"auto_indent": true,
"rulers": [79],
"smart_indent": true,
"tab_size": 4,
"trim_automatic_white_space": true,
"use_tab_stops": true,
"word_wrap": true,
"wrap_width": 80
}

sublime 插件安装

cmd+shift+p调用出窗口:输入Install Package

  • SideBarEnhancements 扩展了侧边栏中菜单选项的数量
  • Emmet 你只需要输入感叹号!,然后按下 tab 键,便可以在一个 HTML 文件中创建一段带有几个基本标签的 HTML5 文档类型的代码

快捷键

  • 跳转到任意内容 (“cmd+p”) 用来快速查找和打开文件。
  • 跳转到指定行 (“ctrl+g”) 让你在当前文件中跳转到指定行数。
  • 跳转到标志 (“cmd+r”) 可以列出当前文件中所有的函数或者类
  • 跳转到行首 (cmd+left-arrow-key)
  • 跳转到行尾 (cmd+right-arrow-key)
  • 删除当前行(ctrl+shift+k)
  • 多重编辑 cmd+D 是我迄今为止最喜欢的快捷键
关注我的微信,共同分享与讨论!