mhinz / neovim-remote

:ok_hand: Support for --remote and friends.
MIT License
1.76k stars 82 forks source link

nvr does no take NVIM_LISTEN_ADDRESS into account #152

Closed jarkkojs closed 2 years ago

jarkkojs commented 4 years ago

I've ended up for the sake of robustness to do

function nvr-connect {
  export socket=`find /tmp -maxdepth 1 -name "nvim*" | head -1`

  if [ -z "$socket" ]; then
    echo "NeoVim is not running."
  else
    export NVIM_LISTEN_ADDRESS=$socket
  fi
}

I like this over the global name because this will always work even if NeoVim was started with a variable socket name.

But when I use as below, nvr does not respect the environment variable:

~ master
❯ nvr-connect 

~ master
❯ echo $NVIM_LISTEN_ADDRESS
/tmp/nvimIaEski

I.e. it creates a new NeoVim instance instead of opening the file in $NVIM_LISTEN_ADDRESS pointed NeoVim.

ysolis commented 4 years ago

$NVIM_LISTEN_ADDRESS is deprecated in NeoVim

https://neovim.io/doc/user/deprecated.html

image

seb-mueller commented 3 years ago

Could that be updated in the Readme, since I had the same issues and spend quite a lot of time to get nvr working in neovim. Also, even armed with that knowledge, it still can't get it to work in neovim, i.e.: nvim --listen /tmp/nvimsocket followed by :echo v:servername gives me a temp file instead of nvimsocket (e.g. /tmp/nvimgLlrnE/0

muratangin187 commented 3 years ago

Is there any solution?

kylo252 commented 3 years ago

Edit: neovim will open a socket by detfault when it starts, which you can query by using nvr --serverlist and then connect to it with nvr --servername </tmp/nvimXXXXX> file1.txt. Alternatively you can follow what I originally suggested about using TCP, but be mindful of the security implications.


It seems to work fine if you just start neovim with nvim --listen localhost then you can use nvr --servername localhost file1.txt.

nyngwang commented 2 years ago

Could that be updated in the Readme, since I had the same issues and spend quite a lot of time to get nvr working in neovim. Also, even armed with that knowledge, it still can't get it to work in neovim, i.e.: nvim --listen /tmp/nvimsocket followed by :echo v:servername gives me a temp file instead of nvimsocket (e.g. /tmp/nvimgLlrnE/0

The same here!

mhinz commented 2 years ago

As of nvim 0.7, nvim --listen foo should be preferred over setting $NVIM_LISTEN_ADDRESS before starting nvim. The latter still works, but is considered obsolete.

Since people use it in scripts, nvr will continue supporting $NVIM_LISTEN_ADDRESS.

I'll update the README and the message given for nvr --nostart accordingly.