Add new option 'python_highlight_file_headers_as_comments'

The option is disabled by default and when enabled highlight shebang and
coding file headers as comments instead of special characters.
This commit is contained in:
Dmitry Vasiliev
2013-08-31 14:28:14 +02:00
parent 21a2e84df6
commit 69f8e12a46
3 changed files with 16 additions and 4 deletions

View File

@@ -2,6 +2,9 @@ Revision 3.3.5 (2013-08-31):
- Highlight 'import', 'from' and 'as' as include statements.
Patch by pydave at GitHub.
- Added new option 'python_highlight_file_headers_as_comments' (disabled by
default) to highlight shebang and coding file headers as comments.
Proposed by pydave at GitHub.
Revision 3.3.4 (2013-08-11):

View File

@@ -117,6 +117,8 @@ Options used by the script
Highlight doc-tests
``python_print_as_function``
Highlight ``print`` statement as function for Python 2
``python_highlight_file_headers_as_comments``
Highlight shebang and coding headers as comments
``python_highlight_all``
Enable all the options above. *NOTE: This option don't override any
previously set options*

View File

@@ -73,6 +73,9 @@
" python_highlight_doctests Highlight doc-tests
" python_print_as_function Highlight 'print' statement as
" function for Python 2
" python_highlight_file_headers_as_comments
" Highlight shebang and coding
" headers as comments
"
" python_highlight_all Enable all the options above
" NOTE: This option don't override
@@ -179,8 +182,10 @@ syn match pythonDot "\." display containedin=pythonDottedName
"
syn match pythonComment "#.*$" display contains=pythonTodo,@Spell
syn match pythonRun "\%^#!.*$"
syn match pythonCoding "\%^.*\%(\n.*\)\?#.*coding[:=]\s*[0-9A-Za-z-_.]\+.*$"
if !s:Enabled("g:python_highlight_file_headers_as_comments")
syn match pythonRun "\%^#!.*$"
syn match pythonCoding "\%^.*\%(\n.*\)\?#.*coding[:=]\s*[0-9A-Za-z-_.]\+.*$"
endif
syn keyword pythonTodo TODO FIXME XXX contained
"
@@ -482,8 +487,10 @@ if version >= 508 || !exists("did_python_syn_inits")
HiLink pythonDot Normal
HiLink pythonComment Comment
HiLink pythonCoding Special
HiLink pythonRun Special
if !s:Enabled("g:python_highlight_file_headers_as_comments")
HiLink pythonCoding Special
HiLink pythonRun Special
endif
HiLink pythonTodo Todo
HiLink pythonError Error