软件工具git studyDev Tools

Sublime Text 配置Python,Java,Markd

2014-11-09  本文已影响15413人  MarkChen

之前用过不少类型的代码/文本编辑器,能够一举解决我所有编辑需求的工具还真是少之又少。曾经坚持用了三个月的Vim,还整理了一份vimrc在这。但是Vim学习曲线实在太陡,爬不上去,只好转向这款号称“性感无比”的代码编辑器Sublime Text,又说“程序员必备神器”。一入手才发现,简直是相见恨晚。今天偷空写下我的配置心得,以飨各位看官。

我个人喜欢Sublime Text的原因主要有四:跨Windows/Linux/Mac平台,轻量,安装插件方便,编辑体验极其流畅。平时的编辑需求包括,常规的文本编辑和浏览,用Markdown写文章,写Python和Java代码。接下来我也主要围绕这四类需求来简要介绍我的Sublime Text最基本的配置情况。

Sublime Text 有两个版本,ST3是Beta版,但是至今没觉得有什么影响使用的bug,我用的是Sublime Text 3

插件安装

Sublime Text 插件安装很简单,一般有两种方式。

离线安装

在线安装

Sublime Text 有一个Packages的管理插件,Sublime Package Control。通过 Sublime Package Control,安装、升级和卸载 Package 也变得轻松写意了。

通过Package Control 来安装插件:

  1. 按下Shift + Command + P调出命令面板。
  2. 输入install调出Package Control: Install Package选项,按下回车。
  3. 输入插件名称并回车,稍等几秒就安装好了,有的插件可能需要重启Sublime Text才能激活。

常规配置

每个人的编辑习惯不一样,作为轻微强迫症患者,我喜欢给自己的编辑器做一些设置,例如文件编码,主题,字体,字体大小,显示行号,设置Tab大小,空格替换制表,显示空白符,显示80字符打印线等等。我的初级Settings-User内容如下。

{
    "font_size": 12,
    "ignored_packages":
    [
        "Vintage"
    ],
    "font_face": "Consolas",
    // 设置tab的大小为4
    "tab_size": 4,
    // 使用空格代替tab
    "translate_tabs_to_spaces": true,
    // 添加行宽标尺
    "rulers": [80, 100],
    // 显示空白字符
    "draw_white_space": "all",
    // 保存时自动去除行末空白
    "trim_trailing_white_space_on_save": true,
    // 保存时自动增加文件末尾换行
    "ensure_newline_at_eof_on_save": true,
    // 默认编码格式
    "default_encoding": "UTF-8"
}

下面是一些我配置的常规插件。

配置Markdown书写环境

配置Python编辑环境

配置Java编辑环境

前提

JDK已经安装好,Java环境已配置好。

配置编译环境

附录

BracketHighlighter配置

Bracket settings-User

{
        "bracket_styles": {
            // This particular style is used to highlight
            // unmatched bracket pairs. It is a special
            // style.
            "unmatched": {
                "icon": "question",
                "color": "brackethighlighter.unmatched",
                "style": "highlight"
            },
            // User defined region styles
            "curly": {
                "icon": "curly_bracket",
                "color": "brackethighlighter.curly",
                "style": "highlight"
            },
            "round": {
                "icon": "round_bracket",
                "color": "brackethighlighter.round",
                "style": "outline"
            },
            "square": {
                "icon": "square_bracket",
                "color": "brackethighlighter.square",
                "style": "outline"
            },
            "angle": {
                "icon": "angle_bracket",
                "color": "brackethighlighter.angle",
                "style": "outline"
            },
            "tag": {
                "icon": "tag",
                "color": "brackethighlighter.tag",
                "style": "outline"
            },
            "single_quote": {
                "icon": "single_quote",
                "color": "brackethighlighter.quote",
                "style": "outline"
            },
            "double_quote": {
                "icon": "double_quote",
                "color": "brackethighlighter.quote",
                "style": "outline"
            },
            "regex": {
                "icon": "regex",
                "color": "brackethighlighter.quote",
                "style": "outline"
            }
      }
}

Monokai Extended.sublime-package添加的代码

<!-- BEGIN Bracket Highlighter plugin color modifications -->
<dict>
    <key>name</key>
    <string>Bracket Default</string>
    <key>scope</key>
    <string>brackethighlighter.default</string>
    <key>settings</key>
    <dict>
        <key>foreground</key>
        <string>#FFFFFF</string>
        <key>background</key>
        <string>#A6E22E</string>
    </dict>
</dict>

<dict>
    <key>name</key>
    <string>Bracket Unmatched</string>
    <key>scope</key>
    <string>brackethighlighter.unmatched</string>
    <key>settings</key>
    <dict>
        <key>foreground</key>
        <string>#FFFFFF</string>
        <key>background</key>
        <string>#FF0000</string>
    </dict>
</dict>

<dict>
    <key>name</key>
    <string>Bracket Curly</string>
    <key>scope</key>
    <string>brackethighlighter.curly</string>
    <key>settings</key>
    <dict>
        <key>foreground</key>
        <string>#FF00FF</string>
    </dict>
</dict>

<dict>
    <key>name</key>
    <string>Bracket Round</string>
    <key>scope</key>
    <string>brackethighlighter.round</string>
    <key>settings</key>
    <dict>
        <key>foreground</key>
        <string>#E7FF04</string>
    </dict>
</dict>

<dict>
    <key>name</key>
    <string>Bracket Square</string>
    <key>scope</key>
    <string>brackethighlighter.square</string>
    <key>settings</key>
    <dict>
        <key>foreground</key>
        <string>#FE4800</string>
    </dict>
</dict>

<dict>
    <key>name</key>
    <string>Bracket Angle</string>
    <key>scope</key>
    <string>brackethighlighter.angle</string>
    <key>settings</key>
    <dict>
        <key>foreground</key>
        <string>#02F78E</string>
    </dict>
</dict>

<dict>
    <key>name</key>
    <string>Bracket Tag</string>
    <key>scope</key>
    <string>brackethighlighter.tag</string>
    <key>settings</key>
    <dict>
        <key>foreground</key>
        <string>#FFFFFF</string>
        <key>background</key>
        <string>#0080FF</string>
    </dict>
</dict>

<dict>
    <key>name</key>
    <string>Bracket Quote</string>
    <key>scope</key>
    <string>brackethighlighter.quote</string>
    <key>settings</key>
    <dict>
        <key>foreground</key>
        <string>#56FF00</string>
    </dict>
</dict>
<!-- END Bracket Highlighter plugin color modifications -->

本文源链接:http://zhenchen.me/technology/2014/11/05/sublime-text-introduction.html

上一篇下一篇

猜你喜欢

热点阅读