@@ -8,6 +8,7 @@ Set-StrictMode -Version 3.0
8
8
$ErrorActionPreference = " Stop" # Exit when command fails
9
9
10
10
# global-scope vars
11
+ $REQUIRED_NVIM_VERSION_NIGHTLY = [version ]' 0.10'
11
12
$REQUIRED_NVIM_VERSION = [version ]' 0.9.0'
12
13
$REQUIRED_NVIM_VERSION_LEGACY = [version ]' 0.8.0'
13
14
$USE_SSH = $True
@@ -20,7 +21,9 @@ $installer_pkg_matrix = @{ "NodeJS" = "npm"; "Python" = "pip"; "Ruby" = "gem" }
20
21
# env vars
21
22
$env: XDG_CONFIG_HOME ?? = $env: LOCALAPPDATA
22
23
$env: CCPACK_MGR ?? = ' unknown'
24
+ $env: CCLONE_BRANCH_NIGHTLY ?? = ' 0.10'
23
25
$env: CCLONE_BRANCH ?? = ' main'
26
+ $env: CCLONE_BRANCH_LEGACY ?? = ' 0.8'
24
27
$env: CCLONE_ATTR ?? = ' undef'
25
28
$env: CCDEST_DIR ?? = " $env: XDG_CONFIG_HOME \nvim"
26
29
$env: CCBACKUP_DIR = " $env: CCDEST_DIR " + " _backup-" + (Get-Date ).ToUniversalTime().ToString(" yyyyMMddTHHmmss" )
@@ -282,6 +285,25 @@ function check_nvim_version ([Parameter(Mandatory = $True)][ValidateNotNullOrEmp
282
285
return ($nvim_version -ge $RequiredVersionMin )
283
286
}
284
287
288
+ function clone_by_https_or_ssh ([Parameter (Mandatory = $True )][ValidateNotNullOrEmpty ()] [string ]$CloneUrl ) {
289
+ if ((check_nvim_version - RequiredVersionMin $REQUIRED_NVIM_VERSION_NIGHTLY )) {
290
+ safe_execute - WithCmd { git clone -- progress - b " $env: CCLONE_BRANCH_NIGHTLY " " $env: CCLONE_ATTR " $CloneUrl " $env: CCDEST_DIR " }
291
+ } elseif ((check_nvim_version - RequiredVersionMin $REQUIRED_NVIM_VERSION )) {
292
+ safe_execute - WithCmd { git clone -- progress - b " $env: CCLONE_BRANCH " " $env: CCLONE_ATTR " $CloneUrl " $env: CCDEST_DIR " }
293
+ } elseif ((check_nvim_version - RequiredVersionMin $REQUIRED_NVIM_VERSION_LEGACY )) {
294
+ warn - Msg " You have outdated Nvim installed (< $REQUIRED_NVIM_VERSION )."
295
+ info - Msg " Automatically redirecting you to the latest compatible version..."
296
+ safe_execute - WithCmd { git clone -- progress - b " $env: CCLONE_BRANCH_LEGACY " " $env: CCLONE_ATTR " $CloneUrl " $env: CCDEST_DIR " }
297
+ } else {
298
+ warn - Msg " You have outdated Nvim installed (< $REQUIRED_NVIM_VERSION_LEGACY )."
299
+ _abort - Msg " This Neovim distribution is no longer supported." - Type " NotImplemented" - Info_msg @"
300
+ You have a legacy Neovim distribution installed.
301
+ Please make sure you have nvim v$REQUIRED_NVIM_VERSION_LEGACY installed at the very least.
302
+
303
+ "@
304
+ }
305
+ }
306
+
285
307
function ring_bell {
286
308
[System.Console ]::beep()
287
309
}
@@ -353,35 +375,9 @@ You must install Git before installing this Nvim config. See:
353
375
info - Msg " Fetching in progress..."
354
376
355
377
if ($USE_SSH ) {
356
- if ((check_nvim_version - RequiredVersionMin $REQUIRED_NVIM_VERSION )) {
357
- safe_execute
- WithCmd { git clone
-- progress
- b
" $env: CCLONE_BRANCH " " $env: CCLONE_ATTR " ' [email protected] :ayamir/nvimdots.git' " $env: CCDEST_DIR " }
358
- } elseif ((check_nvim_version - RequiredVersionMin $REQUIRED_NVIM_VERSION_LEGACY )) {
359
- warn - Msg " You have outdated Nvim installed (< $REQUIRED_NVIM_VERSION )."
360
- info - Msg " Automatically redirecting you to the latest compatible version..."
361
- safe_execute
- WithCmd { git clone
-- progress
- b
0.8 " $env: CCLONE_ATTR " ' [email protected] :ayamir/nvimdots.git' " $env: CCDEST_DIR " }
362
- } else {
363
- warn - Msg " You have outdated Nvim installed (< $REQUIRED_NVIM_VERSION_LEGACY )."
364
- _abort - Msg " This Neovim distribution is no longer supported." - Type " NotImplemented" - Info_msg @"
365
- You have a legacy Neovim distribution installed.
366
- Please make sure you have nvim v$REQUIRED_NVIM_VERSION_LEGACY installed at the very least.
367
-
368
- "@
369
- }
378
+ clone_by_https_or_ssh
' [email protected] :ayamir/nvimdots.git'
370
379
} else {
371
- if ((check_nvim_version - RequiredVersionMin $REQUIRED_NVIM_VERSION )) {
372
- safe_execute - WithCmd { git clone -- progress - b " $env: CCLONE_BRANCH " " $env: CCLONE_ATTR " ' https://github.com/ayamir/nvimdots.git' " $env: CCDEST_DIR " }
373
- } elseif ((check_nvim_version - RequiredVersionMin $REQUIRED_NVIM_VERSION_LEGACY )) {
374
- warn - Msg " You have outdated Nvim installed (< $REQUIRED_NVIM_VERSION )."
375
- info - Msg " Automatically redirecting you to the latest compatible version..."
376
- safe_execute - WithCmd { git clone -- progress - b 0.8 " $env: CCLONE_ATTR " ' https://github.com/ayamir/nvimdots.git' " $env: CCDEST_DIR " }
377
- } else {
378
- warn - Msg " You have outdated Nvim installed (< $REQUIRED_NVIM_VERSION_LEGACY )."
379
- _abort - Msg " This Neovim distribution is no longer supported." - Type " NotImplemented" - Info_msg @"
380
- You have a legacy Neovim distribution installed.
381
- Please make sure you have nvim v$REQUIRED_NVIM_VERSION_LEGACY installed at the very least.
382
-
383
- "@
384
- }
380
+ clone_by_https_or_ssh ' https://github.com/ayamir/nvimdots.git'
385
381
}
386
382
387
383
safe_execute - WithCmd { Set-Location - Path " $env: CCDEST_DIR " }
0 commit comments