在UltraEdit的wordfile中添加python的文法支援
發現UltraEdit有對Perl的文法高亮支援,但是開啟Python檔案的時候卻沒有,網上找到一些方法
方法一:我也是這麼做的,可行
1、到UltraEdit安裝目錄下,進入wordfiles目錄,建立檔案:python.uew
把如下內容粘貼到該檔案裡,儲存:
/L30"Python" Line Comment = # Block Comment One = """ Block Comment Off = """ Escape Char = / File Extensions = PY PYW
/Indent Strings = ":"
/Function String 1 = "%[ ,^t]++def[ ]+^([a-zA-Z0-9_]+*^):"
/Function String 2 = "%[ ,^t]++^(##[ a-zA-Z0-9_]+*^)##"
/Function String 3 = "%[ ,^t]++^(class[ ]+[a-zA-Z0-9_]+*^):"
/Delimiters = []{}()<>="''.,:+
/C1"Reserved Words"
and assert
break
class continue
def del
elif else except exec
finally for from
global
if import in is
lambda
map
not
None
or
pass print
raise range return
try
while
/C2"Built-in Functions"
abs apply
callable chr cmp coerce compile complex
delattr dir divmod
eval execfile
filter float
getattr globals
hasattr hash hex
id input int intern isinstance issubclass
joinfields
len list local long
max min match
oct open ord
pow
raw_input reduce reload repr round
search setattr setdefault slice str splitfields
unichr unicode
tuple type
vars
xrange
zip
__import__
/C3"__Methods__"
__abs__ __add__ __and__
__call__ __cmp__ __coerce__
__del__ __delattr__ __delitem__ __delslice__ __div__ __divmod__
__float__
__getattr__ __getitem__ __getslice__
__hash__ __hex__
__iadd__ __isub__ __imod__ __idiv__ __ipow__ __iand__ __ior__ __ixor__
__ilshift__ __irshift__
__invert__ __int__ __init__
__len__ __long__ __lshift__
__mod__ __mul__
__neg__ __nonzero__
__oct__ __or__
__pos__ __pow__
__radd__ __rdiv__ __rdivmod__ __rmod__ __rpow__ __rlshift__ __rrshift__
__rshift__ __rsub__ __rmul__ __repr__
__rand__ __rxor__ __ror__
__setattr__ __setitem__ __setslice__ __str__ __sub__
__xor__
/C4"__Attributes__"
__bases__
__class__
__dict__ __doc__
__methods__ __members__
__name__
__version__
/C5"Exceptions"
ArithmeticError AssertionError AttributeError
EOFError Exception
FloatingPointError
IOError ImportError IndentationError IndexError
KeyError KeyboardInterrupt
LookupError
MemoryError
NameError
OverflowError
RuntimeError
StandardError SyntaxError SystemError SystemExit
TabError TypeError
ValueError
ZeroDivisionError
/C6"Operators"
+=
-=
%=
/=
**=
&=
|=
^=
>>=
<<=
/C7"Common Libs"
AST atexit
BaseHTTPServer Bastion
cmd codecs commands compileall copy
CGIHTTPServer Complex
dbhash dircmp dis dospath dumbdbm
emacs
find fmt fnmatch ftplib
getopt glob gopherlib grep
htmllib httplib
ihooks imghdr imputil
linecache lockfile
macpath macurl2path mailbox mailcap
mimetools mimify mutex math
Mimewriter
newdir ni nntplib ntpath nturl2path
os ospath
pdb pickle pipes poly popen2 posixfile posixpath profile pstats pyclbr
pyexpat
Para
quopri
Queue
rand random regex regsub rfc822
sched sgmllib shelve site sndhdr string sys snmp
SimpleHTTPServer StringIO SocketServer
tb tempfile toaiff token tokenize traceback tty types tzparse
Tkinter
unicodedata urllib urlparse util uu
UserDict UserList
wave webbrowser whatsound whichdb whrandom
xdrlib xml xmlpackage
zmod
/C8"Others"
array
AzIM
Desc
fnmatch
Info
Run
struct self
StartKey StopKey
2,開啟 進階 -> 配置 -> 編輯器顯示 -> 文法著色
找到其中的目錄:例如
C:/Documents and Settings/user/Application Data/IDMComp/UltraEdit/wordfiles
複製剛才我們建立的檔案到該目錄下
重啟UE,就會發現.py檔案也有文法高亮了
方法二:未實驗,網上找的,備份
為了讓UE支援python語言,google了很多,結果都不行,最後看了下面的部落格才知道錯哪了,總結下以免忘記。
http://wangtao.name/2009/12/20/ultraedit_python.html
在官網上找到python的擴充下載點:http://www.ultraedit.com/downloads/extras.html
有各種語言的擴充,便可以支援文法高亮。
python 2.5:http://www.ultraedit.com/files/wf/python25.uew
python 2.6&3.0:http://www.ultraedit.com/files/wf/python26.uew
下載後安裝方法如下:
將下載的uew檔案複製在“文檔的完整目錄名稱:”中的檔案夾裡。如: //這句很重要,以前我一直都是放到安裝目錄下,結果都不對
如果這樣做了,但在“語言選擇”卻沒有找到新加的語言。就可能是新下載的uew檔案的問題了。
我們用UltraEdit開啟uew檔案。如“python25.uew”,在第一行你會看到這一句:
/L14″Python” PYTHON_LANG Line Comment = # Escape Char = / String Literal Prefix = r File Extensions = PY PYW
其中開頭的”/L14″就是語言在UltraEdit的語言列表號,可能被其它語言佔用了,開啟C:/Users/Administrator/AppData/Roaming/IDMComp/UltraEdit/wordfiles(windows 7下),查看其中檔案是否也使用了14。
我裡面剛好有14個uew檔案,所以改成了15。如果改了還是不行,可能要一個一個開啟查看了。。。。