Sublime Text 4 安装

packagecontrol.io 被墙, 无法争取安装扩展包

1 安装完成 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://www.miaoqiyuan.cn/products/proxy.php/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)

2 打开设置

Preferences > Package Settings > Package Control > Settings - User

image.png

image.png

输入并保存:

如果下面的地址无效时, 请在网上寻找其他的地址

"channels":
    [
        "https://raw.githubusercontent.com/HBLong/channel_v3_daily/master/channel_v3.json"
    ],

3 安装扩展, 快捷键 Ctrl+Shift+P

输入 install 并选择


install.png

4 搜索安装包

输入 ChineseLocalizations (简体汉化包)

其他

配置 python 环境, 使用 CTRL + B 运行

打开 Tools > Build System > New Build System 如下图所示:

image.png

输入以下内容:
D:/Anaconda/envs/py34/python.exe 为 python 安装目录

{
    "encoding": "utf-8",
    "working_dir": "$file_path",
    "cmd": ["D:/Anaconda/envs/py34/python.exe", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.pythona",
    "shell": "true"
}

然后 Ctrl + S 直接保存为想要命名的编译名称 (如: py34.sublime-build)

编译系统选择 py34
然后按 CTRL + B 运行

注: 如果有多个python版本, 以类似的方式保存成不同的编译文件名即可

设置

{
    "save_on_focus_lost": true,
     # 显示空白字符, 主要用于区别 tab 和 空格
    "draw_white_space": "all",  
    # "python_interpreter": "D:/anaconda3/python.exe",
    # "anaconda_linting": false,
    "pep8": false,
    "ignored_packages":
    [
        "Vintage",
    ],
    "color_scheme": "Latte.sublime-color-scheme",
    "theme": "Default.sublime-theme",
    "dark_color_scheme": "ayu-light.sublime-color-scheme",
    "light_color_scheme": "Breakers.sublime-color-scheme",
}

常用插件记录

左侧右键菜单加强

SideBarEnhancements
或者
SideBarTools

python解析器提示

Anaconda

左侧文件图标

A File Icon

python 文件格式化

python-black

自动添加头部注释

FileHeader

设置 ...FileHeader -> Settings - User

{
    "Default": {
        "author": "ZHANG SAN"
    }
}

修改模板, 想备份的话备份下
...\Sublime Text\Packages\FileHeader\template\header\Python.tmpl

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Author: {{author}}
# @Date:   {{create_time}}
# @Last Modified time: {{last_modified_time}}

def main():
    pass

if __name__ == '__main__':
    main()

命令行终端

Terminus

参考地址

https://github.com/HBLong/channel_v3_daily

你可能感兴趣的:(Sublime Text 4 安装)