33===============================================================================
44Introduction *python-syntax* *ft-python-syntax* *python.vim*
55
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.
6+ This is an enhanced version of the original Vim 6.1 Python syntax highlighting
7+ `python.vim` by Neil Schemenauer.
88
99Features
1010--------
1111
1212* Added support for Python 3 syntax highlighting
13- * Added commands `Python2Syntax` and `Python3Syntax` commands which allow to switch
14- between Python 2 and Python 3 syntaxes respectively without reloads/restarts
13+ * Added commands `Python2Syntax` and `Python3Syntax` allowing to easily switch
14+ between Python 2 and Python 3.
1515* Updated string highlighting
1616* Enhanced special symbols highlighting inside strings
1717* Enhanced highlighting of numeric constants
1818* Added optional highlighting for %-formatting inside strings
19- * Added highlighting for magic comments: source code encoding and #! (executable) strings
19+ * Added highlighting for magic comments: source code encoding and
20+ shebangs (`#!`)
2021* Added highlighting for new exceptions and builtins
2122* Added highlighting for doctests
2223* Added highlighting for new `@decorator` syntax introduced in Python 2.4a2
@@ -26,68 +27,78 @@ Features
2627 * Invalid numeric constants
2728 * Invalid %-formatting inside strings
2829 * Invalid variable names
29- * Trailing spaces (triggered by the ` python_highlight_space_errors` option )
30+ * Trailing spaces (Enabled with `g: python_highlight_space_errors`)
3031
31- Folding is done by the plugin `SimpylFold` (`https://github.com/tmhedberg/SimpylFold`)
32+ Folding is done by the plugin SimpylFold
33+ (https://github.com/tmhedberg/SimpylFold).
3234
3335===============================================================================
3436Configuration *python-syntax-configuration*
3537
36- Enable option with: >
38+ Option variables
39+ ----------------
3740
38- let VARIABLE = 1
39- <
40- Disable option with: >
41+ Set variable to `1` to enable or `0` to disable.
4142
42- let VARIABLE = 0
43- <
4443For example to enable all syntax highlighting features you can add the
4544following command to your `~/.config/nvim/init.vim` or `~/.vimrc`: >
4645
4746 let g:python_highlight_all = 1
4847<
49- -------------------------------------------------------------------------------
50- Select Python version *python-syntax-version*
5148
52- `g:python_version_2` or `b:python_version_2`
53- Enable highlighting for Python 2 (Python 3 highlighting is enabled by
54- default).
49+ `g:python_version_2` (default `0`)
50+ Python 2 mode
5551
56- Commands to easily switch between modes:
57-
58- `Python2Syntax`
59- Switch to Python 2
60- `Python3Syntax`
61- Switch to Python 3
52+ `b:python_version_2` (default `0`)
53+ Python 2 mode (buffer local)
6254
63- -------------------------------------------------------------------------------
64- Option variables *python-syntax-options* *python-syntax-variables*
55+ `g:python_highlight_builtins` (default `0`)
56+ Highlight builtin functions and objects
6557
66- `g:python_highlight_builtins`
58+ `g:python_highlight_builtins` (default `0`)
6759 Highlight builtin functions and objects
68- `g:python_highlight_builtin_objs`
60+
61+ `g:python_highlight_builtin_objs` (default `0`)
6962 Highlight builtin objects only
70- `g:python_highlight_builtin_funcs`
63+
64+ `g:python_highlight_builtin_funcs` (default `0`)
7165 Highlight builtin functions only
72- `g:python_highlight_exceptions`
66+
67+ `g:python_highlight_exceptions` (default `0`)
7368 Highlight standard exceptions
74- `g:python_highlight_string_formatting`
69+
70+ `g:python_highlight_string_formatting` (default `0`)
7571 Highlight `%` string formatting
76- `g:python_highlight_string_format`
72+
73+ `g:python_highlight_string_format` (default `0`)
7774 Highlight syntax of `str.format` syntax
78- `g:python_highlight_string_templates`
75+
76+ `g:python_highlight_string_templates` (default `0`)
7977 Highlight syntax of `string.Template`
80- `g:python_highlight_indent_errors`
78+
79+ `g:python_highlight_indent_errors` (default `0`)
8180 Highlight indentation errors
82- `g:python_highlight_space_errors`
81+
82+ `g:python_highlight_space_errors` (default `0`)
8383 Highlight trailing spaces
84- `g:python_highlight_doctests`
84+
85+ `g:python_highlight_doctests` (default `0`)
8586 Highlight doc-tests
86- `g:python_print_as_function`
87- Highlight `print` statement as function for Python 2
88- `g:python_highlight_file_headers_as_comments`
87+
88+ `g:python_highlight_all` (default `0`)
89+ Enable all highlight options above, except for previously set.
90+
91+ `g:python_highlight_file_headers_as_comments` (default `0`)
8992 Highlight shebang and coding headers as comments
90- `g:python_highlight_all`
91- Enable all the options above - NOTE: Doesn't override any previously set options
92- `g:python_slow_sync`
93+
94+ `g:python_slow_sync` (default `1`)
9395 Disable for slow machines
96+
97+ Commands
98+ --------
99+
100+ `Python2Syntax`
101+ Switch to Python 2
102+
103+ `Python3Syntax`
104+ Switch to Python 3
0 commit comments