Doc: $NVIM_LISTEN_ADDRESS is obsolete in nvim

The server should be started with `nvim --listen /tmp/nvimsocket` or just `nvr`.

When used as client, nvr still supports $NVIM_LISTEN_ADDRESS for backward
compatibility.
pull/179/head
Marco Hinz 2 years ago
parent 39e380dec9
commit 842a22a479
No known key found for this signature in database

@ -31,12 +31,12 @@ If you encounter any issues, e.g. permission denied errors or you can't find the
## Theory
Nvim always starts a server. Get its address via `:echo $NVIM_LISTEN_ADDRESS` or
`:echo v:servername`. Or specify an address at startup:
`NVIM_LISTEN_ADDRESS=/tmp/nvimsocket nvim`.
**Nvim** always starts a server. Get its address with `:echo v:servername`. Or
specify an address at startup: `nvim --listen /tmp/nvimsocket`.
**nvr** will use `$NVIM_LISTEN_ADDRESS` or any address given to it via
`--servername`.
**nvr** (the client) will use any address given to it via `--servername`,
`$NVIM_LISTEN_ADDRESS` (obsolete in nvim but still supported in nvr), or
defaults to `/tmp/nvimsocket`.
If the targeted address does not exist, **nvr** starts a new process by running
"nvim". You can change the command by setting `$NVR_CMD`. _(This requires
@ -46,7 +46,7 @@ forking, so it won't work on Windows.)_
Start a nvim process (which acts as a server) in one shell:
NVIM_LISTEN_ADDRESS=/tmp/nvimsocket nvim
nvim --listen /tmp/nvimsocket
And do this in another shell:
@ -155,18 +155,19 @@ Happy hacking!
Easy-peasy! Just `nvr file`.
This works without any prior setup, because `$NVIM_LISTEN_ADDRESS` is always
set within Nvim. And `nvr` will default to that address.
This works without any prior setup, because `$NVIM` is always set for all
children of the nvim process, including `:terminal`, and `nvr` will default
to that address.
I often work with two windows next to each other. If one contains the
terminal, I can use `nvr -l foo` to open the file in the other window.
- **Open files always in the same nvim process no matter which terminal you're in.**
If you just run `nvr -s`, a new nvim process will start and set its address
to `/tmp/nvimsocket` automatically.
Just `nvr -s` starts a new nvim process with the server address set to
`/tmp/nvimsocket`.
Now, no matter in which terminal you are, `nvr file` will always work on
Now, no matter which terminal you are in, `nvr file` will always work on
that nvim process. That is akin to `emacsclient` from Emacs.
- **Use nvr in plugins.**

@ -309,36 +309,40 @@ def parse_args(argv):
def show_message(address):
print(textwrap.dedent('''
[!] Can't connect to: {}
print(textwrap.dedent(f'''
[!] Can't connect to: {address}
The server (nvim) and client (nvr) have to use the same address.
Server:
Expose $NVIM_LISTEN_ADDRESS to the environment before
starting nvim:
Specify the server address when starting nvim:
$ NVIM_LISTEN_ADDRESS={} nvim
$ nvim --listen {address}
Use `:echo v:servername` to verify the address.
Security: When using Unix domain sockets on a multi-user system,
the socket should have proper permissions so that it is only
accessible by your user.
Alternatively, run nvr without arguments. It defaults to
starting a new nvim process with the server name set to
"/tmp/nvimsocket".
Security: When using an Unix domain socket, that socket should
have proper permissions so that it is only accessible by your
user.
Client:
Expose $NVIM_LISTEN_ADDRESS to the environment before
using nvr or use its --servername option. If neither
is given, nvr assumes \"/tmp/nvimsocket\".
Expose $NVIM_LISTEN_ADDRESS (obsolete in nvim but still
supported by nvr) to the environment before using nvr or use
its --servername option. If neither is given, nvr assumes
\"/tmp/nvimsocket\".
$ NVIM_LISTEN_ADDRESS={} nvr file1 file2
$ nvr --servername {} file1 file2
$ NVIM_LISTEN_ADDRESS={address} nvr file1 file2
$ nvr --servername {address} file1 file2
$ nvr --servername 127.0.0.1:6789 file1 file2
Use -s to suppress this message.
'''.format(address, address, address, address)))
'''))
def split_cmds_from_files(args):

Loading…
Cancel
Save