msaliases/install.ps1

107 lines
4.5 KiB
PowerShell
Raw Normal View History

2020-04-03 03:26:32 -04:00
# # Self-elevate the script if required
# if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
# if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) {
# $CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments
# Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine
# Exit
# }
# }
2020-04-02 20:40:46 -04:00
# User Profile
2020-04-03 03:26:32 -04:00
Write-Host "User Profile Directory: $($env:USERPROFILE)"
2020-04-02 20:40:46 -04:00
# VS Code Directory
2020-04-03 03:26:32 -04:00
$app_data = $env:APPDATA
2021-06-20 10:33:50 -04:00
New-Item -ItemType Directory -Force -Path "$($app_data)\Code\User"
2020-04-03 03:26:32 -04:00
Write-Host "VS Code User Directory: $($app_data)\Code\User"
2020-04-03 03:26:32 -04:00
$vscode_user_settings_path = "$($app_data)\Code\User\settings.json"
Write-Host "VS Code User Settings Path: $($vscode_user_settings_path)"
2020-04-02 20:40:46 -04:00
# Cmder Config Directory
2021-06-20 10:25:43 -04:00
$cmder_root = "$($env:USERPROFILE)\Cmder"
2021-06-20 10:37:07 -04:00
New-Item -ItemType Directory -Force -Path "$($cmder_root)\config"
2020-04-03 03:26:32 -04:00
Write-Host "Cmder Config Directory: $($cmder_root)\config"
$cmder_user_conemu_xml_path = "$($cmder_root)\config\user_ConEmu.xml"
Write-Host "Cmder ConEmu Path: $($cmder_user_conemu_xml_path)"
2020-04-03 03:26:32 -04:00
$cmder_user_profile_cmd_path = "$($cmder_root)\config\user_profile.cmd"
Write-Host "Cmder CMD User Profile Path: $($cmder_user_profile_cmd_path)"
2020-04-03 03:26:32 -04:00
$cmder_user_aliases_cmd_path = "$($cmder_root)\config\user_aliases.cmd"
Write-Host "Cmder CMD Aliases Path: $($cmder_user_aliases_cmd_path)"
2020-04-03 03:26:32 -04:00
$cmder_user_profile_ps_path = "$($cmder_root)\config\user_profile.ps1"
Write-Host "Cmder PowerShell Profile Path: $($cmder_user_profile_ps_path)"
# Neovim Config Directory
$local_app_data = $env:LOCALAPPDATA
2021-06-20 10:33:50 -04:00
New-Item -ItemType Directory -Force -Path "$($local_app_data)\nvim"
2020-04-03 03:26:32 -04:00
Write-Host "Neovim Init Directory: $($local_app_data)\nvim"
2020-04-03 03:26:32 -04:00
$neovim_init_path = "$($local_app_data)\nvim\init.vim"
Write-Host "Neovim Init Path: $($neovim_init_path)"
2020-04-02 20:40:46 -04:00
# Cmder DOSKEY Aliases
2020-04-02 20:40:46 -04:00
if (-not (Test-Path -Path $cmder_user_aliases_cmd_path)) {
$repo_cmder_user_aliases_cmd_path = "$($PWD)\cmder\user_aliases.cmd"
Write-Host "Repo user_aliases.cmd: $($repo_cmder_user_aliases_cmd_path)"
New-Item -Path $cmder_user_aliases_cmd_path -ItemType SymbolicLink -Value $repo_cmder_user_aliases_cmd_path
Get-Item -Path $cmder_user_aliases_cmd_path
2020-04-02 20:40:46 -04:00
} else {
Write-Host "Cmder User Aliases Exists"
}
# Cmder CMD Profile
2020-04-02 20:40:46 -04:00
if (-not (Test-Path -Path $cmder_user_profile_cmd_path)) {
$repo_cmder_user_profile_cmd_path = "$($PWD)\cmder\user_aliases.cmd"
Write-Host "Repo user_profile.cmd: $($repo_cmder_user_profile_cmd_path)"
New-Item -Path $cmder_user_profile_cmd_path -ItemType SymbolicLink -Value $repo_cmder_user_profile_cmd_path
Get-Item -Path $cmder_user_profile_cmd_path
2020-04-02 20:40:46 -04:00
} else {
Write-Host "Cmder User Profile Exists"
}
# Cmder Powershell User Profile
2020-04-02 20:40:46 -04:00
if (-not (Test-Path -Path $cmder_user_profile_ps_path)) {
$repo_cmder_user_profile_ps_path = "$($PWD)\cmder\user_profile.ps1"
Write-Host "Repo user_profile.ps1: $($repo_cmder_user_profile_ps_path)"
New-Item -Path $cmder_user_profile_ps_path -ItemType SymbolicLink -Value $repo_cmder_user_profile_ps_path
Get-Item -Path $cmder_user_profile_ps_path
2020-04-02 20:40:46 -04:00
} else {
Write-Host "Cmder Powershell Profile Exists"
}
# Cmder ConEmu Settings
if(-not (Test-Path -Path $cmder_user_conemu_xml_path)) {
$repo_cmder_user_conemu_cml_path = "$($PWD)\cmder\user-ConEmu.xml"
Write-Host "Repo user-ConEmu.xml: $($repo_cmder_user_conemu_cml_path)"
New-Item -Path $cmder_user_conemu_xml_path -ItemType SymbolicLink -Value $repo_cmder_user_conemu_cml_path
} else {
Write-Host "Cmder ConEum User Profile Exists"
}
2020-04-03 03:26:32 -04:00
# VSCODE Settings
2020-04-02 20:40:46 -04:00
if (-not (Test-Path -Path $vscode_user_settings_path)) {
$repo_vscode_user_settings_path = "$($PWD)\vscode\settings.json)"
Write-Host "Repo VSCode User Settings: $($repo_vscode_user_settings_path)"
New-Item -Path $vscode_user_settings_path -ItemType SymbolicLink -Value $repo_vscode_user_settings_path
Get-Item -Path $vscode_user_settings_path
2020-04-02 20:40:46 -04:00
} else {
Write-Host "VS Code User Settings Exists"
2020-04-03 03:26:32 -04:00
}
# NeoVim init
2020-04-03 03:26:32 -04:00
if (-not (Test-Path -Path $neovim_init_path)) {
$repo_neovim_init_path = "$($PWD)\vim\init.vim"
Write-Host "Repo init.vim: $($repo_neovim_init_path)"
New-Item -Path $neovim_init_path -ItemType SymbolicLink -Value $repo_neovim_init_path
2020-04-03 03:26:32 -04:00
Get-Item -Path $neovim_init_path
} else {
Write-Host "Neovim Init Path Exists"
}
Write-Host -NoNewline "Press any key to continue.."
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")