TracerLee / tracerlee.github.io

Personal blog written by Tracer
4 stars 0 forks source link

Sublime Text #2

Open TracerLee opened 8 years ago

TracerLee commented 8 years ago

记录一些sublime text的技巧。

个人的sublime text配置

{
    "color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme",
    "font_size": 10,
    "ignored_packages":
    [
        "Markdown",
        "Vintage"
    ],
    "material_theme_small_statusbar": true,
    "material_theme_small_tab": true,
    "theme": "Material-Theme.sublime-theme",
    "highlight_line": true,
    "word_wrap": true,
    "auto_upgrade_ignore": ["Material Theme"],
    "tab_size": 2,
    "translate_tabs_to_spaces": true
    //set proxy
    //"http_proxy": "http://127.0.0.1:1087",
    //"https_proxy": "http://127.0.0.1:1087"
}

快捷键

[
    // 默认配置增强
    { "keys": ["alt+shift+c"], "command": "clone_file" },
    { "keys": ["ctrl+alt+shift+o"], "command": "prompt_open_folder" },
    { "keys": ["ctrl+shift+o"], "command": "prompt_add_folder" },
    { "keys": ["ctrl+alt+e"], "command": "open_dir", "args": { "dir": "$file_path", "file": "$file_name" } },
    { "keys": ["ctrl+alt+up"], "command": "select_lines", "args": { "forward": false } },
    { "keys": ["ctrl+alt+down"], "command": "select_lines", "args": { "forward": true } },
    { "keys": ["ctrl+up"], "command": "scroll_lines", "args": { "amount": 6.0 } },
    { "keys": ["ctrl+down"], "command": "scroll_lines", "args": { "amount": -6.0 } },

    // alignment
    { "keys": ["ctrl+alt+d"], "command": "alignment" },

    // 浏览器打开配置
    {
        "keys": ["f12"],
        "command": "side_bar_files_open_with",
        "args": {
            "paths": [],
            "application": "F:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",
            "extensions": ".*" //any file with extension
        }
    }, {
        "keys": ["ctrl+f11"],
        "command": "side_bar_files_open_with",
        "args": {
            "paths": [],
            "application": "F:\\Program Files\\Internet Explorer\\iexplore.exe",
            "extensions": ".*" //any file with extension
        }
    }, {
        "keys": ["f9"],
        "command": "side_bar_files_open_with",
        "args": {
            "paths": [],
            "application": "D:\\Program Files (x86)\\360Chrome\\Chrome\\Application\\360chrome.exe",
            "extensions": ".*" //any file with extension
        }
    },

    {
        // 在jsx里面使用emmmet
        "keys": ["tab"],
        "command": "expand_abbreviation_by_tab",
        "context": [{
            "operand": "source.js",
            "operator": "equal",
            "match_all": true,
            "key": "selector"
        }, {
            "key": "selection_empty",
            "operator": "equal",
            "operand": true,
            "match_all": true
        }]
    },
    // 在jsx里面使用emmmet
    {
        "keys": ["tab"],
        "command": "next_field",
        "context": [
            { "key": "has_next_field", "operator": "equal", "operand": true }
        ]
    }

    // linter
    { "keys": ["alt+shift+n"], "command": "sublimelinter_goto_error", "args": { "direction": "next" } },
    { "keys": ["alt+shift+p"], "command": "sublimelinter_goto_error", "args": { "direction": "previous" } },
    { "keys": ["alt+shift+a"], "command": "sublimelinter_show_all_errors" },
    { "keys": ["alt+shift+t"], "command": "sublimelinter_toggle_linter", "args": { "which": "all" } },

    // svn
    { "keys": ["alt+l"], "command": "svn_log" },
    { "keys": ["alt+d"], "command": "svn_diff" }
]
TracerLee commented 8 years ago

设置单行高亮

{
    "highlight_line": true
}
TracerLee commented 8 years ago

使用Quick Switch Project来切换多个项目

// 快捷键设置
{ "keys": ["ctrl+alt+p"], "command": "prompt_select_workspace" }
TracerLee commented 8 years ago

获取快捷键名称的方法

打开命令行`ctrl +``

输入sublime.log_commands(True)

TracerLee commented 8 years ago

默认制表符改为2个空格

{
  "tab_size": 2,
  "translate_tabs_to_spaces": true
}
TracerLee commented 7 years ago

改为大写:ctrl + KU 改为小写:ctrl + KL

TracerLee commented 7 years ago

常用插件

Package Desc
DocBlockr 智能注释
Emmet 智能html编辑
Git Git集成环境
JsFormat JavaScript格式化
Material Theme 一款不错的主题
SublimeLinter 代码检查框架
SublimeLinter-jshint JavaScript代码检查
TortoiseSVN SVN集成环境
Vue Syntax Highlight Vue组件语法高亮
Alignment 代码对齐
... ...
... ...
TracerLee commented 6 years ago

在文件夹的右键菜单上添加一个”Sublime Text 3 打开“

image

image

image

image

image

参考: http://blog.csdn.net/sogoe12345/article/details/43836339


同理新建项到 HKEY_CLASSES_ROOT\*\shell 下可以设置文件的右键

TracerLee commented 6 years ago

Package Install

SUBLIME TEXT 3

Ctrl + ~

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)