vimr icon indicating copy to clipboard operation
vimr copied to clipboard

[FEAT] Provide a GUI or file to configure environment-variables for the spawned neovim process

Open ELLIOTTCABLE opened this issue 4 years ago • 4 comments

In particular, I don't launch VimR from an existing terminal, so vimr --cur-env is useless to me — I'm a "terminal inside VimR", not "VimR from a terminal" kinda user!

I'd like to use nvr, from neovim-remote, as my $GIT_EDITOR and the like. I've configured my $NVIM_LISTEN_ADDRESS to /tmp/nvimsocket using shell configuration files; and that works fine, of course … if I launch VimR from a terminal:

  1. Open a macOS Terminal.app
  2. Use vimr --cur-env, so VimR's neovim inherits the shell $NVIM_LISTEN_ADDRESS
  3. Open another :terminal inside VimR itself
  4. Proceed normally with Git operations and suchlike, with nvr instructing VimR to open windows/buffers/etc as appropriate.
  5. nvr talks to VimR's embedded Neovim over /tmp/nvimsocket; all works fine!

However, in a more normal form of usage,

  1. Open VimR from the Finder
  2. Open :terminal inside VimR itself
  3. Proceed normally with Git operations and suchlike, with nvr instructing VimR to open windows/buffers/etc as appropriate.
  4. nvr tries to communicate to /tmp/nvimsocket; but VimR's neovim is listening on something random like:
    /var/folders/qx/mxf_tg093sn9xzthq9p9trfm0000gn/T/vimr_9F9C9D7A-71EA-4414-94DB-D8677C1C6E06.sock
    
    ... so nothing happens.

This is, however, just a specific case of the "we don't have control over the integrated neovim instance" issue. I really do think that the ideal solution to this is to simple make it configurable.

This isn't the first time this sort of issue has cropped up; and plenty of other GUI editors that invoke tools and similar offer options like this. I really hope you'll consider such a feature worth your time!

ELLIOTTCABLE avatar Sep 01 '21 18:09 ELLIOTTCABLE

If you just need it inside the embedded neovim terminal, maybe you could try to set the correct servername in your configuration ?

let $NVIM_LISTEN_ADDRESS=v:servername

Andilutten avatar Sep 02 '21 06:09 Andilutten

Unfortunately, that's the inverse — I need to configure the embedded neovim itself, not the terminal.

Edit: Oh, I mis-understood you — you mean configuring the embedded terminal, so launched-inside-VimR applications work as expected.

That's actually a really helpful tip, although it doesn't solve the underlying problem — with that solution, for instance, if I open a external Terminal.app window after launching VimR from the GUI, it won't be able to control my VimR instance.

For anybody else coming across this, the actual line @Andilutten suggested ended up being unnecessary — I'd hardcoded the envvar in my .profile, and thus it was getting overwritten on :terminal-start; all I had to do to at least get nvr instances inside VimR to start working was the following:

+|if [ -z "$NVIM_LISTEN_ADDRESS" ]; then
 |   export NVIM_LISTEN_ADDRESS="/tmp/nvimsocket"
+|fi

ELLIOTTCABLE avatar Sep 03 '21 00:09 ELLIOTTCABLE

I asked for something similar (to configure the socket) here: https://github.com/qvacua/vimr/issues/797

smackesey avatar May 05 '22 16:05 smackesey

This would be excellent, as currently with certain neovim configs, you need to set env variables for core functionality. E.g. I'm attempting to run Python code for the minted LaTeX package in SpaceVim, but SpaceVim requires an environment variable to be set to have Python functionality.

Sandybunting avatar Jun 23 '22 17:06 Sandybunting