aboutsummaryrefslogtreecommitdiff
path: root/tools/scripts/neovide-listen.ps1
blob: e84f3a21028866055116f054e1e6afdce7b57103 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
$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