Windows10系统SublimeText3安装及一些常用插件安装配置

千万注意配置文件中勿用中文标点符号

3211版本注册码:
请自寻搜索

一、安装插件安装控制

依次点击View—>Show Console
输入以下内容:

1
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)

或者直接ctrl+shift+p,选择安装Package Control

二、安装SublimeTmpl模板插件

  1. ctrl+alt+h html5模板
  2. ctrl+alt+j js模板
  3. ctrl+alt+c css模板
  4. ctrl+alt+p php模板
  5. ctrl+alt+r ruby模板
  6. ctrl+alt+shift+p python模板

三、sublimeSideBar插件

sublime text 3 localhost 配置

1. 安装侧边栏增强插件

安装 sublimeSideBar 侧边栏增强插件。
ctrl+shift+p,选择安装Package Control:Install Package,搜索该插件安装

2. 安装并配置SideBarEnhancements 插件

ctrl+shift+p,选择安装Package Control:Install Package,搜索该插件安装,SideBarEnhancements 插件安装完成后,首先为 SideBarEnhancements 指定默认浏览器。【见4.指定默认浏览器】

3. 配置php环境

工具—>系统编译—>新编译系统替换内容为:

1
2
3
4
5
{
"cmd": ["php", "$file"],
"file_regex": "php$",
"selector": "source.php"
}

另存文件—>文件夹默认—>文件名php.sublime-build

4. 指定默认浏览器

打开Preference—>Package Settings—>Side Bar—>Settings User-User
【如果在热键绑定browser: chrome中设置,在此可以不设置,即省略此步】
//单浏览器预览本地服务器url

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
"default_browser": "chrome"
}
//多浏览器预览本地服务器url
{
"open_all_browsers": [
"firefox",
"firefox-developer-edition",
"chrome",
"opera",
"safari",
"ie",
"edge"
],
}

5. 指定默认localhsot目录

SideBarEnhancements指定默认localhsot目录。 在侧边栏任意文档上点击鼠标右键,选择Project—>Edit Preview URLs 【多站点配置】【文件名SideBarEnhancements.json

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{
"F:\\php":
{
"url_testing": "http://localhost:8090/",
"url_production": "http://localhost:8090/"
},
"J:\\WebSite\\SSCMS":
{
"url_testing": "http://localhost:8080/",
"url_production": "http://localhost:8080/"
},
"E:\\WebSites\\gdjy_test":
{
"url_testing": "http://localhost:8081/",
"url_production": "http://localhost:8081/"
},
"E:\\WebSites\\test":
{
"url_testing": "http://localhost:8082/",
"url_production": "http://localhost:8082/"
}
}
}

6. 热键绑定

打开Preference—>Package Settings—>Side Bar—>key Bindings-User

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
[
{
"keys": ["alt+m"],
"command": "markdown_preview",
"args":
{
"target": "browser",
"parser":"markdown"
}
},
{
"keys": ["f1"],
"caption": "Python",
"command": "repl_open",
"args":
{
"type": "subprocess",
"encoding": "utf8",
"cmd": ["py", "-i", "-u"],
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "python",
"extend_env":
{
"PYTHONIOENCODING": "utf-8"
}
}
},

{
"keys": ["f2"],
"caption": "Py2",
"command": "repl_open",
"args":
{
"type": "subprocess",
"encoding": "utf8",
"cmd": ["py2", "-i", "-u"],
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "python",
"extend_env":
{
"PYTHONIOENCODING": "utf-8"
}
}
},
{
"keys": ["f3"],
"command": "repl_open",
"caption": "Python - RUN current file",
"id": "repl_python_run",
"mnemonic": "R",
"args":
{
"type": "subprocess",
"encoding": "utf8",
"cmd": ["py", "-u", "$file_basename"],
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "python",
"extend_env":
{
"PYTHONIOENCODING": "utf-8"
}
}
},

{
"keys": ["f4"],
"command": "repl_open",
"caption": "Python - RUN current file",
"id": "repl_python_run",
"mnemonic": "R",
"args":
{
"type": "subprocess",
"encoding": "utf8",
"cmd": ["py2", "-u", "$file_basename"],
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "python",
"extend_env":
{
"PYTHONIOENCODING": "utf-8"
}
}
},
{
"keys": ["ctrl+f5"],
"command": "side_bar_open_in_browser",
"args":
{
"paths": [],
"type": "testing",
"browser": "ie"
}
},
{
"keys": ["f5"],
"command": "side_bar_open_in_browser",
"args":
{
"paths": [],
"type": "testing",
"browser": "firefox",
}
},
{
"keys": ["f6"],
"command": "side_bar_open_in_browser",
"args":
{
"paths": [],
//"application": "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
"type": "testing",
"browser": "",
}
},
{
"keys": ["ctrl+shift+c"],
"command": "copy_path"
},

]

四、安装SublimeREPL模板插件

CTRL + B绑定python
1、打开Preference—>Package Settings—>REPL user
输入以下内容:

1
2
3
4
{
"default_extend_env":{"PATH":"{PATH};"},
"show_transferred_text":true
}

命名并保存,如:replPy.sublime-settings
2、打开Tools—>Bulid System—>New System
输入以下内容:

1
2
3
4
5
{
"target": "run_existing_window_command",
"id": "repl_python_run",
"file": "config/python/Main.sublime-menu"
}

命名并保存,如:ReplPy.sublime-build

五、Anaconda python语法自动填充插件

打开Preference—>Package Settings—>Anaconda user

1
2
3
4
5
6
7
8
{
"python_interpreter": "E:/Program Files/Python3/python.exe",
"suppress_word_completions":true,
"suppress_explicit_completions":false,
"complete_parameters":false, //解决自动填充参数过多
"swallow_startup_errors": true, //解决启动错误
"anaconda_linting": false, //解决白框
}

其他插件
前端
极速生成html代码插件 Emmet
代码自动补全插件 SublimeCodeIntel
资源查看器插件 PackageResourceViewer
可修改插件配置
【【【【千万注意勿用中文标点符号】】】】

六、IIS配置PHP环境

(一)安装配置PHP

1、首先到php上下载phpPhp官网链接,windows download (版本根据自己的需要定)
2、下载php-7.3.6-nts-Win32-VC15-x86(根据情况自行选择32/64位)
3、解压进入解压目录,找到php.ini-development这个文件,可以直接改名为php.ini文件,修改配置将需要配置的去掉前面的;启用配置:
如:On windows: extension_dir = E:\\Program Files\\PHP\\php-7.3.6-nts-VC15\\ext(放置扩展的目录)

1
2
3
4
5
6
7
8
9
10
extension=odbc
extension=openssl
extension=pdo_firebird
extension=pdo_mysql
extension=pdo_oci
extension=pdo_odbcs
extension=pdo_pgsql
extension=pdo_sqlite
extension=pgsql ;配置支持MSSQL
extension=php_sqlsrv_73_nts_x86 extension=php_sqlsrv_73_ts_x86 extension=php_pdo_sqlsrv_73_nts_x86 extension=php_pdo_sqlsrv_73_ts_x86

最后不要忘了设置session文件的存储目录配置:
文件里的默认设置是:; session.save_path=/tmp
目录要改一下,改成自己用来存放session文件的目录。 如:session.save_path=F:\\tmp. 配置完后保存退出,还要设置一下F:\\tmp文件夹的权限,不然会提示错误。
文件夹属性安全给IIS_IUSRS用户授权

(二)安装配置IIS

1、控制面板-→程序-→打开或关闭Windows功能-→Internet信息服务 【确保勾选IIS管理控制台万维网服务中的应用程序开发功能-→CGI
2、配置PHP运行环境: 启动IIS信息管理器-→处理程序映射-→添加模块映射-→请求路径:*.php;模块:FastCgiModule;
可执行文件:解压的PHP目录下php-cgi.exe”;名称:PHP

七、PHP配置连接MSSQL扩展

1、下载SQL Server驱动4.0 SQL Server驱动4.0下载地址放到php安装目录下的ext目录下,并给php.ini添加配置.在前面第六部分IIS配置PHP环境

2、安装ODBC驱动11 ODBC驱动下载地址

3、测试数据库连接

sqlsrv_connect

1
2
3
4
5
6
7
8
9
10
11
<?php
$serverName = localhost, 1433; //serverName\instanceName, portNumber (default is 1433)
$connectionInfo = array( Database=>PHP, UID=>sa, PWD=>xxxxx);
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
echo 连接成功.<br />;
}else{
echo 连接出现错误.<br />;
die( print_r( sqlsrv_errors(), true));
}
?>

PDO连接

1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
$servername = localhost;
$username = sa;
$password = XXXXXX;

try {
$conn = new PDO(sqlsrv:Server=$servername;, $username, $password);
echo PDO连接方式连接成功;
}
catch(PDOException $e)
{
echo '连接失败:'. $e->getMessage();
}

③、odbc_connect 测试连接access

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
// Microsoft SQL Server using the SQL Native Client 10.0 ODBC Driver - allows connection to SQL 7, 2000, 2005 and 2008
// $db=f:/asp/siteserver_install/gdjy/students.mdb;
$mdbFilename=f:/asp/siteserver_install/gdjy/students.mdb;
$username = oooooo; //用户名
$password = xxxxx; //密码
$connection = odbc_connect(Driver={Microsoft Access Driver (*.mdb)};Dbq=$mdbFilename, $username, $password);
// try {
// $connection = odbc_connect(Driver={Microsoft Access Driver (*.mdb)};Dbq=$mdbFilename, $username, $password);
// echo 连接成功;
// }catch(odbc_connect $e)
// {
// echo '连接失败:'. $e->getMessage();
// }
if ($connection) {
echo 连接成功.;
} else{
die(Connection could not be established.);
}