UltraEdit中Matlab语法高亮显示的操作方法

常用UltraEdit编辑Matlab程序,但其中没有语法高亮显示,偶然在网上得到一个,做了适当修改,有兴趣的可以试试.

需求:

UltraEdit作为文本编辑器有许多其他编辑器所没有的功能,现在有一个好的功能—语法着色。

最近需要看一点Matlab程序.m文件,需要UltraEdit支持这种文件。

说明:

UltraEdit14.*版本的语法着色已经不是worldfile.txt了,是worldfile.uew。

但是到现在15.*版本,wordfile的形式再次发生改变了,具体的是wordfiles/*.uew。

获取相应的.uew文件

有两种方式:

1.从UltraEdit官方网站下载wordfile扩展文件包:ALL WORDFILES IN ONE ,下载地址为http://www.ultraedit.com/files/wf/wf.zip。

2.Google baidu也可以找到。

配置UltraEdit

1.把获取到的.uew拷贝到wordfiles/文件夹里。

2.wordfiles/文件夹有两个,

第一个在C:\Documents and Settings\你的个人用户名\Application Data\IDMComp\UltraEdit;

Application Data文件夹有可能属性为隐藏的。

第二个在UltraEdit安装目录下 第二个在UltraEdit安装目录下。

UltraEdit默认使用的是第一个。

个人建议放在第二个目录中,以后重装系统还可用不用再调整设置了。

然后在UltraEdit里菜单---高级Advanced---配置Configration---编辑器显示---语法着色---词列表的完整路径。 把目录名称改为.\wordfiles就可以了,这样以后即使重装系统也不要再设置了。最后,别忘了“确定”或者“应用”。

在UltraEdit-32中,我们用 VIEW 菜单下 View as (Highlighting file type) 可选择高亮显示 C/C++文件、VB、HTML、PERL、PHP、JAVA、XML等多种文件的关键字,为编程和阅读带来方便。但软件没有为我们设置Matlab语言 关键字的高亮显示,十分不便。现在,将以下代码粘贴到UltraEdit-32目录下的 WRODFILE文件中,将代码复制到任意一个你用不到的语言,比如说rudy.uew文档里(注意备份哦),即可高亮显示Matlab语言 关键字,喜欢用UltraEdit-32的可以试试:

/L20"MATLAB 6" Nocase Line Comment = % String Chars = ' File Extensions = m M

/Function String = "%[ ^t]++function*=[ ^t]++^([a-z0-9_]+^)"

/Function String 1 = "%[ ^t]++function[ ^t]+^([a-z0-9_]+^)[ ^t]++[~=]"

/Delimiters = ~!@$^&*()-+=|\/{}[]:;"'<> , .?

/C1

break

case catch

else elseif end

for function

global

if

otherwise

persistent

return

switch

try

while

/C2

abs acos acosh add_annotation add_block add_line add_param all and any asin asinh assignin atan atan2 atanh

balance beep bitand bitcmp bitget bitor bitset bitshift bitxor builtin

callstats cat cd ceil cell cell2struct cellhorzcat cells char chdir check_system chol cholinc cholupdate class clc clear clock close_system colon compare_system computer

conj contourc conv2 copyobj cos cosh cputime ctranspose cumprod cumsum

dbclear dbcont dbdown dbquit dbstack dbstatus dbstep dbstop dbtype dbup delete delete_annotation delete_block delete_line delete_param det diag diary diff disp display

dongarra dos double dragrect drawnow

echo eig eps eq error errortrap eval evalc evalin exist exit exp expm eye

fclose feature feof ferror feval fft fftn fftw fgets fieldnames fields filesep fill fill3 filter find find_system findpackage findstr findtype finite fix floor fopen

format fprintf frame2im fread fscanf fschange fseek ftell full func2str functions functionscalled fwrite

ge getenv getframe gs_get_buttonmotion gt

handle handle2struct hardcopy hcreate help hess hittest home horzcat hregister

i ieee ifft ifftn im2frame imag import inf Inf inferiorto inmem input inputname int16 int32 int8 inv isa iscell ischar isempty isequal isfinite isglobal ishandle isieee

isinf isjava isletter islogical isnan isreal isruntime isspace issparse isstr isstudent

j java javaArray javaMethod javaObject java_array java_method java_object

keyboard

lasterr lastwarn ldivide le length license load log log2 logical loglog lookfor lower lt ltitr lu luinc

magic matlabpath matlabroot max methods mexext mfilename mimofr min minus mislocked mldivide mlock mod more movie mpower mrdivide mtimes munlock

nan NaN nargin nargout ndims ne new_system norm not numel

ones open_system or

pack pause permute pfile pi plot plot3 plus pow2 power prod

qr qrupdate quit qz

rand randn rbbox rcond rdivide real rehash rem reset reshape rmappdata round rtwgen runtime

save save_system schur selectmoveresize semilogx semilogy setappdata setstr sign sim simulink simver sin single sinh size sldebug sort sparse sparsfun sprintf sqrt sscanf

str2func strcmp strcmpi strfind string strncmp strncmpi strrep struct struct2cell struct2handle subsasgn subsindex subsref sum superiorto svd system system_dependent

tan tanh tic times toc transpose tril triu trmginput type

u_convert_to_gobject uigetfile uimenufcn uint16 uint32 uint8 uipushtool uiputfile uisetcolor uisetfont uitoggletool uitoolbar uminus unix uplus upper

version vertcat vms

waitfor waitforbuttonpress warning what which who whos

xlate

zeros

/C3

axes

dir

figure findobj

gcbf gcbo gcf gco get get_param gcbh

image

light line

patch pwd

rectangle

set set_param sf surface

text

uicontrol uimenu uicontextmenu

/C4

+

-

=

// /

\

%

&

>

<

^

!

{

}

|