sublime text 3 编辑器 perl支持

1. 下载sublime text 3的最新版本,安装,注册。

2. 下载包Package Control和ConvertToUTF8,然后解压放到Preferences->Browse Package所在的目录即完成了插件的安装(通常网络方式安装可能失败)。

对于perl,中文希望构建GBK的生态系统。修改ConvertToUTF8.sublime-settings中的

	// Encoding for new file, empty means using sublime text's "default_encoding" setting
	"default_encoding_on_create" : "GBK",

让新建的文件用GBK编码。

3. 新建perl.sublime-build支持perl的编译,输出也是GBK

{
     "cmd": ["wperl", "$file"],
     "file_regex": ".* at (.*) line ([0-9]*)",
     "selector": "source.perl",
     "encoding": "GBK"
}

4. 自定义设置

{
    "color_scheme": "Packages/Color Scheme - Default/Sunburst.tmTheme",
    "font_face": "DejaVu Sans Mono",
    "font_size": 10,    
    "tab_size": 4,    
    "translate_tabs_to_spaces": true,
    "tab_completion": false
}

5. 自定义一些快捷键

[
    {"keys": ["tab"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
        [
            { "key": "following_text", "operator": "regex_contains", "operand": "^[)\\]\\>\\'\\\"\\ %>\\}\\;\\,]", "match_all": true },
            { "key": "preceding_text", "operator": "not_regex_match", "operand": "^.*\\{$", "match_all": true  },
            { "key": "setting.tab_completion", "operator": "equal", "operand": false }
        ]
    },
    { "keys": ["ctrl+q"], "command": "toggle_comment", "args": { "block": false } },

    { "keys": ["f1"], "command": "show_panel", "args": {"panel": "output.exec"},
        "context":
        [
            { "key": "panel_visible", "operator": "equal", "operand": false }
        ]
    },
    { "keys": ["f1"], "command": "hide_panel", "args": {"panel": "output.exec"},
        "context":
        [
            { "key": "panel_visible", "operator": "equal", "operand": true }
        ]
    },
    { "keys": ["alt+,"], "command": "next_view_in_stack" },
    { "keys": ["alt+."], "command": "prev_view_in_stack" },
]

关于tab键的设置非常讲究,自已琢磨。OK

sublime text 3 编辑器 perl支持_第1张图片

 也可以使用一个perl的语法高亮插件,效果会更好:

ModernPerl

Install

  1. Install this package with Package Control (or otherwise).
  2. In Sublime, use View > Syntax > Open all with current extension as... to reopen all current Perl files with ModernPerl.
  3. Fresh Perl files should automatically open with ModernPerl, while Perl files that have previously been opened with Sublime will tend to keep the syntax they were last opened with.

    To check this, open a Perl file that has never been opened with Sublime before (create a new.pl file if necessary), and check that it opens with ModernPerl.

  4. If fresh files do not open with ModernPerl, use Preferences > Settings – Syntax Specific – User on afile opened with ModernPerl to open upModernPerl.sublime-settings and put the following into it:

    { "extensions": ["pl", "PL", "pm", "pod", "t"] }

  5. Whenever you open a Perl file that has previously been opened with Sublime, check which syntax it opens with, and manually switch it to ModernPerl if necessary. 

第一步都可以用拷贝的方式安装。

 color着色主题包下载:

http://colorsublime.com/

你可能感兴趣的:(Perl)