@@ -3,142 +3,105 @@ Python syntax highlighting script for Vim
3
3
4
4
.. contents ::
5
5
6
- About
7
- -----
8
-
9
- Enhanced version of the original Python syntax highlighting script. Based on
10
- ``python.vim `` from Vim 6.1 distribution by Neil Schemenauer (nas at python dot
11
- ca). Check also `python.vim page on vim.org
12
- <http://www.vim.org/scripts/script.php?script_id=790> `_.
13
-
14
- Please report bugs and feature requests to our issue tracker over at:
15
- https://github.com/vim-python/python-syntax/issues
6
+ This is an enhanced version of the original Python syntax highlighting script. Based on
7
+ ``python.vim `` from Vim 6.1 distribution by Neil Schemenauer.
16
8
17
9
Features
18
10
--------
19
11
20
- Changes from the original ``python.vim `` are:
21
-
22
12
- Added support for Python 3 syntax highlighting
23
- - Added ``:Python2Syntax `` and ``:Python3Syntax `` commands which allow to
24
- switch between Python 2 and Python 3 syntaxes respectively without
25
- reloads/restarts
26
- - Updated strings highlighting
13
+ - Added commands ``Python2Syntax `` and ``Python3Syntax `` commands which allow to switch
14
+ between Python 2 and Python 3 syntaxes respectively without reloads/restarts
15
+ - Updated string highlighting
27
16
- Enhanced special symbols highlighting inside strings
28
17
- Enhanced highlighting of numeric constants
29
18
- Added optional highlighting for %-formatting inside strings
30
- - Added highlighting for magic comments: source code encoding and #!
31
- (executable) strings
19
+ - Added highlighting for magic comments: source code encoding and #! (executable) strings
32
20
- Added highlighting for new exceptions and builtins
33
21
- Added highlighting for doctests
34
22
- Added highlighting for new ``@decorator `` syntax introduced in Python 2.4a2
35
23
- Added highlighting for the following errors:
24
+ - Invalid symbols in source file
25
+ - Mixing spaces and tabs
26
+ - Invalid numeric constants
27
+ - Invalid %-formatting inside strings
28
+ - Invalid variable names
29
+ - Trailing spaces (triggered by the ``python_highlight_space_errors `` option)
36
30
37
- - invalid symbols in source file
38
- - mixing spaces and tabs
39
- - invalid numeric constants
40
- - invalid %-formatting inside strings
41
- - invalid variable names
42
- - trailing spaces (triggered by the ``python_highlight_space_errors `` option)
43
-
44
- Some of these features was later backported into the original ``python.vim ``.
45
-
46
- Folding is done by the plugin `SimpylFold <https://github.com/tmhedberg/SimpylFold >`_
31
+ Folding is done by the plugin `SimpylFold <https://github.com/tmhedberg/SimpylFold >`_.
47
32
48
33
How to install
49
34
--------------
50
35
51
- The easiest installation method is to place `syntax/python.vim
52
- <https://github.com/vim-python/python-syntax/blob/master/syntax/python.vim> `_ script
53
- into your ``~/.vim/syntax/ `` directory.
36
+ Use one of the following plugin managers:
37
+
38
+ - `dein <https://github.com/Shougo/dein.vim >`_
39
+ - `vim-plug <https://github.com/junegunn/vim-plug >`_
40
+ - `vundle <https://github.com/VundleVim/Vundle.vim >`_
41
+ - `pathogen <https://github.com/tpope/vim-pathogen >`_
54
42
55
- You can also use `Pathogen <https://github.com/tpope/vim-pathogen >`_ or `Vundle
56
- <https://github.com/gmarik/vundle> `_ plugin managers in which case you can
57
- install the whole `repository
58
- <https://github.com/vim-python/python-syntax> `_ into the corresponding plugins
59
- directory.
43
+ Or you can just manually place `syntax/python.vim
44
+ <https://github.com/vim-python/python-syntax/blob/master/syntax/python.vim> `_
45
+ into ``~/.config/nvim/syntax/ `` or ``~/.vim/syntax/ ``.
60
46
61
47
Script options
62
48
--------------
63
49
64
- There are two commands to enable or disable an option:
50
+ Enable option with::
51
+
52
+ let OPTION_NAME = 1
53
+
54
+ Disable option with::
65
55
66
- ``:let OPTION_NAME = 1 ``
67
- Enable option
68
- ``:let OPTION_NAME = 0 ``
69
- Disable option
56
+ let OPTION_NAME = 0
70
57
71
58
For example to enable all syntax highlighting features you can place the
72
- following command in your ``~/.vimrc `` script::
73
-
74
- let python_highlight_all = 1
75
-
76
- Option and commands to select Python version
77
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
78
-
79
- ``python_version_2 ``
80
- Enable highlighting for Python 2 (Python 3 highlighting is enabled by
81
- default). Also can be set as a local to buffer ``b:python_version_2 ``
82
- variable.
83
-
84
- The following local to buffer commands can be used to switch between two
85
- highlighting modes:
86
-
87
- ``:Python2Syntax ``
88
- Switch to Python 2 highlighting mode
89
- ``:Python3Syntax ``
90
- Switch to Python 3 highlighting mode
91
-
92
- Options used by the script
93
- ~~~~~~~~~~~~~~~~~~~~~~~~~~
94
-
95
- ``python_highlight_builtins ``
96
- Highlight builtin functions and objects
97
- ``python_highlight_builtin_objs ``
98
- Highlight builtin objects only
99
- ``python_highlight_builtin_funcs ``
100
- Highlight builtin functions only
101
- ``python_highlight_exceptions ``
102
- Highlight standard exceptions
103
- ``python_highlight_string_formatting ``
104
- Highlight ``% `` string formatting
105
- ``python_highlight_string_format ``
106
- Highlight syntax of ``str.format `` syntax
107
- ``python_highlight_string_templates ``
108
- Highlight syntax of ``string.Template ``
109
- ``python_highlight_indent_errors ``
110
- Highlight indentation errors
111
- ``python_highlight_space_errors ``
112
- Highlight trailing spaces
113
- ``python_highlight_doctests ``
114
- Highlight doc-tests
115
- ``python_print_as_function ``
116
- Highlight ``print `` statement as function for Python 2
117
- ``python_highlight_file_headers_as_comments ``
118
- Highlight shebang and coding headers as comments
119
- ``python_highlight_all ``
120
- Enable all the options above. *NOTE: This option don't override any
121
- previously set options *
122
- ``python_slow_sync ``
123
- Can be set to 0 for slow machines
124
-
125
- Contributors
126
- ------------
127
-
128
- List of the contributors in alphabetical order:
129
-
130
- - `Andrea Riciputi <https://github.com/mrrech >`_
131
- - Anton Butanaev
132
- - `Antony Lee <https://github.com/anntzer >`_
133
- - Caleb Adamantine
134
- - `David Briscoe <https://github.com/idbrii >`_
135
- - `Elizabeth Myers <https://github.com/Elizafox >`_
136
- - `Ihor Gorobets <https://github.com/iho >`_
137
- - `Jeroen Ruigrok van der Werven <https://github.com/ashemedai >`_
138
- - `John Eikenberry <https://github.com/eikenb >`_
139
- - `Joongi Kim <https://github.com/achimnol >`_
140
- - `Marc Weber <https://github.com/MarcWeber >`_
141
- - `Pedro Algarvio <https://github.com/s0undt3ch >`_
142
- - `Victor Salgado <https://github.com/mcsalgado >`_
143
- - `Will Gray <https://github.com/graywh >`_
144
- - `Yuri Habrusiev <https://github.com/yuriihabrusiev >`_
59
+ following command in your ``~/.config/nvim/init.vim `` or ``~/.vimrc `` script::
60
+
61
+ let g:python_highlight_all = 1
62
+
63
+ Options and commands to select Python version
64
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
65
+
66
+ ``g:python_version_2 `` or ``b:python_version_2 ``
67
+ Enable highlighting for Python 2 (Python 3 highlighting is enabled by
68
+ default).
69
+
70
+ The following commands can be used to switch between modes:
71
+
72
+ ``Python2Syntax ``
73
+ Switch to Python 2
74
+ ``Python3Syntax ``
75
+ Switch to Python 3
76
+
77
+ Other options
78
+ ~~~~~~~~~~~~~
79
+
80
+ ``g:python_highlight_builtins ``
81
+ Highlight builtin functions and objects
82
+ ``g:python_highlight_builtin_objs ``
83
+ Highlight builtin objects only
84
+ ``g:python_highlight_builtin_funcs ``
85
+ Highlight builtin functions only
86
+ ``g:python_highlight_exceptions ``
87
+ Highlight standard exceptions
88
+ ``g:python_highlight_string_formatting ``
89
+ Highlight ``% `` string formatting
90
+ ``g:python_highlight_string_format ``
91
+ Highlight syntax of ``str.format `` syntax
92
+ ``g:python_highlight_string_templates ``
93
+ Highlight syntax of ``string.Template ``
94
+ ``g:python_highlight_indent_errors ``
95
+ Highlight indentation errors
96
+ ``g:python_highlight_space_errors ``
97
+ Highlight trailing spaces
98
+ ``g:python_highlight_doctests ``
99
+ Highlight doc-tests
100
+ ``g:python_print_as_function ``
101
+ Highlight ``print `` statement as function for Python 2
102
+ ``g:python_highlight_file_headers_as_comments ``
103
+ Highlight shebang and coding headers as comments
104
+ ``g:python_highlight_all ``
105
+ Enable all the options above - *NOTE: Doesn't override any previously set options *
106
+ ``g:python_slow_sync ``
107
+ Disable for slow machines
0 commit comments