Browse Source

Fixed highlighting for decorators

Dmitry Vasiliev 10 years ago
parent
commit
4fc6d28416
4 changed files with 27 additions and 6 deletions
  1. 8
    0
      CHANGES.txt
  2. 9
    3
      python.vim
  3. 9
    3
      python3.0.vim
  4. 1
    0
      test.py

+ 8
- 0
CHANGES.txt View File

@@ -1,3 +1,7 @@
1
+Revision 3.0.2 (2009-07-24):
2
+
3
+    - Applied patch by Caleb Adamantine which fixes highlighting for decorators
4
+
1 5
 Revision 3.0.1 (2009-05-03):
2 6
 
3 7
     - Fixed compatibility with pyrex.vim
@@ -16,6 +20,10 @@ Revision 3.0.0 (2008-12-07):
16 20
       "execfile", "file", "help", "intern", "long", "raw_input", "reduce",
17 21
       "reload", "unichr", "unicode", "xrange";
18 22
 
23
+Revision 2.6.5 (2009-07-24):
24
+
25
+    - Applied patch by Caleb Adamantine which fixes highlighting for decorators
26
+
19 27
 Revision 2.6.4 (2009-05-03):
20 28
 
21 29
     - Fixed compatibility with pyrex.vim

+ 9
- 3
python.vim View File

@@ -2,9 +2,9 @@
2 2
 " Language:	Python
3 3
 " Maintainer:	Dmitry Vasiliev <dima@hlabs.spb.ru>
4 4
 " URL:		http://www.hlabs.spb.ru/vim/python.vim
5
-" Last Change:	2008-09-29
5
+" Last Change:	2009-07-24
6 6
 " Filenames:	*.py
7
-" Version:	2.6.4
7
+" Version:	2.6.5
8 8
 "
9 9
 " Based on python.vim (from Vim 6.1 distribution)
10 10
 " by Neil Schemenauer <nas@python.ca>
@@ -18,6 +18,8 @@
18 18
 "        (strings and comments)
19 19
 "    John Eikenberry
20 20
 "        for the patch fixing small typo
21
+"    Caleb Adamantine
22
+"        for the patch fixing highlighting for decorators
21 23
 
22 24
 "
23 25
 " Options:
@@ -117,7 +119,9 @@ if !exists("python_print_as_function") || python_print_as_function == 0
117 119
 endif
118 120
 
119 121
 " Decorators (new in Python 2.4)
120
-syn match   pythonDecorator	"@" display nextgroup=pythonFunction skipwhite
122
+syn match   pythonDecorator	"@" display nextgroup=pythonDottedName skipwhite
123
+syn match   pythonDottedName "[a-zA-Z_][a-zA-Z0-9_]*\(\.[a-zA-Z_][a-zA-Z0-9_]*\)*" display contained
124
+syn match   pythonDot        "\." display containedin=pythonDottedName
121 125
 
122 126
 " Comments
123 127
 syn match   pythonComment	"#.*$" display contains=pythonTodo,@Spell
@@ -303,6 +307,8 @@ if version >= 508 || !exists("did_python_syn_inits")
303 307
   HiLink pythonOperator		Operator
304 308
 
305 309
   HiLink pythonDecorator	Define
310
+  HiLink pythonDottedName	Function
311
+  HiLink pythonDot          Normal
306 312
 
307 313
   HiLink pythonComment		Comment
308 314
   HiLink pythonCoding		Special

+ 9
- 3
python3.0.vim View File

@@ -2,9 +2,9 @@
2 2
 " Language:	Python
3 3
 " Maintainer:	Dmitry Vasiliev <dima@hlabs.spb.ru>
4 4
 " URL:		http://www.hlabs.spb.ru/vim/python3.0.vim
5
-" Last Change:	2008-12-07
5
+" Last Change:	2009-07-24
6 6
 " Filenames:	*.py
7
-" Version:	3.0.1
7
+" Version:	3.0.2
8 8
 "
9 9
 " Based on python.vim (from Vim 6.1 distribution)
10 10
 " by Neil Schemenauer <nas@python.ca>
@@ -18,6 +18,8 @@
18 18
 "        (strings and comments)
19 19
 "    John Eikenberry
20 20
 "        for the patch fixing small typo
21
+"    Caleb Adamantine
22
+"        for the patch fixing highlighting for decorators
21 23
 
22 24
 "
23 25
 " Options:
@@ -111,7 +113,9 @@ syn keyword pythonException	try except finally
111 113
 syn keyword pythonOperator	and in is not or
112 114
 
113 115
 " Decorators (new in Python 2.4)
114
-syn match   pythonDecorator	"@" display nextgroup=pythonFunction skipwhite
116
+syn match   pythonDecorator	"@" display nextgroup=pythonDottedName skipwhite
117
+syn match   pythonDottedName "[a-zA-Z_][a-zA-Z0-9_]*\(\.[a-zA-Z_][a-zA-Z0-9_]*\)*" display contained
118
+syn match   pythonDot        "\." display containedin=pythonDottedName
115 119
 
116 120
 " Comments
117 121
 syn match   pythonComment	"#.*$" display contains=pythonTodo,@Spell
@@ -295,6 +299,8 @@ if version >= 508 || !exists("did_python_syn_inits")
295 299
   HiLink pythonOperator		Operator
296 300
 
297 301
   HiLink pythonDecorator	Define
302
+  HiLink pythonDottedName	Function
303
+  HiLink pythonDot          Normal
298 304
 
299 305
   HiLink pythonComment		Comment
300 306
   HiLink pythonCoding		Special

+ 1
- 0
test.py View File

@@ -47,6 +47,7 @@ RuntimeWarning FutureWarning OverflowWarning ImportWarning UnicodeWarning
47 47
 # Decorators.
48 48
 
49 49
 @ decoratorname
50
+@ object.__init__(arg1, arg2)
50 51
 
51 52
 # Numbers
52 53