-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.cmd
103 lines (88 loc) · 3.16 KB
/
install.cmd
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
@echo off
setlocal ENABLEDELAYEDEXPANSION
set DEST=%USERPROFILE%
set arg_count=0
set VERBOSE=N
set TEST=N
set OVERRIDE=N
:LOOP_ARG
if "%~1"=="" GOTO PROG
if /i "%~1"=="/v" SET VERBOSE=Y
if /i "%~1"=="/verbose" SET VERBOSE=Y
if /i "%~1"=="--verbose" SET VERBOSE=Y
if /i "%~1"=="-v" SET VERBOSE=Y
if /i "%~1"=="/t" SET TEST=Y
if /i "%~1"=="/test" SET TEST=Y
if /i "%~1"=="--test" SET TEST=Y
if /i "%~1"=="-t" SET TEST=Y
if /i "%~1"=="/o" SET OVERRIDE=Y
if /i "%~1"=="/override" SET OVERRIDE=Y
if /i "%~1"=="--override" SET OVERRIDE=Y
if /i "%~1"=="-o" SET OVERRIDE=Y
shift & GOTO LOOP_ARG
:PROG
if !VERBOSE!==Y echo Verbose!
if !TEST!==Y echo Test mode!
if !OVERRIDE!==Y echo Override!
GOTO RUN_LOOP
:LINK_FILE
SETLOCAL
set _source="%~1"
set _dest="%~2"
:: 3rd param /d - indicates directory
set _dir=%3
if exist %_dest% (
if !OVERRIDE!==Y (
if !VERBOSE!==Y echo %_dest% already exists. Removing to relink.
if exist %~2%\* (
if !VERBOSE!==Y echo rmdir /s /q %~2%
if !TEST!==N rmdir /s /q %~2%
) else (
if !VERBOSE!==Y echo del /f /q %_dest%
if !TEST!==N del /f /q %_dest%
)
)
)
if !VERBOSE!==Y echo mklink %_dir% %_dest% %_source%
if !TEST!==N mklink %_dir% %_dest% %_source%
ENDLOCAL & GOTO :EOF
::: =================================================================
::: Configure applications here
::: =================================================================
:VIM
call :LINK_FILE "%CD%\vim" "%USERPROFILE%\vimfiles" /d
call :LINK_FILE "%CD%\vim\vsvimrc.vim" "%USERPROFILE%\_vsvimrc"
:NVIM
call :LINK_FILE "%CD%\nvim" "%LOCALAPPDATA%\nvim" /d
goto :EOF
:POWERSHELL
::: old powershell
call :LINK_FILE "%CD%\WindowsPowerShell\Microsoft.PowerShell_profile.ps1" "%USERPROFILE%\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1"
::: new powershell
call :LINK_FILE "%CD%\PowerShell\Microsoft.PowerShell_profile.ps1" "%USERPROFILE%\Documents\PowerShell\Microsoft.PowerShell_profile.ps1"
::: starship (should have installed nerd fonts, too)
call :LINK_FILE "%CD%\config-extra\starship.toml" "%USERPROFILE%\.config\starship.toml"
goto :EOF
:GIT
call :LINK_FILE "%CD%\git\.gitconfig" "%USERPROFILE%\.gitconfig"
call :LINK_FILE "%CD%\git\.gitconfig-win" "%USERPROFILE%\.gitconfig-extra"
call :LINK_FILE "%CD%\git\.gitignore_global" "%USERPROFILE%\.gitignore_global"
goto :EOF
:VSCODE
call :LINK_FILE "%CD%\VSCode\keybindings.json" "%APPDATA%\Code\User\keybindings.json"
call :LINK_FILE "%CD%\VSCode\settings.json" "%APPDATA%\Code\User\settings.json"
call :LINK_FILE "%CD%\VSCode\snippets" "%APPDATA%\Code\User\snippets"
call :LINK_FILE "%CD%\VSCode\keybindings.json" "%APPDATA%\Code - Insiders\User\keybindings.json"
call :LINK_FILE "%CD%\VSCode\settings.json" "%APPDATA%\Code - Insiders\User\settings.json"
call :LINK_FILE "%CD%\VSCode\snippets" "%APPDATA%\Code - Insiders\User\snippets"
goto :EOF
::: =================================================================
::: Enumerate applications here
::: =================================================================
:RUN_LOOP
call :VIM
call :POWERSHELL
call :GIT
call :VSCODE
call :NVIM
:EOF