Skip to content

Instantly share code, notes, and snippets.

@Mic-360
Last active June 12, 2023 07:40
Show Gist options
  • Save Mic-360/f9738d466fec9adeacc888142d3b8b69 to your computer and use it in GitHub Desktop.
Save Mic-360/f9738d466fec9adeacc888142d3b8b69 to your computer and use it in GitHub Desktop.
Powershel Profile
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\zash.omp.json" | Invoke-Expression
Import-Module -Name Terminal-Icons
Import-Module -Name posh-git
Set-GithubCopilotAliases
function Set-PoshGitStatus {
$global:GitStatus = Get-GitStatus
$env:POSH_GIT_STRING = Write-GitStatus -Status $global:GitStatus
}
New-Alias -Name 'Set-PoshContext' -Value 'Set-PoshGitStatus' -Scope Global -Force
Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -HistoryNoDuplicates
Set-PSReadLineOption -PredictionViewStyle InlineView
Set-PSReadLineOption -EditMode Windows
Set-PSReadLineOption -colors @{ Command = '#509aff' }
Set-PSReadLineOption -Colors @{ InlinePrediction = '#2F7004'}
Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete
Set-PSReadLineKeyHandler -Key Ctrl+UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key Ctrl+DownArrow -Function HistorySearchForward
# WinGet Command Line Tab Completion
Register-ArgumentCompleter -Native -CommandName winget -ScriptBlock {
param($wordToComplete, $commandAst, $cursorPosition)
[Console]::InputEncoding = [Console]::OutputEncoding = $OutputEncoding = [System.Text.Utf8Encoding]::new()
$Local:word = $wordToComplete.Replace('"', '""')
$Local:ast = $commandAst.ToString().Replace('"', '""')
winget complete --word="$Local:word" --commandline "$Local:ast" --position $cursorPosition | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
# CaptureScreen is good for blog posts or email showing a transaction
Set-PSReadLineKeyHandler -Chord 'Ctrl+d,Ctrl+c' -Function CaptureScreen
Function search {
$query = 'https://www.google.com/search?q='
$args | % { $query = $query + "$_+" }
$url = $query.Substring(0, $query.Length - 1)
Start "$url"
}
Set-Alias chrome search
Function usearch {
$query = 'https://'
$args | % { $query = $query + "$_+" }
$url = $query.Substring(0, $query.Length - 1)
Start "$url"
}
Set-Alias url usearch
######################################################################################################
# Text Editor from WSL
######################################################################################################
#Search Private
Function incognito{
$query = 'https://www.google.com/search?q='
$args | % {$query = $query+"$_+"}
$Url = $query.Substring(0,$query.Length-1)
[System.Diagnostics.Process]::Start("chrome.exe","--incognito $url")
}
Set-Alias insearch incognito
######################################################################################################
#Copyrights under Clove
#Search Tor
Function onion{
$query = 'https://www.duckduckgo.com/?q='
$args | % {$query = $query+"$_+"}
$Url = $query.Substring(0,$query.Length-1)
[System.Diagnostics.Process]::Start("brave.exe","--tor $url")
}
Set-Alias tor onion
######################################################################################################
#Linked in Function
Function linkedin{
$query = 'https://www.linkedin.com/in/bhaumic/'
$args | % { $query = $query + "$_+" }
$url = $query.Substring(0, $query.Length - 1)
Start "$url"
}
######################################################################################################
#Personal Commandlets
New-Alias -Name open -Value Invoke-Item
New-Alias -Name gpt -Value Get-GPT3Completion
New-Alias -Name code -Value code-insiders
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment