3
3
===============================================================================
4
4
Introduction *python-syntax* *ft-python-syntax* *python.vim*
5
5
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.
8
8
9
9
Features
10
10
--------
11
11
12
12
* 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.
15
15
* Updated string highlighting
16
16
* Enhanced special symbols highlighting inside strings
17
17
* Enhanced highlighting of numeric constants
18
18
* 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 (`#!`)
20
21
* Added highlighting for new exceptions and builtins
21
22
* Added highlighting for doctests
22
23
* Added highlighting for new `@decorator` syntax introduced in Python 2.4a2
@@ -26,68 +27,78 @@ Features
26
27
* Invalid numeric constants
27
28
* Invalid %-formatting inside strings
28
29
* Invalid variable names
29
- * Trailing spaces (triggered by the ` python_highlight_space_errors` option )
30
+ * Trailing spaces (Enabled with `g: python_highlight_space_errors`)
30
31
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).
32
34
33
35
===============================================================================
34
36
Configuration *python-syntax-configuration*
35
37
36
- Enable option with: >
38
+ Option variables
39
+ ----------------
37
40
38
- let VARIABLE = 1
39
- <
40
- Disable option with: >
41
+ Set variable to `1` to enable or `0` to disable.
41
42
42
- let VARIABLE = 0
43
- <
44
43
For example to enable all syntax highlighting features you can add the
45
44
following command to your `~/.config/nvim/init.vim` or `~/.vimrc`: >
46
45
47
46
let g:python_highlight_all = 1
48
47
<
49
- -------------------------------------------------------------------------------
50
- Select Python version *python-syntax-version*
51
48
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
55
51
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)
62
54
63
- -------------------------------------------------------------------------------
64
- Option variables *python-syntax-options* *python-syntax-variables*
55
+ `g:python_highlight_builtins` (default `0`)
56
+ Highlight builtin functions and objects
65
57
66
- `g:python_highlight_builtins`
58
+ `g:python_highlight_builtins` (default `0`)
67
59
Highlight builtin functions and objects
68
- `g:python_highlight_builtin_objs`
60
+
61
+ `g:python_highlight_builtin_objs` (default `0`)
69
62
Highlight builtin objects only
70
- `g:python_highlight_builtin_funcs`
63
+
64
+ `g:python_highlight_builtin_funcs` (default `0`)
71
65
Highlight builtin functions only
72
- `g:python_highlight_exceptions`
66
+
67
+ `g:python_highlight_exceptions` (default `0`)
73
68
Highlight standard exceptions
74
- `g:python_highlight_string_formatting`
69
+
70
+ `g:python_highlight_string_formatting` (default `0`)
75
71
Highlight `%` string formatting
76
- `g:python_highlight_string_format`
72
+
73
+ `g:python_highlight_string_format` (default `0`)
77
74
Highlight syntax of `str.format` syntax
78
- `g:python_highlight_string_templates`
75
+
76
+ `g:python_highlight_string_templates` (default `0`)
79
77
Highlight syntax of `string.Template`
80
- `g:python_highlight_indent_errors`
78
+
79
+ `g:python_highlight_indent_errors` (default `0`)
81
80
Highlight indentation errors
82
- `g:python_highlight_space_errors`
81
+
82
+ `g:python_highlight_space_errors` (default `0`)
83
83
Highlight trailing spaces
84
- `g:python_highlight_doctests`
84
+
85
+ `g:python_highlight_doctests` (default `0`)
85
86
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`)
89
92
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`)
93
95
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