文章目录

  • ​​一.安装​​
  • ​​1. 下载安装包​​
  • ​​2. 安装​​
  • ​​3. 取消提醒​​
  • ​​二. 问题解决​​
  • ​​4. 设置中文​​
  • ​​5. 中文输入​​
  • ​​6. 使用Package Control下载程序​​
  • ​​anaconda快捷键​​
  • ​​7. 配置常用快捷键​​
  • ​​8. 取消更新​​
  • ​​9 创建Python编译运行​​
  • ​​10. 中文输入法,退格键删除不了拼音​​
  • ​​11.tab转换为空格​​
  • ​​12. install无法使用​​
  • ​​13. 函数创建后, 自动生成函数注释​​
  • ​​三. 创建编译运行环境​​
  • ​​14. 创建python编译运行环境 (win10子系统Ubuntu18中conda环境)​​
  • ​​15. 创建java编译运行环境 (win10子系统Ubuntu18)​​
  • ​​16. 创建c++ 编译运行环境 (win10子系统)​​

一.安装

1. 下载安装包

Ubuntu下面的安装包​​点击这里下载​​ win10下面的安装包​​点此下载​

2. 安装

  • Ubuntu安装
    进入到​​​sublime-text_build-3083_amd64.deb​​​路径下
    执行命令: ​​​$ sudo dpkg -i sublime-text_build-3083_amd64.deb​
  • win10安装
    直接解压到本地路径下即可

3. 取消提醒

打开软件, 点击右上角帮助, 在licen中输入​​ke.y.txt​​的内容

二. 问题解决

4. 设置中文

点击preference --> 第一个,浏览程序包---->进入.config/sublime-text-3/packages/

然后退回到.config/sublime-text-3/在进如installed Packages/路径下,

将包​​Default.sublime-package​​进去, 如下图

sublim text3的安装使用_python

5. 中文输入

首先安装输入法:
​Ubuntu搜狗输入法安装全解​​

使用git工具下载github工具

$ sudo apt-get git
$ git clone https://github.com/lyfeyaj/sublime-text-imfix.git
$ cd sublime-text-imfix && ./sublime-imfix

如果无法下载github, 可以下载下面的链接
​sublime-text-imfix.git.zip​​ 执行完上一步正常来讲就已经成功了, 此时打开subl就可以输入中文了

$ sudo cp ./lib/libsublime-imfix.so /opt/sublime_text_3/
$ subl /usr/bin/subl
修改subl配置文件如下
#!/bin/sh
export LD_PRELOAD=/opt/sublime_text_3/libsublime-imfix.so
exec /opt/sublime_text/sublime_text "$@"
然后重启就可使用了

6. 使用Package Control下载程序

点击preference --> 浏览程序包

将压缩包里面的Package Control放到打开的目录下

sublim text3的安装使用_python_02

然后就会发现界面preference 下拉中出现了Package Control

这个时候我们就能开始下载插件了

例如
Python的常见插件有
Anaconda
使用快捷键ctr+shift+P
等待输入框输入install
等待新输入框输入Anaconda
等待下载安装完毕

anaconda快捷键

alt+ctr+Q等号对齐
alt+ctr+G函数跳转定位

配置ctr+鼠标左键跳转定位函数, 增加如下路径文件

[
{
"button": "button1",
"count": 1,
"modifiers": ["ctrl"],
"press_command": "drag_select",
"command": "anaconda_goto"
},
{
"button": "button2",
"count": 1,
"modifiers": ["ctrl"],
"command": "jump_back"
},
]

sublim text3的安装使用_java_03

### anaconda取消框框提示, usr-设置中添加

​{ "anaconda_linting": false, }​

sublim text3的安装使用_python_04

7. 配置常用快捷键

preference–> 按键绑定-用户

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

{
"keys": ["f5"],
"caption": "SublimeREPL:Python",
"command": "run_existing_window_command", "args":
{
"id": "repl_python_run",
"file": "config/Python/Main.sublime-menu"
}
},
//自动提示代码
{
"keys": ["ctrl+j"],
"command": "code_intel_auto_complete"
},
//跳转到函数定义
{
"keys": ["alt+right"],
"command": "goto_python_definition"
},
//返回到跳转位置
{
"keys": ["alt+left"],
"command": "back_to_python_definition"
},
{ "keys": ["enter"], "command": "auto_indent_tag", "context":
[
{ "key": "setting.auto_indent", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "punctuation.definition.tag.begin", "match_all": true },
{ "key": "preceding_text", "operator": "regex_contains", "operand": ">$", "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^</", "match_all": true },
]
},
{ //删除当前行
"keys" : ["ctrl+d"],
"command" : "run_macro_file",
"args" : {
"file" : "res://Packages/Default/Delete Line.sublime-macro",
}
},
{ //复制当前行
"keys": ["ctrl+e"],
"command": "duplicate_line",
},
{ //向上移动当前行
"keys": ["alt+up"],
"command": "swap_line_up"
},
{ //向上移动当前行
"keys": ["alt+down"],
"command": "swap_line_down"
},
]

8. 取消更新

取消每次打开软件更新提醒

preference–> 设置-用户

{
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"font_size": 17,
"ignored_packages":
[
"Vintage"
],
"update_check": false
}

9 创建Python编译运行

工具–》 编译系统–》 新建编译系统–》
解释: cmd是系统命令行
这个语句的含义就是在系统命令行键入
python3 当前文件

{
"cmd": ["python3", "-u", "$file"]
}

sublim text3的安装使用_运行环境_05

10. 中文输入法,退格键删除不了拼音

首选项->设置用户->打开设置json

sublim text3的安装使用_运行环境_06

11.tab转换为空格

首选项->设置

{
"color_scheme": "Packages/Color Scheme - Default/Monokai.sublime-color-scheme",
"default_encoding": "UTF-8",
"font_face": "Consolas",
"font_size": 21,
"ignored_packages":
[
"Vintage"
],
"show_encoding": true,
"show_line_endings": true,
"theme": "Default.sublime-theme",
"update_check": false,
"tab_size": 4, //设置4个
"translate_tabs_to_spaces": true, //设置tab转化为空格
"expand_tabs_on_save": true, //保存时自动转换
}

12. install无法使用

sublim text3的安装使用_运行环境_07

13. 函数创建后, 自动生成函数注释

sublim text3的安装使用_运行环境_08

  • 安装docblocker插件
  • 首选项->设置->docblocker->用户设置->设置格式
{
"jsdocs_extra_tags":[
"@Author zjq",
"@DateTime {{date}}",
"@copyright ${1:[copyright]}",
"@license ${1:[license]}",
"@version ${1:[version]}"
],
"jsdocs_function_description": false
}

三. 创建编译运行环境

由于所有的编程环境都在win10子系统里面创建的, 所以编译运行环境都是连接到win10子系统的

14. 创建python编译运行环境 (win10子系统Ubuntu18中conda环境)

sublim text3的安装使用_python_09

{
"working_dir": "$file_path", //工作路径
"cmd": "wsl /home/zjq/miniconda3/bin/python3 \"$file_name\" ", //调用wsl里面的conda环境中的python3
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", //可选。 Perl格式的正则表达式可以获取 cmd 的错误输出
"selector": "source.py", //可选。输出 cmd 的编码。必须是合法的Python编码,缺省为 UTF-8 。
"variants":[ //用来替代主构建系统的备选。
{
"name": "Syntax Check",
"shell_cmd": "/home/zjq/miniconda3/bin/python3 -m py_compile \"$file_name\"",
}]
}

15. 创建java编译运行环境 (win10子系统Ubuntu18)

与上一节的创建python环境一样, 在​​工具->编译系统->新建编译系统​​输入下面的代码

{
"cmd" : ["bash", "-c", "javac ${file_name} && java ${file_base_name} && rm ${file_base_name}.class"],
"shell": true,
"working_dir": "${file_path}",
}

含义: 如果运行一个名为test.java的java代码, 执行顺序是:

javac test.java //会生成test.class
java test //运行test代码
所以 上面的编译系统命令顺序是
javac ${file_name} 等价于 javac test.java # file_name是当前文件名称
java ${file_base_name} 等价于 java test # file_base_name是当前文件名称不带后缀
rm ${file_base_name}.class 等价于 rm test.java # rm 目的是为了删除运行时生成的中间文件

16. 创建c++ 编译运行环境 (win10子系统)

{
// "cmd" : ["bash", "-c", "g++ ${file_name} && ./${file_name} && rm ${file_name}"],
"cmd" : ["bash", "-c", "g++ '${file_name}' -o '${file_base_name}' && ./'${file_base_name}' && rm '${file_base_name}'"],
"shell": true,
"working_dir": "${file_path}",
}