Vimr: Support --servername features

Created on 21 Oct 2017  路  4Comments  路  Source: qvacua/vimr

I just tried out VimR for the first time after setting up NeoVim.app, getting to know where it's at, then sadly discovering that the project hasn't seen a commit in almost a year. VimR looks great, but there's one crucial feature for my workflow that I managed to get working with NeoVim.app but doesn't currently look possible with VimR, namely the ability to specify the --servername option for nvim.

NeoVim itself doesn't fully support --servername, but the neovim-remote project gets around this. For NeoVim.app, I got it working by setting the NVIM_LISTEN_ADDRESS before starting with gnvim, and then I was able to send commands with nvr.

I'm not sure how VimR starts nvim internally, but if it could allow me to specify environment variables that should be set for it, the equivalent to this on the command line:

NVIM_LISTEN_ADDRESS=/tmp/nvimsocket nvim

That would probably be sufficient to get this working, and may also support other use cases.

Most helpful comment

Sorry to reopen this, but it looks like IT IS possible to control VimR through nvr. In fact, VimR opens a socket that nvr can actually use:

https://github.com/qvacua/vimr/blob/develop/NvimView/NvimView/UiBridge.swift#L285-L290

For example, if at startup vimr creates:

/var/folders/sp/m67fjs5j65l0mx687p_kqs040000gn/T/vimr_BADAA70E-9CA4-49A9-BF14-A1E7DA0039D3.sock

You can control that instance with, e.g.,

nvr --servername /var/folders/sp/m67fjs5j65l0mx687p_kqs040000gn/T/vimr_BADAA70E-9CA4-49A9-BF14-A1E7DA0039D3.sock --remote-send 'iabc<cr><esc>

Unfortunately, its name has a UUID generated at runtime so it is very cumbersome to use it. Maybe a way to override this name at the command line could be introduced?

All 4 comments

VimR integrates neovim as a static C library and therefore it's not possible to use other nvim process as its backend. Maybe you can try https://github.com/equalsraf/neovim-qt?

@qvacua Thanks, that answer makes sense. Alternatively, is there any plan to eventually support external scriptability for VimR itself?

The natural choice from macOS perspective would be AppleScript, but there's no plan yet...

Sorry to reopen this, but it looks like IT IS possible to control VimR through nvr. In fact, VimR opens a socket that nvr can actually use:

https://github.com/qvacua/vimr/blob/develop/NvimView/NvimView/UiBridge.swift#L285-L290

For example, if at startup vimr creates:

/var/folders/sp/m67fjs5j65l0mx687p_kqs040000gn/T/vimr_BADAA70E-9CA4-49A9-BF14-A1E7DA0039D3.sock

You can control that instance with, e.g.,

nvr --servername /var/folders/sp/m67fjs5j65l0mx687p_kqs040000gn/T/vimr_BADAA70E-9CA4-49A9-BF14-A1E7DA0039D3.sock --remote-send 'iabc<cr><esc>

Unfortunately, its name has a UUID generated at runtime so it is very cumbersome to use it. Maybe a way to override this name at the command line could be introduced?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hakamadare picture hakamadare  路  4Comments

crisidev picture crisidev  路  7Comments

hobbes3 picture hobbes3  路  4Comments

risentveber picture risentveber  路  4Comments

numbcoder picture numbcoder  路  3Comments