Skip to content

Commit 624b675

Browse files
committed
Update documentation
1 parent 80da95b commit 624b675

File tree

2 files changed

+129
-168
lines changed

2 files changed

+129
-168
lines changed

README.rst

Lines changed: 77 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -3,142 +3,105 @@ Python syntax highlighting script for Vim
33

44
.. contents::
55

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.
168

179
Features
1810
--------
1911

20-
Changes from the original ``python.vim`` are:
21-
2212
- 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
2716
- Enhanced special symbols highlighting inside strings
2817
- Enhanced highlighting of numeric constants
2918
- 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
3220
- Added highlighting for new exceptions and builtins
3321
- Added highlighting for doctests
3422
- Added highlighting for new ``@decorator`` syntax introduced in Python 2.4a2
3523
- 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)
3630

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>`_.
4732

4833
How to install
4934
--------------
5035

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>`_
5442

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/``.
6046

6147
Script options
6248
--------------
6349

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::
6555

66-
``:let OPTION_NAME = 1``
67-
Enable option
68-
``:let OPTION_NAME = 0``
69-
Disable option
56+
let OPTION_NAME = 0
7057

7158
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

doc/python-syntax.txt

Lines changed: 52 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,63 @@
1-
PYTHON *python.vim* *ft-python-syntax*
1+
*python-syntax* *ft-python-syntax* *python.vim*
22

3-
There are two commands to enable or disable an option for python.vim
3+
===============================================================================
4+
Configuration *python-syntax-configuration*
45

5-
Enable option: >
6-
:let option_name = 1
6+
Enable option with: >
7+
8+
let OPTION_NAME = 1
79
<
8-
Disable option: >
9-
:let option_name = 0
10+
Disable option with: >
11+
12+
let OPTION_NAME = 0
1013
<
1114
For example to enable all syntax highlighting features you can place the
12-
following command in your `~/.vimrc` script: >
15+
following command in your `~/.config/nvim/init.vim` or `~/.vimrc` script: >
1316

14-
let python_highlight_all = 1
17+
let g:python_highlight_all = 1
1518
<
16-
Option and commands to select Python version: >
19+
-------------------------------------------------------------------------------
20+
Options and commands to select Python version *python-syntax-version*
1721

18-
:let python_version_2 = 1
19-
<
20-
Enable highlighting for Python 2 (Python 3 highlighting is enabled by
21-
default). Also can be set as a local to buffer `b:python_version_2`
22-
variable.
22+
`g:python_version_2` or `b:python_version_2`
23+
Enable highlighting for Python 2 (Python 3 highlighting is enabled by
24+
default).
2325

24-
The following local to buffer commands can be used to switch between two
25-
highlighting modes:
26+
The following commands can be used to switch between modes:
2627

27-
Switch to Python 2 highlighting mode >
28-
:Python2Syntax
29-
<
30-
Switch to Python 3 highlighting mode >
31-
:Python3Syntax
32-
<
33-
Options used by the script
28+
`Python2Syntax`
29+
Switch to Python 2
30+
`Python3Syntax`
31+
Switch to Python 3
3432

35-
Highlight builtin functions and objects >
36-
:let python_highlight_builtins = 1
37-
< Highlight builtin objects only >
38-
:let python_highlight_builtin_objs = 1
39-
< Highlight builtin functions only >
40-
:let python_highlight_builtin_funcs = 1
41-
< Highlight standard exceptions >
42-
:let python_highlight_exceptions = 1
43-
< Highlight `%` string formatting >
44-
:let python_highlight_string_formatting = 1
45-
< Highlight syntax of `str.format` syntax >
46-
:let python_highlight_string_format = 1
47-
< Highlight syntax of `string.Template` >
48-
:let python_highlight_string_templates = 1
49-
< Highlight indentation errors >
50-
:let python_highlight_indent_errors = 1
51-
< Highlight trailing spaces >
52-
:let python_highlight_space_errors = 1
53-
< Highlight doc-tests >
54-
:let python_highlight_doctests = 1
55-
< Highlight `print` statement as function for Python 2 >
56-
:let python_print_as_function = 1
57-
< Highlight shebang and coding headers as comments >
58-
:let python_highlight_file_headers_as_comments = 1
59-
< Enable all the options above. NOTE: This option don't override any
60-
previously set options >
61-
:let python_highlight_all = 1
62-
< Can be set to 0 for slow machines >
63-
:let python_slow_sync = 1
64-
<
65-
vim:tw=78:sw=4:ts=8:ft=help:norl:
33+
-------------------------------------------------------------------------------
34+
Options *python-syntax-options*
35+
36+
`g:python_highlight_builtins`
37+
Highlight builtin functions and objects
38+
`g:python_highlight_builtin_objs`
39+
Highlight builtin objects only
40+
`g:python_highlight_builtin_funcs`
41+
Highlight builtin functions only
42+
`g:python_highlight_exceptions`
43+
Highlight standard exceptions
44+
`g:python_highlight_string_formatting`
45+
Highlight `%` string formatting
46+
`g:python_highlight_string_format`
47+
Highlight syntax of `str.format` syntax
48+
`g:python_highlight_string_templates`
49+
Highlight syntax of `string.Template`
50+
`g:python_highlight_indent_errors`
51+
Highlight indentation errors
52+
`g:python_highlight_space_errors`
53+
Highlight trailing spaces
54+
`g:python_highlight_doctests`
55+
Highlight doc-tests
56+
`g:python_print_as_function`
57+
Highlight `print` statement as function for Python 2
58+
`g:python_highlight_file_headers_as_comments`
59+
Highlight shebang and coding headers as comments
60+
`g:python_highlight_all`
61+
Enable all the options above - NOTE: Doesn't override any previously set options
62+
`g:python_slow_sync`
63+
Disable for slow machines

0 commit comments

Comments
 (0)