Skip to content

Instantly share code, notes, and snippets.

@0xPranavDoshi
Last active June 9, 2021 05:30
Show Gist options
  • Save 0xPranavDoshi/24e4a471daadc221a49f6a495d2c67ff to your computer and use it in GitHub Desktop.
Save 0xPranavDoshi/24e4a471daadc221a49f6a495d2c67ff to your computer and use it in GitHub Desktop.
Powershell Profile For Devs
# ⭐ If you find this useful!
# USAGE:
# Go to your powershell profile located here -> %USERPROFILE%\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
# Create the file if it doesn't exist
# Paste the following contents into your powershell profile
Set-PSReadlineOption -Color @{
"Command" = [ConsoleColor]::Green
"Parameter" = [ConsoleColor]::Gray
"Operator" = [ConsoleColor]::Magenta
"Variable" = [ConsoleColor]::White
"String" = [ConsoleColor]::Yellow
"Number" = [ConsoleColor]::Blue
"Type" = [ConsoleColor]::Cyan
"Comment" = [ConsoleColor]::DarkCyan
}
# Dracula Prompt Configuration
Import-Module posh-git
$GitPromptSettings.DefaultPromptPrefix.Text = "$([char]0x2192) " # arrow unicode symbol
$GitPromptSettings.DefaultPromptPrefix.ForegroundColor = [ConsoleColor]::Green
$GitPromptSettings.DefaultPromptPath.ForegroundColor =[ConsoleColor]::Cyan
$GitPromptSettings.DefaultPromptSuffix.Text = "$([char]0x203A) " # chevron unicode symbol
$GitPromptSettings.DefaultPromptSuffix.ForegroundColor = [ConsoleColor]::Magenta
# Dracula Git Status Configuration
$GitPromptSettings.BeforeStatus.ForegroundColor = [ConsoleColor]::Blue
$GitPromptSettings.BranchColor.ForegroundColor = [ConsoleColor]::Blue
$GitPromptSettings.AfterStatus.ForegroundColor = [ConsoleColor]::Blue
# GITHUB SHORTCUTS
# Function to clone a github repository
Function git_clone {
param(
[String] $url
)
git clone $url
}
# Function to commit to a github repository
Function git_commit {
param(
[String] $name
)
git commit -m $name
}
# Function to pull from a github repository
Function git_pull {
param(
[String] $branch
)
git pull origin $branch
}
# Function to add code to github
Function git_add {
git add .
}
# Function to push code to github
Function git_push {
git push
}
# Function to stash changes
Function git_stash {
git stash
}
# Function to automatically push code to github
Function deploy() {
param(
$commitName,
$branch
)
git add .
git commit -m $commitName
git push origin $branch
}
# RUST SHORTCUTS
# Function to run rust program with cargo
Function cargo_run {
cargo run
}
Function cargo_build_release {
cargo run
}
# Function to build rust program
Function cargo_build {
cargo build --release
}
# NAVIGATION SHORTCUTS
# Function to go to my programming folder
Function codedir {
cd 'D:\\prana\Programming\'
}
# Setting aliases for the functions
Set-Alias gcl git_clone
Set-Alias gcmt git_commit
Set-Alias ga git_add
Set-Alias cu cargo_run
Set-Alias cb cargo_build
Set-Alias gpu git_push
Set-Alias gpl git_pull
Set-Alias gs git_stash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment