Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support /var/folders/... socket path on MacOS #16

Open
echo-bravo-yahoo opened this issue Jul 12, 2024 · 6 comments
Open

Support /var/folders/... socket path on MacOS #16

echo-bravo-yahoo opened this issue Jul 12, 2024 · 6 comments

Comments

@echo-bravo-yahoo
Copy link

Register syncing to nvim doesn't work. I've:

  • Run zstyle :zle:evil-registers:'[A-Za-z%#]' editor nvim in a shell, then attempted to cut lines ("zdd) to both pre-existing and then newly-created nvim instances.
  • Added zstyle :zle:evil-registers:'[A-Za-z%#]' editor nvim to my .zshrc after zplug load and attempted to use it as above.
  • Disabled NVM lazy load on a hunch that nvim resolving to a lazy load function may have been breaking evil-registers.

None of these allowed me to successfully sync to nvim, and I don't know where to go next for debugging.

OS X, NVIM v0.10.0

@xPMo
Copy link
Member

xPMo commented Jul 12, 2024

  • Check to see if the setup-editor ran correctly.
    • Run zstyle -L ':zle:evil-registers:*'
    • Do you see lines with nvim-put and nvim-yank?
  • Check that the correct server socket is getting selected.
    • Inside Nvim: :echo v:servername
    • Run print -l {$XDG_RUNTIME_DIR,/tmp}/nvim*(N=oN).
    • Is Nvim's server socket the first in the list?
  • Test the server connection.
    • Yank some text into the register z in Nvim.
    • Run nvim --headless --server $socket --remote-expr "getreg('z')".
    • Do you get the text on stdout?

@xPMo xPMo closed this as not planned Won't fix, can't repro, duplicate, stale Aug 5, 2024
@echo-bravo-yahoo
Copy link
Author

echo-bravo-yahoo commented Nov 14, 2024

Hi - sorry for the delay on this!

It looks like nvim isn't being detected at all:

$ zstyle -L ':zle:evil-registers:*'
zstyle ':zle:evil-registers:[A-Za-z%#]' editor nvim
zstyle :zle:evil-registers:/ put -v LASTSEARCH
zstyle :zle:evil-registers:. put -v '__zvm_track_insert[i]'
zstyle ':zle:evil-registers:[*+]' put - pbpaste
zstyle ':zle:evil-registers:[*+]' yank - pbcopy

Additionally, $XDG_RUNTIME_DIR is undefined, and there's no /tmp/nvim* files or directories, so the print command returns nothing. The nvim socket appears to be in var/folders/... instead. I've left the whole path intact below except for the username, which I've replaced with USER.

$ print -l {$XDG_RUNTIME_DIR,/tmp}/nvim*(N=oN)

$ nvim --clean --headless --cmd ":echo v:servername | :exit"
/var/folders/h2/08yv5z0j3qx0rmy3nps6k6jc0000gn/T/nvim.USER/MdzxrF/nvim.96270.0

Unsuprisingly, given this, the last command hangs indefinitely:

$ nvim --headless --server $socket --remote-expr "getreg('z')"
< hangs indefinitely >

@xPMo
Copy link
Member

xPMo commented Nov 16, 2024

/var/folders/h2/08yv5z0j3qx0rmy3nps6k6jc0000gn/T/nvim.USER/MdzxrF/nvim.96270.0

Okay then, thanks! I'm not a Mac user, so I might need some help on figuring out how we can reliably fetch that exact path to the socket. How is neovim installed for you?

@xPMo xPMo reopened this Nov 16, 2024
@xPMo xPMo changed the title How does nvim sync work? How can I debug it? Support /var/folders/... socket path on MacOS Nov 16, 2024
@xPMo
Copy link
Member

xPMo commented Nov 16, 2024

Some sleuthing led me to neovim/neovim#20865, where this folder can probably be found via

nvim --clean --headless --cmd ':echo tempname() | :exit'

Could you also check nvim --headless --cmd ':echo stdpath('run') | :exit'? I'm going to guess that it's either empty or the same as tempname() for you, since you don't have XDG_RUNTIME_DIR set.

Finally, what does echo =nvim(:A) (in Zsh) give you?

@echo-bravo-yahoo
Copy link
Author

nvim is installed via homebrew.

# both stdpath and tempname return the same directory that only exists while the nvim process is running (but tempname appends `/0`).
$ nvim --clean --headless --cmd ':echo stdpath("run") | echo tempname() | :exit'
/var/folders/h2/08yv5z0j3qx0rmy3nps6k6jc0000gn/T/nvim.USER/egAknC
/var/folders/h2/08yv5z0j3qx0rmy3nps6k6jc0000gn/T/nvim.USER/egAknC/0

# this is the path to the binary, but i don't see anything else relevant in `/opt/homebrew/Cellar/neovim/VERSION/` 
$ echo =nvim(:A)
/opt/homebrew/Cellar/neovim/0.10.2_1/bin/nvim

it looks like OSX sets $TMPDIR, and the nvim path might be buildable from that:

$ echo $TMPDIR
/var/folders/h2/08yv5z0j3qx0rmy3nps6k6jc0000gn/T/

@xPMo
Copy link
Member

xPMo commented Nov 25, 2024

Is that a literal nvim.USER, or is it nvim.$USER? I have an /tmp/nvim.pmo/ directory which holds some nvim data.

In any case, I committed a first attempt which just matches $TMPDIR/nvim.*/*/nvim*(=), checkout dev to see if it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants