Skip to content

Commit 9391eff

Browse files
authored
docs: avoid deprecated $NVIM_LISTEN_ADDRESS env var #575
close #574
1 parent 9fc77f0 commit 9391eff

File tree

3 files changed

+20
-19
lines changed

3 files changed

+20
-19
lines changed

README.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,22 @@ documentation.
7272
### Usage from the Python REPL
7373

7474
A number of different transports are supported, but the simplest way to get
75-
started is with the python REPL. First, start Nvim with a known address (or use
76-
the `$NVIM_LISTEN_ADDRESS` of a running instance):
75+
started is with the python REPL. First, start Nvim with a known address:
7776

7877
```sh
79-
$ NVIM_LISTEN_ADDRESS=/tmp/nvim nvim
78+
$ nvim --listen /tmp/nvim.sock
8079
```
8180

81+
Or alternatively, note the `v:servername` address of a running Nvim instance.
82+
8283
In another terminal, connect a python REPL to Nvim (note that the API is similar
8384
to the one exposed by the [python-vim
8485
bridge](http://vimdoc.sourceforge.net/htmldoc/if_pyth.html#python-vim)):
8586

8687
```python
8788
>>> import pynvim
88-
# Create a python API session attached to unix domain socket created above:
89-
>>> nvim = pynvim.attach('socket', path='/tmp/nvim')
89+
# Create a session attached to Nvim's address (`v:servername`).
90+
>>> nvim = pynvim.attach('socket', path='/tmp/nvim.sock')
9091
# Now do some work.
9192
>>> buffer = nvim.current.buffer # Get the current buffer
9293
>>> buffer[0] = 'replace first line'

docs/development.rst

+13-13
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@ If you change the code, you need to run::
77

88
for the changes to have effect.
99

10-
Alternatively you could execute Neovim with the ``$PYTHONPATH`` environment variable::
10+
Alternatively you could execute Nvim with the ``$PYTHONPATH`` environment variable::
1111

1212
PYTHONPATH=/path/to/pynvim nvim
1313

1414
But note this is not completely reliable,
1515
as installed packages can appear before ``$PYTHONPATH`` in the python search path.
1616

1717
You need to rerun this command if you have changed the code,
18-
in order for Neovim to use it for the plugin host.
18+
in order for Nvim to use it for the plugin host.
1919

2020
To run the tests execute::
2121

2222
python -m pytest
2323

24-
This will run the tests in an embedded instance of Neovim, with the current
24+
This will run the tests in an embedded instance of Nvim, with the current
2525
directory added to ``sys.path``.
2626

2727
If you want to test a different version than ``nvim`` in ``$PATH`` use::
@@ -30,11 +30,11 @@ If you want to test a different version than ``nvim`` in ``$PATH`` use::
3030

3131
Alternatively, if you want to see the state of nvim, you could use::
3232

33-
export NVIM_LISTEN_ADDRESS=/tmp/nvimtest
34-
xterm -e "nvim -u NONE"&
33+
export NVIM=/tmp/nvimtest
34+
xterm -e "nvim --listen $NVIM -u NONE" &
3535
python -m pytest
3636

37-
But note you need to restart Neovim every time you run the tests!
37+
But note you need to restart Nvim every time you run the tests!
3838
Substitute your favorite terminal emulator for ``xterm``.
3939

4040
Contributing
@@ -58,7 +58,7 @@ If you have `tox`_, you can test with multiple python versions locally:
5858
Troubleshooting
5959
---------------
6060

61-
You can run the plugin host in Neovim with logging enabled to debug errors::
61+
You can run the plugin host in Nvim with logging enabled to debug errors::
6262

6363
NVIM_PYTHON_LOG_FILE=logfile NVIM_PYTHON_LOG_LEVEL=DEBUG nvim
6464

@@ -75,18 +75,18 @@ Usage through the Python REPL
7575

7676
A number of different transports are supported,
7777
but the simplest way to get started is with the python REPL.
78-
First, start Neovim with a known address (or use the ``$NVIM_LISTEN_ADDRESS`` of a running instance)::
78+
First, start Nvim with a known address (or use the ``v:servername`` of a running instance)::
7979

80-
NVIM_LISTEN_ADDRESS=/tmp/nvim nvim
80+
nvim --listen /tmp/nvim.sock
8181

8282
In another terminal,
83-
connect a python REPL to Neovim (note that the API is similar to the one exposed by the `python-vim bridge`_):
83+
connect a python REPL to Nvim (note that the API is similar to the one exposed by the `python-vim bridge`_):
8484

8585
.. code-block:: python
8686
8787
>>> from pynvim import attach
88-
# Create a python API session attached to unix domain socket created above:
89-
>>> nvim = attach('socket', path='/tmp/nvim')
88+
# Create a session attached to Nvim's address (`v:servername`).
89+
>>> nvim = attach('socket', path='/tmp/nvim.sock')
9090
# Now do some work.
9191
>>> buffer = nvim.current.buffer # Get the current buffer
9292
>>> buffer[0] = 'replace first line'
@@ -99,7 +99,7 @@ connect a python REPL to Neovim (note that the API is similar to the one exposed
9999
100100
.. _`python-vim bridge`: http://vimdoc.sourceforge.net/htmldoc/if_pyth.html#python-vim
101101

102-
You can embed Neovim into your python application instead of binding to a running neovim instance:
102+
You can embed Nvim into your python application instead of binding to a running neovim instance:
103103

104104
.. code-block:: python
105105

test/conftest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def vim() -> Generator[pynvim.Nvim, None, None]:
1919
editor: pynvim.Nvim
2020

2121
child_argv = os.environ.get('NVIM_CHILD_ARGV')
22-
listen_address = os.environ.get('NVIM_LISTEN_ADDRESS')
22+
listen_address = os.environ.get('NVIM')
2323
if child_argv is None and listen_address is None:
2424
child_argv = json.dumps([
2525
"nvim",

0 commit comments

Comments
 (0)