diff options
| -rw-r--r-- | .config/powershell/Microsoft.PowerShell_profile.ps1 | 48 | ||||
| -rw-r--r-- | .config/powershell/initialize.ps1 | 4 | ||||
| -rw-r--r-- | .config/powershell/onedrive.ps1 | 12 | ||||
| -rw-r--r-- | install.bat | 9 |
4 files changed, 15 insertions, 58 deletions
diff --git a/.config/powershell/Microsoft.PowerShell_profile.ps1 b/.config/powershell/Microsoft.PowerShell_profile.ps1 index ed276ad..349f7ab 100644 --- a/.config/powershell/Microsoft.PowerShell_profile.ps1 +++ b/.config/powershell/Microsoft.PowerShell_profile.ps1 @@ -1,11 +1,3 @@ -# THIS IS NEEDED FOR GIT TAB COMPLETION -Import-Module posh-git - -# Set-PoshPrompt -Theme Paradox -# Set-PoshPrompt -Theme ~/.mytheme.tokyonight.omp.yaml -# Set-PoshPrompt -Theme ~/.omp/themes/tokyonight.omp.yaml -oh-my-posh init pwsh --config ~/.omp/themes/tokyonight.omp.yaml | Invoke-Expression - # Dotfiles special git command function global:config { git --git-dir="$env:USERPROFILE\.cfg" --work-tree="$env:USERPROFILE" $args @@ -20,43 +12,3 @@ Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward New-Alias vi nvim.exe -# Chocolatey profile -$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" -if (Test-Path $ChocolateyProfile) { - Import-Module "$ChocolateyProfile" -} - -# PSReadLine extension to provide VI keybindings -Set-PSReadlineOption -EditMode vi -Set-PSReadLineKeyHandler -Key Tab -Function Complete -Set-PSReadLineKeyHandler -Key Ctrl+r -Function ReverseSearchHistory - -# Remove gl, gp, gm aliases for git commands -Remove-Alias -Force -Name gl -Remove-Alias -Force -Name gp -Remove-Alias -Force -Name gm - -# Custom git functions -function gs { git status } -function gf { git fetch } -function gl { git pull } -function gp { git push } -function gpt { git push --tags } -function gP { git push --force-with-lease } -function ga { git add } -function gcam { git commit -am } -function gd { git diff } -function gw { git diff --word-diff } -function glog { git log } -function gdog { git log --graph --oneline --all } -function gadog { git log --graph --decorate --all } -function gb { git branch } -function gba { git branch --all } -function gco { git checkout } -function gm { git merge } - -# For zoxide v0.8.0+ -Invoke-Expression (& { - $hook = if ($PSVersionTable.PSVersion.Major -lt 6) { 'prompt' } else { 'pwd' } - (zoxide init --hook $hook powershell | Out-String) -}) diff --git a/.config/powershell/initialize.ps1 b/.config/powershell/initialize.ps1 index eaed874..e3989c0 100644 --- a/.config/powershell/initialize.ps1 +++ b/.config/powershell/initialize.ps1 @@ -166,7 +166,7 @@ function setupShellEnvs { $configDir = (Join-Path $env:USERPROFILE '.config') New-Item -ItemType Directory -Path $configDir -ErrorAction SilentlyContinue | Out-Null - writeGitConfig (Join-Path $PSScriptRoot 'gitconfig.ini') + #writeGitConfig (Join-Path $PSScriptRoot 'gitconfig.ini') $sshDir = (Join-Path $env:USERPROFILE '.ssh') # ensure 1Password's identity agent is visible to OpenSSH; cannot have both config and socket on Windows @@ -200,7 +200,7 @@ function main { } # continue with now-local bootstrap.ps1 from cloned repo: # still stick with desktop PS since PSCore is not necessarily installed yet - $script= (Join-Path $dotPath 'bootstrap.ps1') + $script= (Join-Path $dotPath '.config\powershell\bootstrap.ps1') Write-Host "Continue $script in child process" Start-Process -PassThru -NoNewWindow -FilePath "powershell.exe" -ArgumentList "-NoProfile -File $script setup" | Wait-Process diff --git a/.config/powershell/onedrive.ps1 b/.config/powershell/onedrive.ps1 index 625c315..b935130 100644 --- a/.config/powershell/onedrive.ps1 +++ b/.config/powershell/onedrive.ps1 @@ -1,5 +1,13 @@ # onedrive.ps1 +# Helper functions ------------------------ +function force-mkdir($path) { + if (!(Test-Path $path)) { + Write-Host "-- Creating full path to: " $path -ForegroundColor White -BackgroundColor DarkGreen + New-Item -ItemType Directory -Force -Path $path + } +} + # Kill OneDrive with fire ------------------------ Write-Output "Kill OneDrive process" taskkill.exe /F /IM "OneDrive.exe" @@ -66,3 +74,7 @@ Write-Host "Removing OneDrive directory" cd $HOME rm OneDrive -r -force +# Prevents "Suggested Applications" returning +force-mkdir "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Cloud Content" +Set-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Cloud Content" "DisableWindowsConsumerFeatures" 1 + diff --git a/install.bat b/install.bat index 22001b8..d5298f1 100644 --- a/install.bat +++ b/install.bat @@ -1,11 +1,4 @@ -::: ██████╗ ██████╗ ████████╗███████╗██╗██╗ ███████╗███████╗ -::: ██╔══██╗██╔═══██╗╚══██╔══╝██╔════╝██║██║ ██╔════╝██╔════╝ -::: ██║ ██║██║ ██║ ██║ █████╗ ██║██║ █████╗ ███████╗ -::: ██║ ██║██║ ██║ ██║ ██╔══╝ ██║██║ ██╔══╝ ╚════██║ -::: ██████╔╝╚██████╔╝ ██║ ██║ ██║███████╗███████╗███████║ -::: ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚══════╝ -::: -for /f "delims=: tokens=*" %%A in ('findstr /b ::: "%~f0"') do @echo(%%A +REM Installing Dotfiles powershell . $HOME\.config\powershell\Microsoft.PowerShell_profile.ps1 powershell Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force |
