美文网首页
Ubuntu sublime使用笔记

Ubuntu sublime使用笔记

作者: 数学工具构造器 | 来源:发表于2018-04-26 08:32 被阅读0次

    1.安装package control

    1)安装方法

    在Sublime中打开View –> Show Console,将以下代码复制到输入框中后按回车键

    import urllib.request,os;pf=’Package Control.sublime-package’;ipp=sublime.installed_packages_path();urllib.request.install_opener(urllib.request.build_opener(urllib.request.ProxyHandler()));open(os.path.join(ipp,pf),’wb’).write(urllib.request.urlopen(‘[http://sublime.wbond.net/](http://sublime.wbond.net/)‘+pf.replace(’ ‘,’%20’)).read())
    

    2)验证是否安装成功

    打开Preferences –> Package Control,如果能看到此菜单,则表示安装成功


    2.基本设置

    1)设置代码提示

    "auto_complete": true,
    "auto_match_enabled": true
    

    2)配置 Python3 的Build路径:

    新建一个build system,贴上代码:

    {
    "cmd": ["/usr/bin/python3", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python"
    }
    

    保存为Python3.sublime.build 文件

    3)配置sublimeREPL的Python3路径

    为了方便进行交互式编程,所以配置sublimeREPL的Python3路径
    打开preference>browser package,或者在资源管理器中打开以下目录:

    /root/.config/sublime-text-3/Packages/SublimeREPL/config

    新建一个Python3文件夹
    新建Default.sublime-commands文件,贴上代码:

    [
    {
    "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"
    }
    }
    ]
    

    新建Main.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"}
    }
    },
    // run files
    {"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"}
    }
    }
    ]}
    ]
    }]
    }
    ]
    

    3.必装插件

    • SublimeREPL
    • SublimeGDB

    Sublime Text 3 使用 SublimeGDB 图形化调试c/c++程序
    gdb调试新手入门(一)

    相关文章

      网友评论

          本文标题:Ubuntu sublime使用笔记

          本文链接:https://www.haomeiwen.com/subject/eotplftx.html