aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2024-10-23 23:32:32 +0800
committercrupest <crupest@outlook.com>2024-10-26 16:29:56 +0800
commitcbc08bcd0e60faf8452763594d22d4fc57cc5b80 (patch)
tree111ed370d618896a28e2fb01bf7d274ebd396a71 /tools
parenta6426ffac0fcbfd65e4f3194b1cf9123f7e0b163 (diff)
downloadcrupest-cbc08bcd0e60faf8452763594d22d4fc57cc5b80.tar.gz
crupest-cbc08bcd0e60faf8452763594d22d4fc57cc5b80.tar.bz2
crupest-cbc08bcd0e60faf8452763594d22d4fc57cc5b80.zip
feat(nvim): add neovide-listen.ps1 for Windows.
Diffstat (limited to 'tools')
-rw-r--r--tools/scripts/neovide-listen.ps131
1 files changed, 31 insertions, 0 deletions
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