neovim-remote
neovim-remote copied to clipboard
doc: --listen on Windows
Hello, thank you for this very useful package.
I think it can be useful to add some help for Windows so I share this.
--listen
want a named pipe and on Windows named pipe is on a special directory \\.\pipe\
so if you try --listen
with $env:TEMP\<...>
, it will not work, only \\.\pipe\<...>
.
Exemple (type $profile
on pwsh
to get the path of your profile file):
$env:NVIM_LISTEN_ADDRESS = "\\.\pipe\nvim-nvr"
function nvr { &(Get-Command nvr -CommandType Application) -s --nostart $args; if ($LastExitCode -ne 0) { nvd; if ($args) { &(Get-Command nvr -CommandType Application) -s --nostart $args } } }
function nvd { neovide -S "$env:LocalAppData\nvim-data\current.session" --listen "$env:NVIM_LISTEN_ADDRESS" }
Next, just use nvr
and everything is good.
PS: Replace neovide
with nvim
and remove the -S
option if you don't need it ^^.
EDIT: Update the nvr
function to fix the crash after a git commit
if Neovim is not started.
For use Git with nvr
as editor on Powershell terminal, you have two solutions:
-
git config --global core.editor "pwsh -Command nvr -cc split --remote-wait"
Works but a little slowly because pwsh
must be loaded with its profile.
-
git config --global core.editor "nvr.py -cc split --remote-wait"
Better because faster! But need a python3
executable in the path. If Python is installed with Chocolatey (choco install python
), you haven't a python3
shims, so generate it with sudo $env:ProgramData\chocolatey\tools\shimgen.exe --output="$env:ChocolateyInstall\bin\python3.exe" --path="$($(Get-Command python).Source)"
PS: sudo
on Windows: scoop install sudo
scoop
: https://github.com/lukesampson/scoop
PS2: If you are using neovide
and airblade/vim-rooter
, add let g:rooter_silent_chdir = 1
in your config file if you don't want the opening of the .git/COMMIT_EDITMSG
file to be blocked by the directory change notification ^^.
Is it possible to change the python script itself to get the address from \\.\pipe\
instead of /tmp/nvimsocket
?
As it stands, without any changes to the original script it works half the time, since it uses a fixed address that might not be available. Your changes do work, but they are sort of a workaround.
Yes it is a workaround. I think you have to test it because I can't help you anymore, I gave up Windows to switch to Linux full time, even for video games ^^