一、fpc安装
1. 下载:http://www.freepascal.org/down/i386/win32.var(或者:http://download.csdn.net/detail/wenph2008/8916963)
2. 安装:双击安装
3. 写一个测试代码:pascal_test.pas在桌面
4. 测试编译:成功!
5. 运行:成功!
6. 加环境变量
右键“我的电脑”->“属性”->“高级系统设置”->“环境变量”->双击“系统变量”里的“Path”->把fpc.exe的路径复制进去,记得用分号隔开。
7. 继续测试编译运行:成功!
二、sublime2安装
1. 下载:http://www.sublimetext.com/2(或者:http://download.csdn.net/detail/wenph2008/8916969)
2. 安装:双击安装
3. 修改tab为4个空格:Preferences->setting-default->
{
"tab_size": 4,
"translate_tabs_to_spaces":true
}
4. pascal语法高亮:
(1)下载语法高亮代码:https://packagecontrol.io/packages/Pascal(或者:http://download.csdn.net/detail/wenph2008/8916973)
(2)打开包管理地址:Preferences -> Browse Packages…
(3)新建一个文件夹:Installed Packages
(4)把刚才下载的解压到这个文件夹
(5)view->syntax选择Pascal即可
5. 集成编译运行
(1)新建一个build环境:Tool->Build System->New BuildSystem...
(2)把以下内容粘贴进去
I.编译和运行分开
{
"cmd":["fpc", "${file}","-o${file_path}/${file_base_name}.exe"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:?(.*)$",
"working_dir":"${file_path}",
"selector":"source.pascal",
"variants":
[
{
"cmd":["start", "cmd", "/c", "$file_base_name.exe& pause"],
"shell": true,
"name":"Run"
}
]
}
II.编译和运行在一起
{
"cmd":["fpc", "${file}","-o${file_path}/${file_base_name}.exe"],
"file_regex":"^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir":"${file_path}",
"selector":"source.pascal",
"variants":
[
{
"name":"Run",
"cmd":["cmd", "/c","fpc","${file}","-o${file_path}/${file_base_name}.exe","&&","${file_path}/${file_base_name}.exe"],
"shell": true
}
]
}
(3)保存为my_pascal_build_run.sublime-build,并且放在C:\Users\pinghua.wph\AppData\Roaming\Sublime Text2\Packages\User目录下。
6. 注册
Help里注册:
----- BEGIN LICENSE -----
Andrew Weber
Single User License
EA7E-855605
813A03DD 5E4AD9E6 6C0EEB94 BC99798F
942194A6 02396E98 E62C9979 4BB979FE
91424C9D A45400BF F6747D88 2FB88078
90F5CC94 1CDC92DC 8457107A F151657B
1D22E383 A997F016 42397640 33F41CFC
E1D0AE85 A0BBD039 0E9C8D55 E1B89D5D
5CDB7036 E56DE1C0 EFCC0840 650CD3A6
B98FC99C 8FAC73EE D2B95564 DF450523
------ END LICENSE ------