zoukankan      html  css  js  c++  java
  • sublime text 3 环境设置

     1. 设置build system 环境

     tool -> build system -> new build system ,粘贴以下代码并保存

    {
    "cmd":["python.exe", "-u", "$file"],
    "path":"C:/Users/Sablier/AppData/Local/Programs/Python/Python37", 
    // 注意:路径根据自己的python安装路径而定 "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)", "selector": "source.python", "encoding": "cp936" ,
    // 识别中文环境 }

    //ctrl + B 执行程序
    //ctrl + shift + c 终止程序
    //ctrl + shift + P 加载控制台

    2.为cancel build 建立快捷键

    tool - > cancel build
    可中止程序运行
    快捷键中是ctrl+break
    然而现在的大多数键盘已经不好按break键了,于是要修改键位
    preferences - > key bindings
    在左边搜索cance_build,模仿左边的语法在右边加上自己的自定义

    { "keys": ["ctrl+shift+c"], "command": "cancel_build" },

      

    3. 安装sublime REPL 交互插件

    1. Ctrl+shift+p,在弹出的对话框中输入 packages control 安装 packages control 环境, 并重启sublime

    2. Ctrl+shift+p,在弹出的对话框中输入install packages 等待 packages control 初始化完成,键入sublime REPL 搜索并安装。重启sublime。

    3. 配置 python3 运行环境(如果电脑上只有一个版本的python,则可以不用执行。如果同时有 python2 和 3 则需要配置单独的 python3 启动环境)

      Packages -> Browse Package 找到 SublimeREPL的文件夹 -> config (语言版本文件夹),新建 python3 文件夹;

      进入python3文件夹,新建 Default.sublime-commands 和 Menu.sublime-menu 两个文件(模仿Python文件夹);

      在 Default.sublime-commands 中黏贴以下数据并保存:

    // 我们Python3目前只需要能打开shell运行,和运行这个脚本,两个功能,因此就只要包含Python3.5 和 Python3.5 – Run current file两项就好了(本行不要复制)
    
    [
    {
    "caption": "SublimeREPL: Python3",
    "command": "run_existing_window_command", "args":
    {
    "id": "repl_python3",
    "file": "config/Python3/Main.sublime-menu"
    }
    },
    
    {
    "caption": "SublimeREPL: Python3 - RUN current file",
    "command": "run_existing_window_command", "args":
    {
    "id": "repl_python3_run",
    "file": "config/Python3/Main.sublime-menu"
    }
    }
    ]

      在 Menu.sublime-menu 中粘贴以下数据并保存:

    [
    {
    "id": "tools",
    "children":
    [{
    "caption": "SublimeREPL",
    "mnemonic": "R",
    "id": "SublimeREPL",
    "children":
    [{
    "caption": "Python3", "id": "Python3", "children":
    [{
    "command": "repl_open", "caption": "Python3", "id": "repl_python3", "mnemonic": "P", "args": { "type": "subprocess", "encoding": "utf8", "cmd": ["python3", "-i", "-u"], "cwd": "$file_path", "syntax": "Packages/Python/Python.tmLanguage", "external_id": "python3", "extend_env": {"PYTHONIOENCODING": "utf-8"} } }, {
    "command": "repl_open", "caption": "Python3 - RUN current file", "id": "repl_python3_run", "mnemonic": "R", "args": { "type": "subprocess", "encoding": "utf8", "cmd": ["python3", "-u", "$file_basename"], "cwd": "$file_path", "syntax": "Packages/Python/Python.tmLanguage", "external_id": "python3", "extend_env": {"PYTHONIOENCODING": "utf-8"} } } ]} ] }] } ]

      

    4. preferences - > key bindings 粘贴以下代码,注意只能有一个[],设定F5为sublimeREPL -> python3 -> RUN current file 快捷键。

    {
    "keys":["f5"],
    "caption": "SublimeREPL: Python3 - RUN current file",
    "command": "run_existing_window_command",
    "args":{
    "id": "repl_python3_run",
    "file": "config/Python3/Main.sublime-menu"
    }
    }    
  • 相关阅读:
    5.9上午
    5.4下午
    5.4上午
    5.2上午
    4.19下午
    4.18上午
    4.17下午
    4.17上午
    4.12下午
    4.13下午
  • 原文地址:https://www.cnblogs.com/sablier/p/10662770.html
Copyright © 2011-2022 走看看