一、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 WeberSingle User LicenseEA7E-855605813A03DD 5E4AD9E6 6C0EEB94 BC99798F942194A6 02396E98 E62C9979 4BB979FE91424C9D A45400BF F6747D88 2FB8807890F5CC94 1CDC92DC 8457107A F151657B1D22E383 A997F016 42397640 33F41CFCE1D0AE85 A0BBD039 0E9C8D55 E1B89D5D5CDB7036 E56DE1C0 EFCC0840 650CD3A6B98FC99C 8FAC73EE D2B95564 DF450523------ END LICENSE ------