diff options
author | claw0ry <me@claw0ry.net> | 2024-12-18 16:37:39 +0100 |
---|---|---|
committer | claw0ry <me@claw0ry.net> | 2024-12-18 16:37:39 +0100 |
commit | fdf67d28f0ab1a19419838cccfb1e6e0546067a2 (patch) | |
tree | 001575ca20f9b1b4612e75fd1b0e151a6db0476d /powershell/Microsoft.PowerShell_profile.ps1 | |
parent | scripts: make helper function stand out more (diff) |
powerhsell: set custom prompt if oh-my-posh not available
Diffstat (limited to 'powershell/Microsoft.PowerShell_profile.ps1')
-rw-r--r-- | powershell/Microsoft.PowerShell_profile.ps1 | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/powershell/Microsoft.PowerShell_profile.ps1 b/powershell/Microsoft.PowerShell_profile.ps1 index 2545417..7f247ec 100644 --- a/powershell/Microsoft.PowerShell_profile.ps1 +++ b/powershell/Microsoft.PowerShell_profile.ps1 @@ -18,15 +18,25 @@ if ($IsWindows) { # - PROMPT - # ----------------------------------------------------------------------------- -oh-my-posh init pwsh --config "$env:XDG_CONFIG_HOME/oh-my-posh/config.yml" | Invoke-Expression +if (Get-Command 'oh-my-posh' -ErrorAction 'SilentlyContinue') { + oh-my-posh init pwsh --config "$env:XDG_CONFIG_HOME/oh-my-posh/config.yml" | Invoke-Expression +} else { + function prompt { + $git_branch = $(git branch --show-current 2>/dev/null) + if ($git_branch -ne $null -and $git_branch -ne "") { + $git_branch = "($($git_branch))" + } + "[pwsh] `e[01;32m$($env:USER)@$([System.Net.Dns]::GetHostName())`e[00m:`e[01;34m$(Split-Path -Path $pwd -Leaf) $git_branch`e[00m`$ " + } +} # ----------------------------------------------------------------------------- # - ENVIRONMENT VARIABLES - # ----------------------------------------------------------------------------- $env:PATH += ":$env:HOME/go/bin" -$env:EDITOR = "nvim" -$env:VISUAL = "nvim" +$env:EDITOR = "vim" +$env:VISUAL = "code" # ----------------------------------------------------------------------------- # - CUSTOM FUNCTIONS - |