Created
March 21, 2025 17:00
-
-
Save wyattferguson/c03bceec446e90814de474dfb20ad651 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PowerShell Config: ~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 | |
# Create profie with command: | |
# code $profile | |
# Welcome Message | |
Write-Host ' ' | |
Write-Host 'π ' (python --version) | |
Write-Host 'π€ ' (pwsh --version) | |
Write-Host 'π¦ ' (rustc --version) | |
Write-Host 'π§ ' (git --version) | |
Write-Host 'π ' (uv --version) | |
# Start powershell with starship | |
Invoke-Expression (&starship init powershell) | |
# Init zoxide and replace cd with z | |
Invoke-Expression (& { (zoxide init --cmd cd powershell | Out-String) }) | |
# Replace cat with bat | |
Set-Alias cat bat | |
# Activate virtual environment | |
Set-Alias act .venv\Scripts\activate | |
Set-Alias dact deactivate | |
# Open VSCode with Current Directory | |
function Invoke-VSCodeCurrentDirectory { | |
param () | |
Invoke-Expression "code ." | |
} | |
Set-Alias c Invoke-VSCodeCurrentDirectory | |
# Up command | |
function Invoke-UP { | |
param ( | |
[string]$filename | |
) | |
$command = "cd .." | |
Invoke-Expression $command | |
} | |
Set-Alias up Invoke-UP | |
Set-Alias u Invoke-UP | |
# Directory Delete - rmd command | |
function Invoke-DirDelete{ | |
param ( | |
[string]$directory | |
) | |
$command = "rm -r -force $directory" | |
Invoke-Expression $command | |
} | |
Set-Alias rmd Invoke-DirDelete | |
# touch command for single file creation | |
function Invoke-Touch { | |
param ( | |
[string]$filename | |
) | |
$command = "echo null >> $filename" | |
Invoke-Expression $command | |
} | |
Set-Alias touch Invoke-Touch | |
##################################################################### | |
# RUST # | |
##################################################################### | |
function Invoke-RustBuildRun { | |
param ( | |
[string]$filename | |
) | |
$baseFilename = $filename.Substring(0, $filename.Length - 3) | |
$command = "rustc $filename && $baseFilename.exe" | |
Invoke-Expression $command | |
} | |
Set-Alias rst Invoke-RustBuildRun | |
##################################################################### | |
# EZA Configuration # | |
##################################################################### | |
# EZA theme.yml location | |
$env:EZA_CONFIG_DIR = "$env:USERPROFILE\.config" | |
# Replace ls with min details EZA | |
function Invoke-MediumEza { | |
param ( | |
[Parameter(ValueFromRemainingArguments = $true)] | |
[string[]]$Args | |
) | |
eza -la --icons=always --no-user --no-filesize --no-permissions --colour=always --no-symlinks --time-style '+%y/%m/%d %H:%M' @Args | |
} | |
Set-Alias ls Invoke-MediumEza | |
# Replace ls with all details EZA | |
function Invoke-FullEza { | |
param ( | |
[Parameter(ValueFromRemainingArguments = $true)] | |
[string[]]$Args | |
) | |
eza -lamh --icons=always --colour=always --no-symlinks --time-style '+%y/%m/%d %H:%M' @Args | |
} | |
Set-Alias lsd Invoke-FullEza | |
# quick ls with l | |
Set-Alias l eza | |
##################################################################### | |
# FZF Configuration # | |
##################################################################### | |
# Quick cd | |
function Invoke-QuickCD { | |
param ( | |
[Parameter(ValueFromRemainingArguments = $true)] | |
[string[]]$input_path | |
) | |
$selected_directory = fd --type directory | fzf --height 70% --preview='eza -lahT --level=2 --no-permissions --icons=always --colour=always --no-symlinks --time-style "+%y/%m/%d %H:%M" {}' --header='Quick CD' | |
if ($selected_directory) { | |
Invoke-Expression (cd $selected_directory) | |
} | |
} | |
Set-PSReadLineKeyHandler -Key "alt+c" -ScriptBlock { Invoke-QuickCD } | |
# Fast open file in VSCode(Ctrl+f) | |
function Invoke-FZFCodeFile { | |
param ( | |
[Parameter(ValueFromRemainingArguments = $true)] | |
[string[]]$input_path | |
) | |
$selected_file = fzf --walker-skip .git,node_modules,target,.venv --preview 'bat -n --color=always {}' --header='Open file in VSCode' | |
if ($selected_file) { | |
code $selected_file | |
} | |
} | |
Set-Alias f Invoke-FZFCodeFile | |
Set-PSReadLineKeyHandler -Key "Ctrl+f" -ScriptBlock { Invoke-FZFCodeFile } | |
# Open directory in VSCode (Ctrl+d) | |
function Invoke-FZFCodeDirectory { | |
param ( | |
[Parameter(ValueFromRemainingArguments = $true)] | |
[string[]]$input_path | |
) | |
$selected_directory = fd --type directory | fzf --preview='eza -lahT --level=2 --no-permissions --icons=always --colour=always --no-symlinks --time-style "+%y/%m/%d %H:%M" {}' --header='Open Directory in VSCode' | |
if ($selected_directory) { | |
code $selected_directory | |
} | |
} | |
Set-Alias d Invoke-FZFCodeDirectory | |
Set-PSReadLineKeyHandler -Key "Ctrl+d" -ScriptBlock { Invoke-FZFCodeDirectory } | |
# Open directory in Windows Explorer (Ctrl+o) | |
function Invoke-FZFOpenDirectory { | |
param ( | |
[Parameter(ValueFromRemainingArguments = $true)] | |
[string[]]$input_path | |
) | |
$selected_directory = fd --type directory | fzf --preview='eza -lahT --level=2 --no-permissions --icons=always --colour=always --no-symlinks --time-style "+%y/%m/%d %H:%M" {}' --header='Open Folder in Explorer' | |
if ($selected_directory) { | |
ii $selected_directory | |
} | |
} | |
Set-Alias o Invoke-FZFOpenDirectory | |
Set-PSReadLineKeyHandler -Key "Ctrl+o" -ScriptBlock { Invoke-FZFOpenDirectory } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment