Skip to content

Instantly share code, notes, and snippets.

@keithwongg
Last active September 19, 2025 07:28
Show Gist options
  • Save keithwongg/750e5990cceb6d6c5591adbdaba42cdd to your computer and use it in GitHub Desktop.
Save keithwongg/750e5990cceb6d6c5591adbdaba42cdd to your computer and use it in GitHub Desktop.
PowerShell Script - New Tab Split Panes, Run Custom PowerShell Commands
# run 'echo $PROFILE' in PowerShell to get location of Profile Script. Paste the script inside that file and open a new instance to load it.
## Automation scripts to start local dev instance
function run-backend {
cd "C:\\Users\\admin\\Documents\\Repos\\VueWithAsp\\VueWithAsp.Server";
dotnet run;
}
function run-frontend {
cd "C:\\Users\\admin\\Documents\\Repos\\VueWithAsp\\vuewithasp.client"
npm run dev;
}
# Run init commands and split-screen
function work {
wt -w 0 --title "Backend (C#)" --tabColor '#512cd4' PowerShell -c run-backend `; split-pane -H --title "FrontEnd (Vue.js)" --suppressApplicationTitle --tabColor '#8ed4b5' PowerShell -c run-frontend;
}
## Default Setups
# For Fish like suggestions in powershell: https://dev.to/animo/fish-like-autosuggestion-in-powershell-21ec
Import-Module PSReadLine
Set-PSReadLineOption -PredictionSource History
# For automatically adding SSH agent: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account
Get-Service -Name ssh-agent | Set-Service -StartupType Manual
Start-Service ssh-agent
ssh-add c:/Users/user/.ssh/id_ed25519
# yazi: https://yazi-rs.github.io/docs/installation
$Env:YAZI_FILE_ONE = 'C:\Program Files\Git\usr\bin\file.exe'
function y {
$tmp = (New-TemporaryFile).FullName
yazi $args --cwd-file="$tmp"
$cwd = Get-Content -Path $tmp -Encoding UTF8
if (-not [String]::IsNullOrEmpty($cwd) -and $cwd -ne $PWD.Path) {
Set-Location -LiteralPath (Resolve-Path -LiteralPath $cwd).Path
}
Remove-Item -Path $tmp
}
# lazygit: https://github.com/jesseduffield/lazygit?tab=readme-ov-file#scoop-windows
function lg {
lazygit;
}
# Aliases
function repos {
cd "C:\\Users\\user\\Documents\\Repos";
}
function symlink {
param($From, $To)
New-Item -ItemType SymbolicLink -Target $From -Path $To
}
function networkreset {
netsh winsock reset;
netsh int ip reset;
ipconfig /flushdns;
}
function source {
. $PROFILE;
}
# fn with params
function symlink {
param($From, $To)
New-Item -ItemType SymbolicLink -Target $From -Path $To
}
# use oh-my-posh (for shell theming) prompt: https://ohmyposh.dev/docs/installation/prompt
oh-my-posh init pwsh --config 'robbyrussell' | Invoke-Expression
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment