From 0cb792d7803b710c675d8f25cba041f1dcd1f50a Mon Sep 17 00:00:00 2001 From: DeveloperDurp Date: Sun, 30 Oct 2022 19:18:59 -0500 Subject: [PATCH] powershell --- .../Microsoft.PowerShell_profile.ps1 | 27 ++++++++++ roles/customize/templates/pwsh-config.json | 50 +++++++++++++++++++ roles/customize/vars/defaults.yml | 2 + 3 files changed, 79 insertions(+) create mode 100644 roles/customize/templates/Microsoft.PowerShell_profile.ps1 create mode 100644 roles/customize/templates/pwsh-config.json diff --git a/roles/customize/templates/Microsoft.PowerShell_profile.ps1 b/roles/customize/templates/Microsoft.PowerShell_profile.ps1 new file mode 100644 index 0000000..69b0c17 --- /dev/null +++ b/roles/customize/templates/Microsoft.PowerShell_profile.ps1 @@ -0,0 +1,27 @@ +clear-host +oh-my-posh init pwsh --config ~/.config/powershell/config.json | Invoke-Expression +Set-PSReadLineOption -PredictionSource History + +@( + "cat,get-content" + "cd,set-location" + "clear,clear-host" + "cp,copy-item" + "history,get-history" + "kill,stop-process" + "ls,Get-ChildItem" + "mv,move-item" + "ps,get-process" + "pwd,get-location" + "which,get-command" + "open,Invoke-Item" + "basename,Split-Path" + "realpath,resolve-path" +) | ForEach-Object { + $Alias = ($PSItem -split ",")[0] + $value = ($PSItem -split ",")[1] + Set-Alias -Name $Alias -Value $value -Option AllScope +} + +$env:POWERSHELL_TELEMETRY_OPTOUT = 1 +$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1 diff --git a/roles/customize/templates/pwsh-config.json b/roles/customize/templates/pwsh-config.json new file mode 100644 index 0000000..cd5f62e --- /dev/null +++ b/roles/customize/templates/pwsh-config.json @@ -0,0 +1,50 @@ +{ + "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", + "blocks": [ + { + "alignment": "right", + "segments": [ + { + "foreground": "#00C5C7", + "properties": { + "time_format": "15:04:05" + }, + "style": "plain", + "template": " {{ .CurrentDate | date .Format }} ", + "type": "time" + } + ], + "type": "prompt", + "vertical_offset": -1 + }, + { + "alignment": "left", + "newline": true, + "segments": [ + { + "foreground": "#77E4F7", + "properties": { + "style": "full" + }, + "style": "plain", + "template": "{{ .Path }} ", + "type": "path" + }, + { + "foreground": "#FFE700", + "style": "plain", + "template": "{{ .HEAD }} ", + "type": "git" + }, + { + "foreground": "#43D426", + "style": "plain", + "template": "\u276f ", + "type": "text" + } + ], + "type": "prompt" + } + ], + "version": 2 +} diff --git a/roles/customize/vars/defaults.yml b/roles/customize/vars/defaults.yml index 3cf1b45..ac0e7d7 100644 --- a/roles/customize/vars/defaults.yml +++ b/roles/customize/vars/defaults.yml @@ -26,4 +26,6 @@ dconf: configs: - {src: 'terminator', dest: 'terminator', destname: 'config'} + - {src: 'Microsoft.PowerShell_profile.ps1', dest: 'powershell', destname: 'Microsoft.PowerShell_profile.ps1'} + - {src: 'pwsh-config.json', dest: 'powershell', destname: 'config.json'}