diff options
| author | crupest <crupest@outlook.com> | 2024-11-01 14:49:52 +0800 | 
|---|---|---|
| committer | crupest <crupest@outlook.com> | 2024-11-01 14:49:52 +0800 | 
| commit | 351fd8aa192b348d112cc12a36a7ba19e20d28aa (patch) | |
| tree | a0bb6477fb9068fd46aeb1a9ba0bb82e1d2b8224 | |
| parent | 450b5347e75bf759a5588522bd7ff4e8a7e3d664 (diff) | |
| download | crupest-351fd8aa192b348d112cc12a36a7ba19e20d28aa.tar.gz crupest-351fd8aa192b348d112cc12a36a7ba19e20d28aa.tar.bz2 crupest-351fd8aa192b348d112cc12a36a7ba19e20d28aa.zip  | |
feat(nvim): add support of my nvim to neovide-listen on Windows.
| -rw-r--r-- | tools/scripts/neovide-listen.ps1 | 69 | 
1 files changed, 38 insertions, 31 deletions
diff --git a/tools/scripts/neovide-listen.ps1 b/tools/scripts/neovide-listen.ps1 index 5ab006c..e84f3a2 100644 --- a/tools/scripts/neovide-listen.ps1 +++ b/tools/scripts/neovide-listen.ps1 @@ -1,31 +1,38 @@ -$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
 +$env:NVIM_LISTEN_ADDRESS ??= "\\.\pipe\nvimsocket" + +$neovide_args = @() + +$MY_NEOVIM_PATH="$HOME/codes/neovim/build/bin/nvim.exe" +if (Get-Item $MY_NEOVIM_PATH -ErrorAction Ignore) { +    Write-Output "Found my neovim at $MY_NEOVIM_PATH." +    $env:VIMRUNTIME="$HOME/codes/neovim/runtime" +    $neovide_args += "--neovim-bin", "$MY_NEOVIM_PATH" +} + +$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  | 
