VIM: Several plugin changes

- Removed python-syntax
 - Enabled pymode syntax highlighting
 - Disabled pymode syntax checker (I'm using ALE as a universal checker)
 - Added vim-window-resize-easy
 - Added traces.vim
This commit is contained in:
Tobias Manske 2018-08-06 23:59:12 +02:00
parent 8298f7eb22
commit 8e90a92cb7
No known key found for this signature in database
GPG Key ID: 978D99F12D4E041F
13 changed files with 13 additions and 1673 deletions

9
.gitmodules vendored
View File

@ -61,9 +61,6 @@
[submodule "vim/plugins/javacomplete"]
path = vim/plugins/javacomplete
url = https://github.com/vim-scripts/javacomplete
[submodule "vim/plugins/pythonsyntax"]
path = vim/plugins/pythonsyntax
url = https://github.com/hdima/python-syntax
[submodule "vim/plugins/vim-python-pep8-indent"]
path = vim/plugins/vim-python-pep8-indent
url = https://github.com/Vimjas/vim-python-pep8-indent
@ -154,3 +151,9 @@
[submodule "vim/plugins/ansible-vim"]
path = vim/plugins/ansible-vim
url = https://github.com/pearofducks/ansible-vim
[submodule "vim/plugins/traces.vim"]
path = vim/plugins/traces.vim
url = https://github.com/markonm/traces.vim
[submodule "vim/plugins/vim-window-resize-easy"]
path = vim/plugins/vim-window-resize-easy
url = https://github.com/roxma/vim-window-resize-easy

View File

@ -70,8 +70,10 @@ let g:NERDCommentEmptyLines = 1
let g:NERDTrimTrailingWhitespace = 1
" PythonSyntax
let python_highlight_all = 1
" PyMode
let g:pymode_lint = 0
let g:pymode_syntax = 1
let g:pymode_syntax_all = 1
" Simpylfold
@ -83,7 +85,7 @@ let g:SuperTabDefaultCompletionType = "<c-space>"
" Ale
let g:ale_linters = {"python": ["flake8"]}
let g:ale_linters = {"python": ["flake8"], "python3": ["flake8"]}
" UltiSnips

View File

@ -1,224 +0,0 @@
Revision 3.6.0 (2015-11-XX):
- Fix 'async def' highlighting. Patch by Joongi Kim
- Add dummy 'pythonInclude' group to avoid crashing standard pyrex.vim.
Patch by Antony Lee
Revision 3.5.0 (2015-06-10):
- Add support for 'async ...' and 'await' keywords introduced in
Python 3.5. Patch by Ihor Gorobets
Revision 3.3.7 (2014-12-27):
- Add support for Python 3 non-ASCII decorator names.
Patch by Victor Salgado
Revision 3.3.6 (2013-11-18):
- Highlight 'yield from' statement introduced in Python 3.3. Reported by
Elizabeth Myers.
Revision 3.3.5 (2013-08-31):
- Highlight 'import', 'from' and 'as' as include statements.
Patch by David Briscoe
- Added new option 'python_highlight_file_headers_as_comments' (disabled by
default) to highlight shebang and coding file headers as comments.
Proposed by David Briscoe.
Revision 3.3.4 (2013-08-11):
- Highlight True and False as booleans. Patch by Yuri Habrusiev.
Revision 3.3.3 (2013-06-02):
- More lightweight syntax reloading. Patch by Will Gray.
Revision 3.3.2 (2013-06-01):
- Fixed behaviour of b:python_version_2 variable. Reported by Will Gray.
Revision 3.3.1 (2013-05-12):
- The script was moved to its own repository at
https://github.com/hdima/python-syntax
Revision 3.3.0 (2013-03-10):
- Merge Python 2 and Python 3 script versions into the single python.vim
script
Revision 3.0.7 (2012-02-11):
- Updated email and URL
Revision 2.6.7 (2012-02-11):
- Updated email and URL
Revision 3.0.6 (2010-11-14):
- Fixed highlighting for str.format syntax. Patch by Anton Butanaev.
Revision 3.0.5 (2010-11-11):
- Fixed highlighting for bytes. Patch by Anton Butanaev.
- Fixed highlighting for numbers.
Revision 3.0.4 (2010-11-09):
- Fixed highlighting for raw bytes literals. Patch by Anton Butanaev.
Revision 3.0.3 (2010-04-09):
- Applied patch by Andrea Riciputi with new configuration options
"python_highlight_builtin_objs" and "python_highlight_builtin_funcs"
Revision 3.0.2 (2009-07-24):
- Applied patch by Caleb Adamantine which fixes highlighting for decorators
Revision 3.0.1 (2009-05-03):
- Fixed compatibility with pyrex.vim
Revision 3.0.0 (2008-12-07):
- Added support for non-ASCII identifiers;
- Added support for new text strings and binary data (bytes);
- Updated support for numeric literals;
- Updated support for str.format;
- Added new builtins introduced in Python 2.6: "ascii", "exec",
"memoryview", "print";
- Added new keyword "nonlocal";
- Removed exception "StandardError";
- Removed builtins: "apply", "basestring", "buffer", "callable", "coerce",
"execfile", "file", "help", "intern", "long", "raw_input", "reduce",
"reload", "unichr", "unicode", "xrange";
Revision 2.6.6 (2010-04-09):
- Applied patch by Andrea Riciputi with new configuration options
"python_highlight_builtin_objs" and "python_highlight_builtin_funcs"
Revision 2.6.5 (2009-07-24):
- Applied patch by Caleb Adamantine which fixes highlighting for decorators
Revision 2.6.4 (2009-05-03):
- Fixed compatibility with pyrex.vim
Revision 2.6.3 (2008-09-29):
- Return back trailing 'L' support for numbers. Actually it was changed for
future Python 3.0 syntax but in wrong file;
Revision 2.6.2 (2008-09-22):
- Added "VMSError" exception;
- Added support for b"..." syntax;
- Added support for str.format brace escaping;
Revision 2.6.1 (2008-09-21):
- Added new builtins and exceptions introduced in Python 2.6: "bin",
"bytearray", "bytes", "format", "next", "BufferError", "BytesWarning";
- Added builtin "__debug__";
- Added global variables: "__doc__", "__file__", "__name__", "__package__";
- Removed "OverflowWarning" (removed in Python 2.5);
- Added option "python_print_as_function" for highlight "print" as a
function;
- Added support for new integer literal syntax "0o" and "0b";
- Added support for string.Template syntax controlled by
"python_highlight_string_templates" option;
- Added support for str.format syntax controlled by
"python_highlight_string_format" option;
- Removed highlighting for "--" and "++" because it's a valid Python
expressions which can be interpreted as "a + +b";
Revision 2.5.6 (2007-02-04):
- Applied patch by Pedro Algarvio to enable spell checking only for
the right spots (strings and comments);
Revision 2.5.5 (2006-09-26):
- added new warnings (ImportWarning, UnicodeWarning)
introduced in Python 2.5;
Revision 2.5.4 (2006-05-11):
- added highlighting for erroneous operators: &&, ||, ++, --, ===
(inspired by http://www.vim.org/tips/tip.php?tip_id=969, thanks
Jeroen Ruigrok van der Werven for the link);
- added highlighting for new 'with' statement and 'BaseException',
'GeneratorExit' exceptions introduced in Python 2.5;
- added highlighting for 'OverflowWarning' exception which had been
forgotten;
- returned more robust recognition for function names;
Revision 2.5.3:
- fixed %-formatting highlighting for raw unicode strings;
Revision 2.5.2:
- slightly simplified option handling;
- fixed regexp for indentation errors;
- fixed highlighting for backslashed symbols inside strings;
- added highlighting for trailing-space errors (triggered by new
option: python_highlight_space_errors);
- added highlighting for variable name errors;
- added highlighting for hex number errors;
Revision 2.5.1 (2005-03-13):
- added new builtins 'all' and 'any' (Python 2.5a0)
Revision 2.4.2 (2004-08-05):
- added highlighting for new @decorator syntax introduced in python 2.4a2
Revision 2.4.1 (2004-03-17):
- new versioning scheme (based on python version numbers);
- added highlighting for new types/builtins introduced in python 2.4
(set, frozenset, reversed, sorted);
- new option added: python_slow_sync (set this for slow but more
robust syntax synchronization);
- added highlighting for doctests;
Revision 1.19:
- new option added: python_highlight_indent_errors;
- python_highlight_all now not override previously set options,
for example code:
let python_highlight_indent_errors = 0
let python_highlight_all = 1
set all highlight options except indentation errors highlighting option;
Revision 1.17:
- changed header, "Based on..." string added;
Revision 1.16:
- added basestring builtin;
Revision 1.15 (first public revision).
The changes since the original (vim6.1) python.vim are:
- changed string highlighting;
- enhanced special symbols highlighting inside strings;
- enhanced constant numbers highlighting;
- added optional highlighting for %-formatting inside strings;
- added highlighting for error conditions (wrong symbols in source file,
mixing spaces and tabs, wrong number values,
wrong %-formatting inside strings);
- added highlighting for magic comments: source code encoding
and #! (executable) strings;
- added highlighting for new exceptions and builtins introduced
in python 2.3;

View File

@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) 2002-2014 Dmitry Vasiliev <dima@hlabs.org>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,147 +0,0 @@
Python syntax highlighting script for Vim
=========================================
.. contents::
About
-----
Enhanced version of the original Python syntax highlighting script. Based on
``python.vim`` from Vim 6.1 distribution by Neil Schemenauer (nas at python dot
ca). Check also `python.vim page on vim.org
<http://www.vim.org/scripts/script.php?script_id=790>`_.
Please use the following channels for reporting bugs, offering suggestions or
feedback:
- python.vim issue tracker: https://github.com/hdima/python-syntax/issues
- Email: Dmitry Vasiliev (dima at hlabs.org)
- Send a message or follow me for updates on Twitter: `@hdima
<https://twitter.com/hdima>`__
Features
--------
Changes from the original ``python.vim`` are:
- Added support for Python 3 syntax highlighting
- Added ``:Python2Syntax`` and ``:Python3Syntax`` commands which allow to
switch between Python 2 and Python 3 syntaxes respectively without
reloads/restarts
- Updated strings highlighting
- Enhanced special symbols highlighting inside strings
- Enhanced highlighting of numeric constants
- Added optional highlighting for %-formatting inside strings
- Added highlighting for magic comments: source code encoding and #!
(executable) strings
- Added highlighting for new exceptions and builtins
- Added highlighting for doctests
- Added highlighting for new ``@decorator`` syntax introduced in Python 2.4a2
- Added highlighting for the following errors:
- invalid symbols in source file
- mixing spaces and tabs
- invalid numeric constants
- invalid %-formatting inside strings
- invalid variable names
- trailing spaces (triggered by the ``python_highlight_space_errors`` option)
Some of these features was later backported into the original ``python.vim``.
How to install
--------------
The easiest installation method is to place `syntax/python.vim
<https://github.com/hdima/python-syntax/blob/master/syntax/python.vim>`_ script
into your ``~/.vim/syntax/`` directory.
You can also use `Pathogen <https://github.com/tpope/vim-pathogen>`_ or `Vundle
<https://github.com/gmarik/vundle>`_ plugin managers in which case you can
install the whole `python.vim repository
<https://github.com/hdima/python-syntax>`_ into the corresponding plugins
directory.
Script options
--------------
There are two commands to enable or disable an option:
``:let OPTION_NAME = 1``
Enable option
``:let OPTION_NAME = 0``
Disable option
For example to enable all syntax highlighting features you can place the
following command in your ``~/.vimrc`` script::
let python_highlight_all = 1
Option and commands to select Python version
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``python_version_2``
Enable highlighting for Python 2 (Python 3 highlighting is enabled by
default). Also can be set as a local to buffer ``b:python_version_2``
variable.
The following local to buffer commands can be used to switch between two
highlighting modes:
``:Python2Syntax``
Switch to Python 2 highlighting mode
``:Python3Syntax``
Switch to Python 3 highlighting mode
Options used by the script
~~~~~~~~~~~~~~~~~~~~~~~~~~
``python_highlight_builtins``
Highlight builtin functions and objects
``python_highlight_builtin_objs``
Highlight builtin objects only
``python_highlight_builtin_funcs``
Highlight builtin functions only
``python_highlight_exceptions``
Highlight standard exceptions
``python_highlight_string_formatting``
Highlight ``%`` string formatting
``python_highlight_string_format``
Highlight syntax of ``str.format`` syntax
``python_highlight_string_templates``
Highlight syntax of ``string.Template``
``python_highlight_indent_errors``
Highlight indentation errors
``python_highlight_space_errors``
Highlight trailing spaces
``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 any
previously set options*
``python_slow_sync``
Can be set to 0 for slow machines
Contributors
------------
List of the contributors in alphabetical order:
- `Andrea Riciputi <https://github.com/mrrech>`_
- Anton Butanaev
- `Antony Lee <https://github.com/anntzer>`_
- Caleb Adamantine
- `David Briscoe <https://github.com/idbrii>`_
- `Elizabeth Myers <https://github.com/Elizafox>`_
- `Ihor Gorobets <https://github.com/iho>`_
- `Jeroen Ruigrok van der Werven <https://github.com/ashemedai>`_
- `John Eikenberry <https://github.com/eikenb>`_
- `Joongi Kim <https://github.com/achimnol>`_
- `Marc Weber <https://github.com/MarcWeber>`_
- `Pedro Algarvio <https://github.com/s0undt3ch>`_
- `Victor Salgado <https://github.com/mcsalgado>`_
- `Will Gray <https://github.com/graywh>`_
- `Yuri Habrusiev <https://github.com/yuriihabrusiev>`_

View File

@ -1,26 +0,0 @@
Now
===
- It seems python.vim doesn't highlight special characters inside strings by
default but only when reloaded? Or maybe only when set to Python 2
by default?
- Add support for slice syntax:
http://img155.imageshack.us/img155/7767/screenshotgs.png
- When we check spelling we don't need to check the whole strings only the
content. For example we don't need to check 'u' for spelling in strings
like this: u"Some text";
Later
=====
- Need more accurate way to handle indentation errors. For example
mixing spaces and tabs may be used for pretty formatting;
- Need more checks for errors like: absent brackets, absent quotes,
back slash at the end of strings;
- pythonError tips from
http://blog.sontek.net/2008/05/11/python-with-a-modular-ide-vim/ (reported by
Giuliani Deon Sanches)

View File

@ -1,237 +0,0 @@
" Vim syntax file
" Language: Python
" Maintainer: Neil Schemenauer <nas at python dot ca>
" Updated: $Date: 2003/01/12 14:17:34 $
" Updated by: Dmitry Vasiliev <dima at hlabs dot org>
" Filenames: *.py
" $Revision: 1.13 $
"
" Options:
" For folded functions and classes:
"
" let python_folding = 1
"
" For highlighted builtin functions:
"
" let python_highlight_builtins = 1
"
" For highlighted standard exceptions:
"
" let python_highlight_exceptions = 1
"
" For highlighted string formatting:
"
" let python_highlight_string_formatting = 1
"
" If you want all possible Python highlighting:
"
" let python_highlight_all = 1
"
" TODO: Check more errors?
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
if exists("python_highlight_all")
let python_folding = 1
let python_highlight_builtins = 1
let python_highlight_exceptions = 1
let python_highlight_string_formatting = 1
endif
" Keywords
syn keyword pythonStatement break continue del
syn keyword pythonStatement exec return
syn keyword pythonStatement pass print raise
syn keyword pythonStatement global assert
syn keyword pythonStatement lambda yield
if exists("python_folding") && has("folding")
syn match pythonStatement "\<\(def\|class\)\>" display nextgroup=pythonFunction skipwhite
else
syn keyword pythonStatement def class nextgroup=pythonFunction skipwhite
endif
syn match pythonFunction "\h\w*" display contained
syn keyword pythonRepeat for while
syn keyword pythonConditional if elif else
syn keyword pythonImport import from as
syn keyword pythonException try except finally
syn keyword pythonOperator and in is not or
" Comments
syn match pythonComment "#.*$" display contains=pythonTodo
syn keyword pythonTodo TODO FIXME XXX contained
" Erroneous characters that cannont be in a python program
syn match pythonError "[@$?]" display
" Mixing spaces and tabs is bad
syn match pythonIndentError "^\s*\(\t \| \t\)\s*" display
" Strings
syn region pythonString start=+'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ contains=pythonEscape,pythonEscapeError
syn region pythonString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ contains=pythonEscape,pythonEscapeError
syn region pythonString start=+"""+ end=+"""+ contains=pythonEscape,pythonEscapeError
syn region pythonString start=+'''+ end=+'''+ contains=pythonEscape,pythonEscapeError
syn match pythonEscape +\\[abfnrtv'"\\]+ display contained
syn match pythonEscapeError +\\[^abfnrtv'"\\]+ display contained
syn match pythonEscape "\\\o\o\=\o\=" display contained
syn match pythonEscapeError "\\\o\{,2}[89]" display contained
syn match pythonEscape "\\x\x\{2}" display contained
syn match pythonEscapeError "\\x\x\=\X" display contained
syn match pythonEscape "\\$"
" Unicode strings
syn region pythonUniString start=+[uU]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError
syn region pythonUniString start=+[uU]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError
syn region pythonUniString start=+[uU]"""+ end=+"""+ contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError
syn region pythonUniString start=+[uU]'''+ end=+'''+ contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError
syn match pythonUniEscape "\\u\x\{4}" display contained
syn match pythonUniEscapeError "\\u\x\{,3}\X" display contained
syn match pythonUniEscape "\\U\x\{8}" display contained
syn match pythonUniEscapeError "\\U\x\{,7}\X" display contained
syn match pythonUniEscape "\\N{[A-Z ]\+}" display contained
syn match pythonUniEscapeError "\\N{[^A-Z ]\+}" display contained
" Raw strings
syn region pythonRawString start=+[rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ contains=pythonRawEscape
syn region pythonRawString start=+[rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ contains=pythonRawEscape
syn region pythonRawString start=+[rR]"""+ end=+"""+
syn region pythonRawString start=+[rR]'''+ end=+'''+
syn match pythonRawEscape +\\['"]+ display transparent contained
" Unicode raw strings
syn region pythonUniRawString start=+[uU][rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError
syn region pythonUniRawString start=+[uU][rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError
syn region pythonUniRawString start=+[uU][rR]"""+ end=+"""+ contains=pythonUniRawEscape,pythonUniRawEscapeError
syn region pythonUniRawString start=+[uU][rR]'''+ end=+'''+ contains=pythonUniRawEscape,pythonUniRawEscapeError
syn match pythonUniRawEscape "\([^\\]\(\\\\\)*\)\@<=\\u\x\{4}" display contained
syn match pythonUniRawEscapeError "\([^\\]\(\\\\\)*\)\@<=\\u\x\{,3}\X" display contained
if exists("python_highlight_string_formatting")
" String formatting
syn match pythonStrFormat "%\(([^)]\+)\)\=[-#0 +]\=\d*\(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonUniString,pythonRawString
syn match pythonStrFormat "%[-#0 +]\=\(\*\|\d\+\)\=\(\.\(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonUniString,pythonRawString
endif
" Numbers (ints, longs, floats, complex)
syn match pythonNumber "\<0[xX]\x\+[lL]\=\>" display
syn match pythonNumber "\<\d\+[lLjJ]\=\>" display
syn match pythonFloat "\.\d\+\([eE][+-]\=\d\+\)\=[jJ]\=\>" display
syn match pythonFloat "\<\d\+[eE][+-]\=\d\+[jJ]\=\>" display
syn match pythonFloat "\<\d\+\.\d*\([eE][+-]\=\d\+\)\=[jJ]\=" display
syn match pythonOctalError "\<0\o*[89]\d*[lLjJ]\=\>" display
if exists("python_highlight_builtins")
" Builtin functions, types and objects, not really part of the syntax
syn keyword pythonBuiltinObj True False Ellipsis None NotImplemented
syn keyword pythonBuiltinFunc bool __import__ abs
syn keyword pythonBuiltinFunc apply buffer callable chr classmethod cmp
syn keyword pythonBuiltinFunc coerce compile complex delattr dict dir divmod
syn keyword pythonBuiltinFunc eval execfile file filter float getattr globals
syn keyword pythonBuiltinFunc hasattr hash hex id input int intern isinstance
syn keyword pythonBuiltinFunc issubclass iter len list locals long map max
syn keyword pythonBuiltinFunc min object oct open ord pow property range
syn keyword pythonBuiltinFunc raw_input reduce reload repr round setattr
syn keyword pythonBuiltinFunc slice staticmethod str super tuple type unichr
syn keyword pythonBuiltinFunc unicode vars xrange zip
endif
if exists("python_highlight_exceptions")
" Builtin exceptions and warnings
syn keyword pythonExClass ArithmeticError AssertionError AttributeError
syn keyword pythonExClass DeprecationWarning EOFError EnvironmentError
syn keyword pythonExClass Exception FloatingPointError IOError
syn keyword pythonExClass ImportError IndentiationError IndexError
syn keyword pythonExClass KeyError KeyboardInterrupt LookupError
syn keyword pythonExClass MemoryError NameError NotImplementedError
syn keyword pythonExClass OSError OverflowError OverflowWarning
syn keyword pythonExClass ReferenceError RuntimeError RuntimeWarning
syn keyword pythonExClass StandardError StopIteration SyntaxError
syn keyword pythonExClass SyntaxWarning SystemError SystemExit TabError
syn keyword pythonExClass TypeError UnboundLocalError UnicodeError
syn keyword pythonExClass UserWarning ValueError Warning WindowsError
syn keyword pythonExClass ZeroDivisionError
endif
syn sync clear
if exists("python_folding") && has("folding")
syn sync fromstart
"syn match pythonFold "^\(\s*\)\(class\|def\)\s.*\(\(\n\s*\)*\n\1\s\+\S.*\)\+" transparent fold
syn region pythonFold start="^\z(\s*\)\(class\|def\)\s" skip="^\z1\s\+\S" end="^\s*\S"me=s-1 transparent fold
syn region pythonFold start="{" end="}" transparent fold
syn region pythonFold start="\[" end="\]" transparent fold
else
" This is fast but code inside triple quoted strings screws it up. It
" is impossible to fix because the only way to know if you are inside a
" triple quoted string is to start from the beginning of the file. If
" you have a fast machine you can try uncommenting the "sync minlines"
" and commenting out the rest.
syn sync match pythonSync grouphere NONE "):$"
syn sync maxlines=200
"syn sync minlines=2000
endif
if version >= 508 || !exists("did_python_syn_inits")
if version <= 508
let did_python_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink pythonStatement Statement
HiLink pythonImport Statement
HiLink pythonFunction Function
HiLink pythonConditional Conditional
HiLink pythonRepeat Repeat
HiLink pythonException Exception
HiLink pythonOperator Operator
HiLink pythonComment Comment
HiLink pythonTodo Todo
HiLink pythonError Error
HiLink pythonIndentError Error
HiLink pythonString String
HiLink pythonUniString String
HiLink pythonRawString String
HiLink pythonUniRawString String
HiLink pythonEscape Special
HiLink pythonEscapeError Error
HiLink pythonUniEscape Special
HiLink pythonUniEscapeError Error
HiLink pythonUniRawEscape Special
HiLink pythonUniRawEscapeError Error
if exists("python_highlight_string_formatting")
HiLink pythonStrFormat Special
endif
HiLink pythonNumber Number
HiLink pythonFloat Float
HiLink pythonOctalError Error
if exists("python_highlight_builtins")
HiLink pythonBuiltinObj Structure
HiLink pythonBuiltinFunc Function
endif
if exists("python_highlight_exceptions")
HiLink pythonExClass Structure
endif
delcommand HiLink
endif
let b:current_syntax = "python"

View File

@ -1,236 +0,0 @@
" Vim syntax file
" Language: Python
" Maintainer: Neil Schemenauer <nas at python dot ca>
" Updated: $Date: 2003/01/12 15:35:02 $
" Updated by: Dmitry Vasiliev <dima at hlabs dot org>
" Filenames: *.py
" $Revision: 1.14 $
"
" Options:
" For folded functions and classes:
"
" let python_folding = 1
"
" For highlighted builtin functions:
"
" let python_highlight_builtins = 1
"
" For highlighted standard exceptions:
"
" let python_highlight_exceptions = 1
"
" For highlighted string formatting:
"
" let python_highlight_string_formatting = 1
"
" If you want all possible Python highlighting:
"
" let python_highlight_all = 1
"
" TODO: Check more errors?
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
if exists("python_highlight_all")
let python_folding = 1
let python_highlight_builtins = 1
let python_highlight_exceptions = 1
let python_highlight_string_formatting = 1
endif
" Keywords
syn keyword pythonStatement break continue del
syn keyword pythonStatement exec return
syn keyword pythonStatement pass print raise
syn keyword pythonStatement global assert
syn keyword pythonStatement lambda yield
if exists("python_folding") && has("folding")
syn match pythonStatement "\<\(def\|class\)\>" display nextgroup=pythonFunction skipwhite
else
syn keyword pythonStatement def class nextgroup=pythonFunction skipwhite
endif
syn match pythonFunction "\h\w*" display contained
syn keyword pythonRepeat for while
syn keyword pythonConditional if elif else
syn keyword pythonImport import from as
syn keyword pythonException try except finally
syn keyword pythonOperator and in is not or
" Comments
syn match pythonComment "#.*$" display contains=pythonTodo
syn keyword pythonTodo TODO FIXME XXX contained
" Erroneous characters that cannont be in a python program
syn match pythonError "[@$?]" display
" Mixing spaces and tabs is bad
syn match pythonError "^\s*\(\t \| \t\)\s*" display
" Strings
syn region pythonString start=+'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ contains=pythonEscape,pythonEscapeError
syn region pythonString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ contains=pythonEscape,pythonEscapeError
syn region pythonString start=+"""+ end=+"""+ contains=pythonEscape,pythonEscapeError
syn region pythonString start=+'''+ end=+'''+ contains=pythonEscape,pythonEscapeError
syn match pythonEscape +\\[abfnrtv'"\\]+ display contained
syn match pythonEscapeError +\\[^abfnrtv'"\\]+ display contained
syn match pythonEscape "\\\o\o\=\o\=" display contained
syn match pythonEscapeError "\\\o\{,2}[89]" display contained
syn match pythonEscape "\\x\x\{2}" display contained
syn match pythonEscapeError "\\x\x\=\X" display contained
syn match pythonEscape "\\$"
" Unicode strings
syn region pythonUniString start=+[uU]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError
syn region pythonUniString start=+[uU]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError
syn region pythonUniString start=+[uU]"""+ end=+"""+ contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError
syn region pythonUniString start=+[uU]'''+ end=+'''+ contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError
syn match pythonUniEscape "\\u\x\{4}" display contained
syn match pythonUniEscapeError "\\u\x\{,3}\X" display contained
syn match pythonUniEscape "\\U\x\{8}" display contained
syn match pythonUniEscapeError "\\U\x\{,7}\X" display contained
syn match pythonUniEscape "\\N{[A-Z ]\+}" display contained
syn match pythonUniEscapeError "\\N{[^A-Z ]\+}" display contained
" Raw strings
syn region pythonRawString start=+[rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ contains=pythonRawEscape
syn region pythonRawString start=+[rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ contains=pythonRawEscape
syn region pythonRawString start=+[rR]"""+ end=+"""+
syn region pythonRawString start=+[rR]'''+ end=+'''+
syn match pythonRawEscape +\\['"]+ display transparent contained
" Unicode raw strings
syn region pythonUniRawString start=+[uU][rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError
syn region pythonUniRawString start=+[uU][rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError
syn region pythonUniRawString start=+[uU][rR]"""+ end=+"""+ contains=pythonUniRawEscape,pythonUniRawEscapeError
syn region pythonUniRawString start=+[uU][rR]'''+ end=+'''+ contains=pythonUniRawEscape,pythonUniRawEscapeError
syn match pythonUniRawEscape "\([^\\]\(\\\\\)*\)\@<=\\u\x\{4}" display contained
syn match pythonUniRawEscapeError "\([^\\]\(\\\\\)*\)\@<=\\u\x\{,3}\X" display contained
if exists("python_highlight_string_formatting")
" String formatting
syn match pythonStrFormat "%\(([^)]\+)\)\=[-#0 +]\=\d*\(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonUniString,pythonRawString
syn match pythonStrFormat "%[-#0 +]\=\(\*\|\d\+\)\=\(\.\(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonUniString,pythonRawString
endif
" Numbers (ints, longs, floats, complex)
syn match pythonNumber "\<0[xX]\x\+[lL]\=\>" display
syn match pythonNumber "\<\d\+[lLjJ]\=\>" display
syn match pythonFloat "\.\d\+\([eE][+-]\=\d\+\)\=[jJ]\=\>" display
syn match pythonFloat "\<\d\+[eE][+-]\=\d\+[jJ]\=\>" display
syn match pythonFloat "\<\d\+\.\d*\([eE][+-]\=\d\+\)\=[jJ]\=" display
syn match pythonOctalError "\<0\o*[89]\d*[lLjJ]\=\>" display
if exists("python_highlight_builtins")
" Builtin functions, types and objects, not really part of the syntax
syn keyword pythonBuiltinObj True False Ellipsis None NotImplemented
syn keyword pythonBuiltinFunc bool __import__ abs
syn keyword pythonBuiltinFunc apply buffer callable chr classmethod cmp
syn keyword pythonBuiltinFunc coerce compile complex delattr dict dir divmod
syn keyword pythonBuiltinFunc eval execfile file filter float getattr globals
syn keyword pythonBuiltinFunc hasattr hash hex id input int intern isinstance
syn keyword pythonBuiltinFunc issubclass iter len list locals long map max
syn keyword pythonBuiltinFunc min object oct open ord pow property range
syn keyword pythonBuiltinFunc raw_input reduce reload repr round setattr
syn keyword pythonBuiltinFunc slice staticmethod str super tuple type unichr
syn keyword pythonBuiltinFunc unicode vars xrange zip
endif
if exists("python_highlight_exceptions")
" Builtin exceptions and warnings
syn keyword pythonExClass ArithmeticError AssertionError AttributeError
syn keyword pythonExClass DeprecationWarning EOFError EnvironmentError
syn keyword pythonExClass Exception FloatingPointError IOError
syn keyword pythonExClass ImportError IndentiationError IndexError
syn keyword pythonExClass KeyError KeyboardInterrupt LookupError
syn keyword pythonExClass MemoryError NameError NotImplementedError
syn keyword pythonExClass OSError OverflowError OverflowWarning
syn keyword pythonExClass ReferenceError RuntimeError RuntimeWarning
syn keyword pythonExClass StandardError StopIteration SyntaxError
syn keyword pythonExClass SyntaxWarning SystemError SystemExit TabError
syn keyword pythonExClass TypeError UnboundLocalError UnicodeError
syn keyword pythonExClass UserWarning ValueError Warning WindowsError
syn keyword pythonExClass ZeroDivisionError
endif
syn sync clear
if exists("python_folding") && has("folding")
syn sync fromstart
"syn match pythonFold "^\(\s*\)\(class\|def\)\s.*\(\(\n\s*\)*\n\1\s\+\S.*\)\+" transparent fold
syn region pythonFold start="^\z(\s*\)\(class\|def\)\s" skip="\(\s*\n\)\+\z1\s\+\(\S\|\%$\)" end="\(\s*\n\)\+\s*\(\S\|\%$\)"me=s-1 transparent fold
syn region pythonFold start="{" end="}" transparent fold
syn region pythonFold start="\[" end="\]" transparent fold
else
" This is fast but code inside triple quoted strings screws it up. It
" is impossible to fix because the only way to know if you are inside a
" triple quoted string is to start from the beginning of the file. If
" you have a fast machine you can try uncommenting the "sync minlines"
" and commenting out the rest.
syn sync match pythonSync grouphere NONE "):$"
syn sync maxlines=200
"syn sync minlines=2000
endif
if version >= 508 || !exists("did_python_syn_inits")
if version <= 508
let did_python_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink pythonStatement Statement
HiLink pythonImport Statement
HiLink pythonFunction Function
HiLink pythonConditional Conditional
HiLink pythonRepeat Repeat
HiLink pythonException Exception
HiLink pythonOperator Operator
HiLink pythonComment Comment
HiLink pythonTodo Todo
HiLink pythonError Error
HiLink pythonString String
HiLink pythonUniString String
HiLink pythonRawString String
HiLink pythonUniRawString String
HiLink pythonEscape Special
HiLink pythonEscapeError Error
HiLink pythonUniEscape Special
HiLink pythonUniEscapeError Error
HiLink pythonUniRawEscape Special
HiLink pythonUniRawEscapeError Error
if exists("python_highlight_string_formatting")
HiLink pythonStrFormat Special
endif
HiLink pythonNumber Number
HiLink pythonFloat Float
HiLink pythonOctalError Error
if exists("python_highlight_builtins")
HiLink pythonBuiltinObj Structure
HiLink pythonBuiltinFunc Function
endif
if exists("python_highlight_exceptions")
HiLink pythonExClass Structure
endif
delcommand HiLink
endif
let b:current_syntax = "python"

View File

@ -1,65 +0,0 @@
PYTHON *python.vim* *ft-python-syntax*
There are two commands to enable or disable an option for python.vim
Enable option: >
:let option_name = 1
<
Disable option: >
:let option_name = 0
<
For example to enable all syntax highlighting features you can place the
following command in your `~/.vimrc` script: >
let python_highlight_all = 1
<
Option and commands to select Python version: >
:let python_version_2 = 1
<
Enable highlighting for Python 2 (Python 3 highlighting is enabled by
default). Also can be set as a local to buffer `b:python_version_2`
variable.
The following local to buffer commands can be used to switch between two
highlighting modes:
Switch to Python 2 highlighting mode >
:Python2Syntax
<
Switch to Python 3 highlighting mode >
:Python3Syntax
<
Options used by the script
Highlight builtin functions and objects >
:let python_highlight_builtins = 1
< Highlight builtin objects only >
:let python_highlight_builtin_objs = 1
< Highlight builtin functions only >
:let python_highlight_builtin_funcs = 1
< Highlight standard exceptions >
:let python_highlight_exceptions = 1
< Highlight `%` string formatting >
:let python_highlight_string_formatting = 1
< Highlight syntax of `str.format` syntax >
:let python_highlight_string_format = 1
< Highlight syntax of `string.Template` >
:let python_highlight_string_templates = 1
< Highlight indentation errors >
:let python_highlight_indent_errors = 1
< Highlight trailing spaces >
:let python_highlight_space_errors = 1
< Highlight doc-tests >
:let python_highlight_doctests = 1
< Highlight `print` statement as function for Python 2 >
:let python_print_as_function = 1
< Highlight shebang and coding headers as comments >
:let python_highlight_file_headers_as_comments = 1
< Enable all the options above. NOTE: This option don't override any
previously set options >
:let python_highlight_all = 1
< Can be set to 0 for slow machines >
:let python_slow_sync = 1
<
vim:tw=78:sw=4:ts=8:ft=help:norl:

View File

@ -1,568 +0,0 @@
" Vim syntax file
" Language: Python
" Current Maintainer: Dmitry Vasiliev <dima at hlabs dot org>
" Previous Maintainer: Neil Schemenauer <nas at python dot ca>
" URL: https://github.com/hdima/python-syntax
" Last Change: 2015-11-01
" Filenames: *.py
" Version: 3.6.0
"
" Based on python.vim (from Vim 6.1 distribution)
" by Neil Schemenauer <nas at python dot ca>
"
" Please use the following channels for reporting bugs, offering suggestions or
" feedback:
" - python.vim issue tracker: https://github.com/hdima/python-syntax/issues
" - Email: Dmitry Vasiliev (dima at hlabs.org)
" - Send a message or follow me for updates on Twitter: `@hdima
" <https://twitter.com/hdima>`__
"
" Contributors
" ============
"
" List of the contributors in alphabetical order:
"
" Andrea Riciputi
" Anton Butanaev
" Antony Lee
" Caleb Adamantine
" David Briscoe
" Elizabeth Myers
" Ihor Gorobets
" Jeroen Ruigrok van der Werven
" John Eikenberry
" Joongi Kim
" Marc Weber
" Pedro Algarvio
" Victor Salgado
" Will Gray
" Yuri Habrusiev
"
" Options
" =======
"
" :let OPTION_NAME = 1 Enable option
" :let OPTION_NAME = 0 Disable option
"
"
" Option to select Python version
" -------------------------------
"
" python_version_2 Enable highlighting for Python 2
" (Python 3 highlighting is enabled
" by default). Can also be set as
" a buffer (b:python_version_2)
" variable.
"
" You can also use the following local to buffer commands to switch
" between two highlighting modes:
"
" :Python2Syntax Switch to Python 2 highlighting
" mode
" :Python3Syntax Switch to Python 3 highlighting
" mode
"
" Option names used by the script
" -------------------------------
"
" python_highlight_builtins Highlight builtin functions and
" objects
" python_highlight_builtin_objs Highlight builtin objects only
" python_highlight_builtin_funcs Highlight builtin functions only
" python_highlight_exceptions Highlight standard exceptions
" python_highlight_string_formatting Highlight % string formatting
" python_highlight_string_format Highlight str.format syntax
" python_highlight_string_templates Highlight string.Template syntax
" python_highlight_indent_errors Highlight indentation errors
" python_highlight_space_errors Highlight trailing spaces
" 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
" any previously set options
"
" python_slow_sync Can be set to 0 for slow machines
"
" For version 5.x: Clear all syntax items
" For versions greater than 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
"
" Commands
"
command! -buffer Python2Syntax let b:python_version_2 = 1 | let &syntax=&syntax
command! -buffer Python3Syntax let b:python_version_2 = 0 | let &syntax=&syntax
" Enable option if it's not defined
function! s:EnableByDefault(name)
if !exists(a:name)
let {a:name} = 1
endif
endfunction
" Check if option is enabled
function! s:Enabled(name)
return exists(a:name) && {a:name}
endfunction
" Is it Python 2 syntax?
function! s:Python2Syntax()
if exists("b:python_version_2")
return b:python_version_2
endif
return s:Enabled("g:python_version_2")
endfunction
"
" Default options
"
call s:EnableByDefault("g:python_slow_sync")
if s:Enabled("g:python_highlight_all")
call s:EnableByDefault("g:python_highlight_builtins")
if s:Enabled("g:python_highlight_builtins")
call s:EnableByDefault("g:python_highlight_builtin_objs")
call s:EnableByDefault("g:python_highlight_builtin_funcs")
endif
call s:EnableByDefault("g:python_highlight_exceptions")
call s:EnableByDefault("g:python_highlight_string_formatting")
call s:EnableByDefault("g:python_highlight_string_format")
call s:EnableByDefault("g:python_highlight_string_templates")
call s:EnableByDefault("g:python_highlight_indent_errors")
call s:EnableByDefault("g:python_highlight_space_errors")
call s:EnableByDefault("g:python_highlight_doctests")
call s:EnableByDefault("g:python_print_as_function")
endif
"
" Keywords
"
syn keyword pythonStatement break continue del
syn keyword pythonStatement exec return
syn keyword pythonStatement pass raise
syn keyword pythonStatement global assert
syn keyword pythonStatement lambda
syn keyword pythonStatement with
syn keyword pythonStatement def class nextgroup=pythonFunction skipwhite
syn keyword pythonRepeat for while
syn keyword pythonConditional if elif else
" The standard pyrex.vim unconditionally removes the pythonInclude group, so
" we provide a dummy group here to avoid crashing pyrex.vim.
syn keyword pythonInclude import
syn keyword pythonImport import
syn keyword pythonException try except finally
syn keyword pythonOperator and in is not or
syn match pythonStatement "\<yield\>" display
syn match pythonImport "\<from\>" display
if s:Python2Syntax()
if !s:Enabled("g:python_print_as_function")
syn keyword pythonStatement print
endif
syn keyword pythonImport as
syn match pythonFunction "[a-zA-Z_][a-zA-Z0-9_]*" display contained
else
syn keyword pythonStatement as nonlocal None
syn match pythonStatement "\<yield\s\+from\>" display
syn keyword pythonBoolean True False
syn match pythonFunction "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
syn keyword pythonStatement await
syn match pythonStatement "\<async\s\+def\>" nextgroup=pythonFunction skipwhite
syn match pythonStatement "\<async\s\+with\>" display
syn match pythonStatement "\<async\s\+for\>" display
endif
"
" Decorators (new in Python 2.4)
"
syn match pythonDecorator "@" display nextgroup=pythonDottedName skipwhite
if s:Python2Syntax()
syn match pythonDottedName "[a-zA-Z_][a-zA-Z0-9_]*\%(\.[a-zA-Z_][a-zA-Z0-9_]*\)*" display contained
else
syn match pythonDottedName "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\)*" display contained
endif
syn match pythonDot "\." display containedin=pythonDottedName
"
" Comments
"
syn match pythonComment "#.*$" display contains=pythonTodo,@Spell
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
"
" Errors
"
syn match pythonError "\<\d\+\D\+\>" display
syn match pythonError "[$?]" display
syn match pythonError "[&|]\{2,}" display
syn match pythonError "[=]\{3,}" display
" Mixing spaces and tabs also may be used for pretty formatting multiline
" statements
if s:Enabled("g:python_highlight_indent_errors")
syn match pythonIndentError "^\s*\%( \t\|\t \)\s*\S"me=e-1 display
endif
" Trailing space errors
if s:Enabled("g:python_highlight_space_errors")
syn match pythonSpaceError "\s\+$" display
endif
"
" Strings
"
if s:Python2Syntax()
" Python 2 strings
syn region pythonString start=+[bB]\='+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
syn region pythonString start=+[bB]\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
syn region pythonString start=+[bB]\="""+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
syn region pythonString start=+[bB]\='''+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
else
" Python 3 byte strings
syn region pythonBytes start=+[bB]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell
syn region pythonBytes start=+[bB]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell
syn region pythonBytes start=+[bB]"""+ end=+"""+ keepend contains=pythonBytesError,pythonBytesContent,pythonDocTest2,pythonSpaceError,@Spell
syn region pythonBytes start=+[bB]'''+ end=+'''+ keepend contains=pythonBytesError,pythonBytesContent,pythonDocTest,pythonSpaceError,@Spell
syn match pythonBytesError ".\+" display contained
syn match pythonBytesContent "[\u0000-\u00ff]\+" display contained contains=pythonBytesEscape,pythonBytesEscapeError
endif
syn match pythonBytesEscape +\\[abfnrtv'"\\]+ display contained
syn match pythonBytesEscape "\\\o\o\=\o\=" display contained
syn match pythonBytesEscapeError "\\\o\{,2}[89]" display contained
syn match pythonBytesEscape "\\x\x\{2}" display contained
syn match pythonBytesEscapeError "\\x\x\=\X" display contained
syn match pythonBytesEscape "\\$"
syn match pythonUniEscape "\\u\x\{4}" display contained
syn match pythonUniEscapeError "\\u\x\{,3}\X" display contained
syn match pythonUniEscape "\\U\x\{8}" display contained
syn match pythonUniEscapeError "\\U\x\{,7}\X" display contained
syn match pythonUniEscape "\\N{[A-Z ]\+}" display contained
syn match pythonUniEscapeError "\\N{[^A-Z ]\+}" display contained
if s:Python2Syntax()
" Python 2 Unicode strings
syn region pythonUniString start=+[uU]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
syn region pythonUniString start=+[uU]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
syn region pythonUniString start=+[uU]"""+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
syn region pythonUniString start=+[uU]'''+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
else
" Python 3 strings
syn region pythonString start=+'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
syn region pythonString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
syn region pythonString start=+"""+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
syn region pythonString start=+'''+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
endif
if s:Python2Syntax()
" Python 2 Unicode raw strings
syn region pythonUniRawString start=+[uU][rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError,@Spell
syn region pythonUniRawString start=+[uU][rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError,@Spell
syn region pythonUniRawString start=+[uU][rR]"""+ end=+"""+ keepend contains=pythonUniRawEscape,pythonUniRawEscapeError,pythonDocTest2,pythonSpaceError,@Spell
syn region pythonUniRawString start=+[uU][rR]'''+ end=+'''+ keepend contains=pythonUniRawEscape,pythonUniRawEscapeError,pythonDocTest,pythonSpaceError,@Spell
syn match pythonUniRawEscape "\([^\\]\(\\\\\)*\)\@<=\\u\x\{4}" display contained
syn match pythonUniRawEscapeError "\([^\\]\(\\\\\)*\)\@<=\\u\x\{,3}\X" display contained
endif
" Python 2/3 raw strings
if s:Python2Syntax()
syn region pythonRawString start=+[bB]\=[rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell
syn region pythonRawString start=+[bB]\=[rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell
syn region pythonRawString start=+[bB]\=[rR]"""+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell
syn region pythonRawString start=+[bB]\=[rR]'''+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
else
syn region pythonRawString start=+[rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell
syn region pythonRawString start=+[rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell
syn region pythonRawString start=+[rR]"""+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell
syn region pythonRawString start=+[rR]'''+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
syn region pythonRawBytes start=+[bB][rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell
syn region pythonRawBytes start=+[bB][rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell
syn region pythonRawBytes start=+[bB][rR]"""+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell
syn region pythonRawBytes start=+[bB][rR]'''+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
endif
syn match pythonRawEscape +\\['"]+ display transparent contained
if s:Enabled("g:python_highlight_string_formatting")
" % operator string formatting
if s:Python2Syntax()
syn match pythonStrFormatting "%\%(([^)]\+)\)\=[-#0 +]*\d*\%(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
syn match pythonStrFormatting "%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
else
syn match pythonStrFormatting "%\%(([^)]\+)\)\=[-#0 +]*\d*\%(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonRawString
syn match pythonStrFormatting "%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonRawString
endif
endif
if s:Enabled("g:python_highlight_string_format")
" str.format syntax
if s:Python2Syntax()
syn match pythonStrFormat "{{\|}}" contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
syn match pythonStrFormat "{\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)\=\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\[\%(\d\+\|[^!:\}]\+\)\]\)*\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}" contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
else
syn match pythonStrFormat "{{\|}}" contained containedin=pythonString,pythonRawString
syn match pythonStrFormat "{\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)\=\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\[\%(\d\+\|[^!:\}]\+\)\]\)*\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}" contained containedin=pythonString,pythonRawString
endif
endif
if s:Enabled("g:python_highlight_string_templates")
" string.Template format
if s:Python2Syntax()
syn match pythonStrTemplate "\$\$" contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
syn match pythonStrTemplate "\${[a-zA-Z_][a-zA-Z0-9_]*}" contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
syn match pythonStrTemplate "\$[a-zA-Z_][a-zA-Z0-9_]*" contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
else
syn match pythonStrTemplate "\$\$" contained containedin=pythonString,pythonRawString
syn match pythonStrTemplate "\${[a-zA-Z_][a-zA-Z0-9_]*}" contained containedin=pythonString,pythonRawString
syn match pythonStrTemplate "\$[a-zA-Z_][a-zA-Z0-9_]*" contained containedin=pythonString,pythonRawString
endif
endif
if s:Enabled("g:python_highlight_doctests")
" DocTests
syn region pythonDocTest start="^\s*>>>" end=+'''+he=s-1 end="^\s*$" contained
syn region pythonDocTest2 start="^\s*>>>" end=+"""+he=s-1 end="^\s*$" contained
endif
"
" Numbers (ints, longs, floats, complex)
"
if s:Python2Syntax()
syn match pythonHexError "\<0[xX]\x*[g-zG-Z]\+\x*[lL]\=\>" display
syn match pythonOctError "\<0[oO]\=\o*\D\+\d*[lL]\=\>" display
syn match pythonBinError "\<0[bB][01]*\D\+\d*[lL]\=\>" display
syn match pythonHexNumber "\<0[xX]\x\+[lL]\=\>" display
syn match pythonOctNumber "\<0[oO]\o\+[lL]\=\>" display
syn match pythonBinNumber "\<0[bB][01]\+[lL]\=\>" display
syn match pythonNumberError "\<\d\+\D[lL]\=\>" display
syn match pythonNumber "\<\d[lL]\=\>" display
syn match pythonNumber "\<[0-9]\d\+[lL]\=\>" display
syn match pythonNumber "\<\d\+[lLjJ]\>" display
syn match pythonOctError "\<0[oO]\=\o*[8-9]\d*[lL]\=\>" display
syn match pythonBinError "\<0[bB][01]*[2-9]\d*[lL]\=\>" display
else
syn match pythonHexError "\<0[xX]\x*[g-zG-Z]\x*\>" display
syn match pythonOctError "\<0[oO]\=\o*\D\+\d*\>" display
syn match pythonBinError "\<0[bB][01]*\D\+\d*\>" display
syn match pythonHexNumber "\<0[xX]\x\+\>" display
syn match pythonOctNumber "\<0[oO]\o\+\>" display
syn match pythonBinNumber "\<0[bB][01]\+\>" display
syn match pythonNumberError "\<\d\+\D\>" display
syn match pythonNumberError "\<0\d\+\>" display
syn match pythonNumber "\<\d\>" display
syn match pythonNumber "\<[1-9]\d\+\>" display
syn match pythonNumber "\<\d\+[jJ]\>" display
syn match pythonOctError "\<0[oO]\=\o*[8-9]\d*\>" display
syn match pythonBinError "\<0[bB][01]*[2-9]\d*\>" display
endif
syn match pythonFloat "\.\d\+\%([eE][+-]\=\d\+\)\=[jJ]\=\>" display
syn match pythonFloat "\<\d\+[eE][+-]\=\d\+[jJ]\=\>" display
syn match pythonFloat "\<\d\+\.\d*\%([eE][+-]\=\d\+\)\=[jJ]\=" display
"
" Builtin objects and types
"
if s:Enabled("g:python_highlight_builtin_objs")
if s:Python2Syntax()
syn keyword pythonBuiltinObj None
syn keyword pythonBoolean True False
endif
syn keyword pythonBuiltinObj Ellipsis NotImplemented
syn keyword pythonBuiltinObj __debug__ __doc__ __file__ __name__ __package__
endif
"
" Builtin functions
"
if s:Enabled("g:python_highlight_builtin_funcs")
if s:Python2Syntax()
syn keyword pythonBuiltinFunc apply basestring buffer callable coerce
syn keyword pythonBuiltinFunc execfile file help intern long raw_input
syn keyword pythonBuiltinFunc reduce reload unichr unicode xrange
if s:Enabled("g:python_print_as_function")
syn keyword pythonBuiltinFunc print
endif
else
syn keyword pythonBuiltinFunc ascii exec memoryview print
endif
syn keyword pythonBuiltinFunc __import__ abs all any
syn keyword pythonBuiltinFunc bin bool bytearray bytes
syn keyword pythonBuiltinFunc chr classmethod cmp compile complex
syn keyword pythonBuiltinFunc delattr dict dir divmod enumerate eval
syn keyword pythonBuiltinFunc filter float format frozenset getattr
syn keyword pythonBuiltinFunc globals hasattr hash hex id
syn keyword pythonBuiltinFunc input int isinstance
syn keyword pythonBuiltinFunc issubclass iter len list locals map max
syn keyword pythonBuiltinFunc min next object oct open ord
syn keyword pythonBuiltinFunc pow property range
syn keyword pythonBuiltinFunc repr reversed round set setattr
syn keyword pythonBuiltinFunc slice sorted staticmethod str sum super tuple
syn keyword pythonBuiltinFunc type vars zip
endif
"
" Builtin exceptions and warnings
"
if s:Enabled("g:python_highlight_exceptions")
if s:Python2Syntax()
syn keyword pythonExClass StandardError
else
syn keyword pythonExClass BlockingIOError ChildProcessError
syn keyword pythonExClass ConnectionError BrokenPipeError
syn keyword pythonExClass ConnectionAbortedError ConnectionRefusedError
syn keyword pythonExClass ConnectionResetError FileExistsError
syn keyword pythonExClass FileNotFoundError InterruptedError
syn keyword pythonExClass IsADirectoryError NotADirectoryError
syn keyword pythonExClass PermissionError ProcessLookupError TimeoutError
syn keyword pythonExClass ResourceWarning
endif
syn keyword pythonExClass BaseException
syn keyword pythonExClass Exception ArithmeticError
syn keyword pythonExClass LookupError EnvironmentError
syn keyword pythonExClass AssertionError AttributeError BufferError EOFError
syn keyword pythonExClass FloatingPointError GeneratorExit IOError
syn keyword pythonExClass ImportError IndexError KeyError
syn keyword pythonExClass KeyboardInterrupt MemoryError NameError
syn keyword pythonExClass NotImplementedError OSError OverflowError
syn keyword pythonExClass ReferenceError RuntimeError StopIteration
syn keyword pythonExClass SyntaxError IndentationError TabError
syn keyword pythonExClass SystemError SystemExit TypeError
syn keyword pythonExClass UnboundLocalError UnicodeError
syn keyword pythonExClass UnicodeEncodeError UnicodeDecodeError
syn keyword pythonExClass UnicodeTranslateError ValueError VMSError
syn keyword pythonExClass WindowsError ZeroDivisionError
syn keyword pythonExClass Warning UserWarning BytesWarning DeprecationWarning
syn keyword pythonExClass PendingDepricationWarning SyntaxWarning
syn keyword pythonExClass RuntimeWarning FutureWarning
syn keyword pythonExClass ImportWarning UnicodeWarning
endif
if s:Enabled("g:python_slow_sync")
syn sync minlines=2000
else
" This is fast but code inside triple quoted strings screws it up. It
" is impossible to fix because the only way to know if you are inside a
" triple quoted string is to start from the beginning of the file.
syn sync match pythonSync grouphere NONE "):$"
syn sync maxlines=200
endif
if version >= 508 || !exists("did_python_syn_inits")
if version <= 508
let did_python_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink pythonStatement Statement
HiLink pythonImport Include
HiLink pythonFunction Function
HiLink pythonConditional Conditional
HiLink pythonRepeat Repeat
HiLink pythonException Exception
HiLink pythonOperator Operator
HiLink pythonDecorator Define
HiLink pythonDottedName Function
HiLink pythonDot Normal
HiLink pythonComment Comment
if !s:Enabled("g:python_highlight_file_headers_as_comments")
HiLink pythonCoding Special
HiLink pythonRun Special
endif
HiLink pythonTodo Todo
HiLink pythonError Error
HiLink pythonIndentError Error
HiLink pythonSpaceError Error
HiLink pythonString String
HiLink pythonRawString String
HiLink pythonUniEscape Special
HiLink pythonUniEscapeError Error
if s:Python2Syntax()
HiLink pythonUniString String
HiLink pythonUniRawString String
HiLink pythonUniRawEscape Special
HiLink pythonUniRawEscapeError Error
else
HiLink pythonBytes String
HiLink pythonRawBytes String
HiLink pythonBytesContent String
HiLink pythonBytesError Error
HiLink pythonBytesEscape Special
HiLink pythonBytesEscapeError Error
endif
HiLink pythonStrFormatting Special
HiLink pythonStrFormat Special
HiLink pythonStrTemplate Special
HiLink pythonDocTest Special
HiLink pythonDocTest2 Special
HiLink pythonNumber Number
HiLink pythonHexNumber Number
HiLink pythonOctNumber Number
HiLink pythonBinNumber Number
HiLink pythonFloat Float
HiLink pythonNumberError Error
HiLink pythonOctError Error
HiLink pythonHexError Error
HiLink pythonBinError Error
HiLink pythonBoolean Boolean
HiLink pythonBuiltinObj Structure
HiLink pythonBuiltinFunc Function
HiLink pythonExClass Structure
delcommand HiLink
endif
let b:current_syntax = "python"

View File

@ -1,143 +0,0 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Above the run-comment and file encoding comment.
# Comments.
# TODO FIXME XXX
# Keywords.
with break continue del exec return pass print raise global assert lambda yield
for while if elif else import from as try except finally and in is not or
yield from
def functionname
class Classname
def функция
class Класс
await
async def Test
async with
async for
# Builtin objects.
True False Ellipsis None NotImplemented
# Builtin function and types.
__import__ abs all any apply basestring bool buffer callable chr classmethod
cmp coerce compile complex delattr dict dir divmod enumerate eval execfile file
filter float frozenset getattr globals hasattr hash help hex id input int
intern isinstance issubclass iter len list locals long map max min object oct
open ord pow property range raw_input reduce reload repr reversed round set
setattr slice sorted staticmethod str sum super tuple type unichr unicode vars
xrange zip
# Builtin exceptions and warnings.
BaseException Exception StandardError ArithmeticError LookupError
EnvironmentError
AssertionError AttributeError EOFError FloatingPointError GeneratorExit IOError
ImportError IndexError KeyError KeyboardInterrupt MemoryError NameError
NotImplementedError OSError OverflowError ReferenceError RuntimeError
StopIteration SyntaxError IndentationError TabError SystemError SystemExit
TypeError UnboundLocalError UnicodeError UnicodeEncodeError UnicodeDecodeError
UnicodeTranslateError ValueError WindowsError ZeroDivisionError
Warning UserWarning DeprecationWarning PendingDepricationWarning SyntaxWarning
RuntimeWarning FutureWarning ImportWarning UnicodeWarning
# Decorators.
@ decoratorname
@ object.__init__(arg1, arg2)
@ декоратор
@ декоратор.décorateur
# Numbers
0 1 2 9 10 0x1f .3 12.34 0j 0j 34.2E-3 0b10 0o77 1023434 0x0
# Erroneous numbers
077 100L 0xfffffffL 0L 08 0xk 0x 0b102 0o78 0o123LaB
# Strings
" test " ' test '
"""
test
"""
'''
test
'''
" \a\b\c\"\'\n\r \x34\077 \08 \xag"
r" \" \' "
"testтест"
b"test"
b"test\r\n\xffff"
b"тестtest"
br"test"
br"\a\b\n\r"
# Formattings
" %f "
b" %f "
"{0.name!r:b} {0[n]} {name!s: } {{test}} {{}} {} {.__len__:s}"
b"{0.name!r:b} {0[n]} {name!s: } {{test}} {{}} {} {.__len__:s}"
"${test} ${test ${test}aname $$$ $test+nope"
b"${test} ${test ${test}aname $$$ $test+nope"
# Doctests.
"""
Test:
>>> a = 5
>>> a
5
Test
"""
'''
Test:
>>> a = 5
>>> a
5
Test
'''
# Erroneous symbols or bad variable names.
$ ? 6xav
&& || ===
# Indentation errors.
break
# Trailing space errors.
break
"""
test
"""

@ -0,0 +1 @@
Subproject commit fe5f3a5fad0f747fa830cd07d3b2fd9805d6da47

@ -0,0 +1 @@
Subproject commit e0d800481f322d854ad133ff5f9bf90665557e6c