From 6f221e7fa064a14b4e3528dd79b21ed59119fd96 Mon Sep 17 00:00:00 2001 From: Daveanand Mannie Date: Sat, 7 Sep 2024 16:50:11 -0400 Subject: [PATCH] udpated powershell profile --- init.lua | 2 +- pwsh_profile.ps1 | 36 +++++++++++++++++++++++++++++++----- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index 28ceef0..b6ef49e 100644 --- a/init.lua +++ b/init.lua @@ -2,7 +2,7 @@ require("config.lazy") -- powershell so my shit compiles with zig when i install vim.o.shell = "C:/Program Files/PowerShell/7/pwsh.exe" -vim.o.shellcmdflag = "-nologo -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;" +-- vim.o.shellcmdflag = "-nologo -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;" vim.o.shellredir = "2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode" vim.o.shellpipe = "2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode" vim.o.shellquote = "" diff --git a/pwsh_profile.ps1 b/pwsh_profile.ps1 index d5a722b..d9a8c92 100644 --- a/pwsh_profile.ps1 +++ b/pwsh_profile.ps1 @@ -1,11 +1,35 @@ #### Don't forget to add this to the the profile default location is $PROFILE -Write-Output "Hello Daveanand" +function Write-Display-Header +{ + param ( + [string]$HeaderText = "Hello", + [ConsoleColor]$HeaderTextColor = [ConsoleColor]::Magenta + ) + $HeaderText = "💻 Hello Daveanand 💻" + # Get terminal width + $width = $host.UI.RawUI.WindowSize.Width + + # Create the header line and padding + $line = "=" * $width + $padding = [math]::Max(0, ($width - $HeaderText.Length) / 2) + + # Print the header line with `=` characters + Write-Host $line + + # Print the header text centered + Write-Host (" " * $padding) -NoNewline + Write-Host $HeaderText -ForegroundColor $HeaderTextColor -NoNewline + Write-Host (" " * $padding) + + # Print the bottom line + Write-Host $line +} function Show-LoadingWheel { - $duration = 1 + $duration = 2 # Define spinner characters - $spinnerChars = @('|', '/', '-', '\') + $spinnerChars = @('|', '/', '', '\') $delay = 25 # Adjust this value for spinner speed @@ -22,7 +46,7 @@ function Show-LoadingWheel { # Clear the current line and display the spinner character $host.UI.RawUI.CursorPosition = @{X=0;Y=$host.UI.RawUI.CursorPosition.Y} - Write-Host -NoNewline "$char $char $char $char $char $char" + Write-Host -NoNewline "$char $char $char $char $char $char" -ForegroundColor Magenta # Break the loop if the total elapsed time exceeds the duration if ((Get-Date) -gt $startTime.AddSeconds($duration)) @@ -34,9 +58,11 @@ function Show-LoadingWheel # Clear the spinner character after the loading is done $host.UI.RawUI.CursorPosition = @{X=0;Y=$host.UI.RawUI.CursorPosition.Y} - Write-Host -NoNewline " " | Out-Null + Write-Host " " | Out-Null } +######### execution ############### Show-LoadingWheel | Out-Null +Write-Display-Header ##################### Aliases #############################