From f66dfcc24f181cd702258a8847ff85544f5da589 Mon Sep 17 00:00:00 2001 From: crupest Date: Wed, 23 Oct 2024 23:32:32 +0800 Subject: feat(nvim): add neovide-listen.ps1 for Windows. --- tools/scripts/neovide-listen.ps1 | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tools/scripts/neovide-listen.ps1 (limited to 'tools/scripts') diff --git a/tools/scripts/neovide-listen.ps1 b/tools/scripts/neovide-listen.ps1 new file mode 100644 index 0000000..5ab006c --- /dev/null +++ b/tools/scripts/neovide-listen.ps1 @@ -0,0 +1,31 @@ +$env:NVIM_LISTEN_ADDRESS ??= "\\.\pipe\nvimsocket" + +$neovide_args = @() + +$listen_added = $false +foreach ($arg in $args) { + $neovide_args += $arg + if ( $arg -eq '--') { + $neovide_args += "--listen", $env:NVIM_LISTEN_ADDRESS + $listen_added=$true + } +} + +if (-not $listen_added) { + $neovide_args += "--", "--listen", $env:NVIM_LISTEN_ADDRESS +} + +$neovide_bin = "neovide" +$my_neovide_path = "$HOME/codes/neovide/target/release/neovide.exe" +if (Get-Item $my_neovide_path -ErrorAction Ignore) { + Write-Output "Found my neovide at $my_neovide_path." + $neovide_bin = "$my_neovide_path" +} + +if (Get-Command nvr -ErrorAction Ignore) { + Write-Output "Detected nvr, set git editor env." + $env:GIT_EDITOR = "nvr -cc split --remote-wait" +} + +Write-Output "Command is $($neovide_args -join ' ')." +Start-Process $neovide_bin -ArgumentList $neovide_args -Wait -- cgit v1.2.3