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 | 2c4c1f8559b6371a65ad04c93dfad9d1929432a9 (patch) | |
| tree | a0bb6477fb9068fd46aeb1a9ba0bb82e1d2b8224 | |
| parent | 5d850fb1b2b4568f6403d950dbfe341886189c2b (diff) | |
| download | crupest-2c4c1f8559b6371a65ad04c93dfad9d1929432a9.tar.gz crupest-2c4c1f8559b6371a65ad04c93dfad9d1929432a9.tar.bz2 crupest-2c4c1f8559b6371a65ad04c93dfad9d1929432a9.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 | 
