Skip to content

Commit f427d0a

Browse files
committed
Merge pull request #182 from mhinz/master
[RFC] README: use tw=80 for text
2 parents f2e55b5 + 0d5b388 commit f427d0a

File tree

1 file changed

+44
-20
lines changed

1 file changed

+44
-20
lines changed

README.md

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,54 @@
44
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/neovim/python-client/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/neovim/python-client/?branch=master)
55
[![Code Coverage](https://scrutinizer-ci.com/g/neovim/python-client/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/neovim/python-client/?branch=master)
66

7-
Implements support for python plugins in Nvim.
8-
Also works as a library for connecting to and scripting Nvim processes through its msgpack-rpc API.
7+
Implements support for python plugins in Nvim. Also works as a library for
8+
connecting to and scripting Nvim processes through its msgpack-rpc API.
99

1010
#### Installation
1111

1212
```sh
1313
pip install neovim
1414
```
1515

16-
You can install the package without being root by adding the `--user` flag. You can use `pip2` and `pip3` to explicitly install for python2 and python3, respectively.
16+
You can install the package without being root by adding the `--user` flag. You
17+
can use `pip2` and `pip3` to explicitly install for python2 and python3,
18+
respectively.
1719

1820
#### Python Plugin API
1921

20-
Neovim has a new mechanism for defining plugins, as well as a number of extensions to the python API. The API extensions are accessible no matter if the traditional `:python` interface or the new mechanism is used, as discussed below.
22+
Neovim has a new mechanism for defining plugins, as well as a number of
23+
extensions to the python API. The API extensions are accessible no matter if the
24+
traditional `:python` interface or the new mechanism is used, as discussed
25+
below.
2126

22-
* `vim.funcs` exposes vimscript functions (both builtin and global user defined functions) as a python namespace. For instance to set the value of the value of a register
27+
* `vim.funcs` exposes vimscript functions (both builtin and global user defined
28+
functions) as a python namespace. For instance to set the value of the value
29+
of a register
2330

2431
`vim.funcs.setreg('0', ["some", "text"], 'l')`
2532

26-
* The API is not thread-safe in general. However, `vim.async_call` allows a spawned thread to schedule code to be executed on the main thread. This method could also be called from `:python` or a synchronous request handler, to defer some execution that shouldn't block nvim.
33+
* The API is not thread-safe in general. However, `vim.async_call` allows a
34+
spawned thread to schedule code to be executed on the main thread. This method
35+
could also be called from `:python` or a synchronous request handler, to defer
36+
some execution that shouldn't block nvim.
2737

2838
`:python vim.async_call(myfunc, args...)`
2939

30-
Note that this code will still block the plugin host if it does long-running computations. Intensive computations should be done in a separate thread (or process), and `vim.async_call` can be used to send results back to nvim.
40+
Note that this code will still block the plugin host if it does long-running
41+
computations. Intensive computations should be done in a separate thread (or
42+
process), and `vim.async_call` can be used to send results back to nvim.
3143

32-
* Some methods accept an extra keyword-only argument `async`: `vim.eval`, `vim.command` as well as the `vim.funcs` wrappers. The python host will not wait for nvim to complete the request, which also means that the return value is unavailable.
44+
* Some methods accept an extra keyword-only argument `async`: `vim.eval`,
45+
`vim.command` as well as the `vim.funcs` wrappers. The python host will not
46+
wait for nvim to complete the request, which also means that the return value
47+
is unavailable.
3348

3449
#### Remote (new-style) plugins
3550

36-
Neovim allows python plugins to be defined by placing python files or packages in `rplugin/python3/` (in a runtimepath folder). These follow the structure of this example:
51+
Neovim allows python plugins to be defined by placing python files or packages
52+
in `rplugin/python3/` (in a runtimepath folder). These follow the structure of
53+
this example:
54+
3755
```python
3856
import neovim
3957

@@ -57,20 +75,24 @@ class TestPlugin(object):
5775
self.nvim.out_write("testplugin is in " + filename + "\n")
5876
```
5977

60-
If `sync=True` is supplied nvim will wait for the handler to finish (this is required for function return values),
61-
but by default handlers are executed asynchronously.
78+
If `sync=True` is supplied nvim will wait for the handler to finish (this is
79+
required for function return values), but by default handlers are executed
80+
asynchronously.
6281

63-
You need to run `:UpdateRemotePlugins` in nvim for changes in the specifications to have effect. For details see `:help remote-plugin` in nvim.
82+
You need to run `:UpdateRemotePlugins` in nvim for changes in the specifications
83+
to have effect. For details see `:help remote-plugin` in nvim.
6484

6585
#### Development
6686

67-
Install the master version by cloning this repository and in the root folder execute
87+
Install the master version by cloning this repository and in the root directory
88+
execute
6889

6990
```sh
7091
pip install .
7192
```
7293

73-
You need to rerun this command if you have changed the code, in order for nvim to use it for the plugin host.
94+
You need to rerun this command if you have changed the code, in order for nvim
95+
to use it for the plugin host.
7496

7597
To run the tests execute
7698

@@ -86,20 +108,21 @@ xterm -e "nvim -u NONE"&
86108
nosetests
87109
```
88110

89-
But note you need to restart nvim every time you run the tests! Substitute your favorite terminal emulator for `xterm`.
111+
But note you need to restart nvim every time you run the tests! Substitute your
112+
favorite terminal emulator for `xterm`.
90113

91114
#### Usage through the python REPL
92115

93116
A number of different transports are supported, but the simplest way to get
94-
started is with the python REPL. First, start Nvim with a known address (or
95-
use the `$NVIM_LISTEN_ADDRESS` of a running instance):
117+
started is with the python REPL. First, start Nvim with a known address (or use
118+
the `$NVIM_LISTEN_ADDRESS` of a running instance):
96119

97120
```sh
98121
$ NVIM_LISTEN_ADDRESS=/tmp/nvim nvim
99122
```
100123

101-
In another terminal, connect a python REPL to Nvim (note that the API is
102-
similar to the one exposed by the [python-vim
124+
In another terminal, connect a python REPL to Nvim (note that the API is similar
125+
to the one exposed by the [python-vim
103126
bridge](http://vimdoc.sourceforge.net/htmldoc/if_pyth.html#python-vim)):
104127

105128
```python
@@ -117,7 +140,8 @@ bridge](http://vimdoc.sourceforge.net/htmldoc/if_pyth.html#python-vim)):
117140
[1, 2, 3]
118141
```
119142

120-
You can embed neovim into your python application instead of binding to a running neovim instance.
143+
You can embed neovim into your python application instead of binding to a
144+
running neovim instance.
121145

122146
```python
123147
>>> from neovim import attach

0 commit comments

Comments
 (0)