Browse Source

Fixed highlighting for decorators

Dmitry Vasiliev 14 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
+Revision 3.0.2 (2009-07-24):
2
+
3
+    - Applied patch by Caleb Adamantine which fixes highlighting for decorators
4
+
1
 Revision 3.0.1 (2009-05-03):
5
 Revision 3.0.1 (2009-05-03):
2
 
6
 
3
     - Fixed compatibility with pyrex.vim
7
     - Fixed compatibility with pyrex.vim
16
       "execfile", "file", "help", "intern", "long", "raw_input", "reduce",
20
       "execfile", "file", "help", "intern", "long", "raw_input", "reduce",
17
       "reload", "unichr", "unicode", "xrange";
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
 Revision 2.6.4 (2009-05-03):
27
 Revision 2.6.4 (2009-05-03):
20
 
28
 
21
     - Fixed compatibility with pyrex.vim
29
     - Fixed compatibility with pyrex.vim

+ 9
- 3
python.vim View File

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

+ 9
- 3
python3.0.vim View File

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

+ 1
- 0
test.py View File

47
 # Decorators.
47
 # Decorators.
48
 
48
 
49
 @ decoratorname
49
 @ decoratorname
50
+@ object.__init__(arg1, arg2)
50
 
51
 
51
 # Numbers
52
 # Numbers
52
 
53