dotfiles/win/setup.ps1

33 lines
1.8 KiB
PowerShell
Raw Normal View History

2020-07-22 08:31:56 +00:00
# execute this first: Set-ExecutionPolicy RemoteSigned
2020-07-22 02:43:35 +00:00
2020-05-11 01:14:05 +00:00
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Start-Process PowerShell -Verb RunAs "-NoProfile -ExecutionPolicy Bypass -Command `"cd '$pwd'; & '$PSCommandPath';`"";
exit;
}
# link config files
2020-05-10 07:20:40 +00:00
$dotfiles=(Get-Item $PSScriptRoot).Parent.FullName
New-Item -ItemType SymbolicLink -Target $dotfiles\win\profile.ps1 -Path $profile -Force
New-Item -ItemType SymbolicLink -Target $dotfiles\config\mpv\mpv.conf -Path $Env:APPDATA\mpv\mpv.conf -Force
New-Item -ItemType SymbolicLink -Target $dotfiles\config\mpv\scripts -Path $Env:APPDATA\mpv\scripts -Force
2020-07-28 04:07:07 +00:00
New-Item -ItemType SymbolicLink -Target $dotfiles\config\nvim -Path $Env:LOCALAPPDATA\nvim -Force
2020-07-22 08:31:56 +00:00
Remove-Item -Force -Recurse $Env:APPDATA\pip
New-Item -ItemType Directory -Path $Env:APPDATA\pip
New-Item -ItemType SymbolicLink -Target $dotfiles\pip\pip.conf -Path $Env:APPDATA\pip\pip.ini -Force
2020-05-11 01:14:05 +00:00
# fix Shift key toggling Cn/En fro MS wubi
2020-09-14 06:52:57 +00:00
#if (-not (Get-ScheduledTask -TaskName "Wubi No Shift")) {
#$wubiAction = New-ScheduledTaskAction -Execute 'Powershell.exe' `
#-Argument "-NoProfile -WindowStyle Hidden -File $PSScriptRoot\wubi-no-shift.ps1"
#$wubiTrigger = New-ScheduledTaskTrigger -AtLogOn
#Register-ScheduledTask -Action $wubiAction -Trigger $wubiTrigger -TaskName "Wubi No Shift" -Description "Disable Shift key toggling CN/EN" -RunLevel Highest
#}
2020-07-27 08:29:28 +00:00
2020-09-14 06:52:57 +00:00
Install-Module -Name PowerShellGet -Force -AllowPrerelease
Install-Module -Name posh-git
Install-Module -Name oh-my-posh
2020-08-04 07:32:56 +00:00
# replace notepad with nvim-qt
reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v "Debugger" /t REG_SZ /d "${dotfiles}\win\npd.vbs" /f