1.找到keil的安装路径下的global.prop文件
2.备份一份这个文件即可复制粘贴
将这个文件打开,用下面的代码直接做替换。
# properties for all file types
indent.automatic=1
virtual.space=0
view.whitespace=0
view.endofline=0
code.page=936
caretline.visible=1
highlight.matchingbraces=1
print.syntax.coloring=1
use.tab.color=1
create.backup.files=0
auto.load.ext.modfiles=1
save.prj.before.dbg=0
save.files.before.dbg=0
function.scanner.project=1
function.scanner.files=1
function.scanner.modules=1
# properties for c/cpp files
syntax.colouring.cpp=1
use.tab.cpp=0
tabsize.cpp=4
line.margin.visible.cpp=1
fold.cpp=1
monospaced.font.cpp=1
# properties for asm files
syntax.colouring.asm=1
use.tab.asm=0
tabsize.asm=4
line.margin.visible.asm=1
monospaced.font.asm=1
# properties for other files
use.tabs=0
tabsize=4
line.margin.visible.txt=1
monospaced.font.txt=1
# setting for code completion and syntax check
cc.autolist=1
cc.highlightsyntax=1
cc.showparameters=1
cc.triggerlist=1
cc.triggernumchars=3
cc.enter.as.fillup=1
cc.usealpha4inactcode=1
cc.alphavalue=50
# autosave for editor files
autosave=1
autosave.interval=5
# vertical edge at right margin
edge.mode=0
edge.column=200
# Specification for text selection and caret line
selection.fore=#FFFFFF
selection.back=#FF0000
caret.fore=#FFFFFF
caret.back=#89324A
# Color for vertical edge
edge.colour=#C0DCC0
# C/C++ Editor files
template.cpp="#define","#define |";"#if","#if |\r\n\r\n#endif";\\
"#include","#include ";"Header","// Header:\r\n// File Name: |\r\n// Author:\r\n// Date:\r\n";\\
"continue","continue;";"do","do\r\n{\r\n\t// TODO: enter the block content here\r\n\t\r\n\t|\r\n} while ();\r\n";\\
"enum","enum |\r\n{\r\n\t\r\n};\r\n";"for","for(|;;)\r\n{\r\n}";\\
"fpointer_type","typedef int (* |F)();\r\n";"function","void function(|)\r\n{\r\n\r\n}\r\n";\\
"if","if (|)";"ifelse","if (|)\r\n{\r\n}\r\nelse\r\n{\r\n}";\\
"struct","struct | \r\n{\r\n\r\n};\r\n";"switch","switch (|)\r\n{\r\n\tcase:\r\n\t\tbreak;\r\n\tcase:\r\n\t\tbreak;\r\n\tdefault:\r\n\t\tbreak;\r\n}";\\
"void","void | ();\r\n";"while","while (|)\r\n{\r\n}";\\
font.monospace.cpp=YaHei Consolas Hybrid
font.acpmonofontname.cpp=YaHei Consolas Hybrid
font.acppropfontname.cpp=YaHei Consolas Hybrid
style.cpp.32=font:YaHei Consolas Hybrid,size:12,fore:#F8F8F2,back:#333333
style.cpp.4=font:YaHei Consolas Hybrid,size:12,fore:#AE81FF,back:#333333
style.cpp.10=font:YaHei Consolas Hybrid,size:12,fore:#DDDDCC,back:#333333
style.cpp.1=font:YaHei Consolas Hybrid,size:12,fore:#A5AEAF,back:#333333
style.cpp.2=font:YaHei Consolas Hybrid,size:12,fore:#808080,back:#333333
style.cpp.5=font:YaHei Consolas Hybrid,size:12,fore:#F92672,back:#333333
style.cpp.6=font:YaHei Consolas Hybrid,size:12,fore:#FFFF00,back:#333333
style.cpp.11=font:YaHei Consolas Hybrid,size:12,fore:#F78609,back:#333333
style.cpp.9=font:YaHei Consolas Hybrid,size:12,fore:#A6E22E,back:#333333
style.cpp.7=font:YaHei Consolas Hybrid,size:12,fore:#E6DB74,back:#333333
style.cpp.34=font:YaHei Consolas Hybrid,size:12,fore:#8000FF,back:#80FF00
style.cpp.35=font:YaHei Consolas Hybrid,size:12,fore:#F8F8F2,back:#D33F72
style.cpp.16=font:YaHei Consolas Hybrid,size:12,fore:#66D9EF,back:#333333,italics
style.cpp.12=font:YaHei Consolas Hybrid,size:12,fore:#000000,back:#E0C0E0
style.cpp.86=font:YaHei Consolas Hybrid,size:12,fore:#696969,back:#FFFFFF
# Asm Editor files
font.monospace.asm=Courier New
style.asm.32=font:Courier New,size:10,fore:#000000,back:#FFFFFF
style.asm.1=font:Courier New,size:10,fore:#616161,back:#FFFFFF
style.asm.2=font:Courier New,size:10,fore:#FF0000,back:#FFFFFF
style.asm.3=font:Courier New,size:10,fore:#7F007F,back:#FFFFFF
style.asm.4=font:Courier New,size:10,fore:#000000,back:#FFFFFF
style.asm.5=font:Courier New,size:10,fore:#000000,back:#FFFFFF
style.asm.6=font:Courier New,size:10,fore:#0000FF,back:#FFFFFF
style.asm.7=font:Courier New,size:10,fore:#0000FF,back:#FFFFFF
style.asm.9=font:Courier New,size:10,fore:#0000FF,back:#FFFFFF
style.asm.10=font:Courier New,size:10,fore:#0000FF,back:#FFFFFF
style.asm.11=font:Courier New,size:10,fore:#007F00,back:#FFFFFF
style.asm.12=font:Courier New,size:10,fore:#7F007F,back:#FFFFFF
style.asm.8=font:Courier New,size:10,fore:#46AA03,back:#FFFFFF
# Editor Text files
font.monospace.txt=Microsoft YaHei Mono
style.txt.32=font:@Microsoft YaHei Mono,size:11,fore:#F8F8F2,back:#333333