diff --git a/CHANGES.txt b/CHANGES.txt index 79d87f2..ca6ab78 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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): diff --git a/README.rst b/README.rst index 7dca0c2..f7d20f4 100644 --- a/README.rst +++ b/README.rst @@ -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* diff --git a/syntax/python.vim b/syntax/python.vim index ec9bc2f..e2eaa90 100644 --- a/syntax/python.vim +++ b/syntax/python.vim @@ -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