Skip to content

Instantly share code, notes, and snippets.

@lee-at-work
Created May 4, 2021 07:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lee-at-work/b5fe974a4c78fab73d3c4e48fa1117e4 to your computer and use it in GitHub Desktop.
Save lee-at-work/b5fe974a4c78fab73d3c4e48fa1117e4 to your computer and use it in GitHub Desktop.
Personal ps profile
Import-Module PSReadLine
Import-Module posh-git
Import-Module oh-my-posh
Import-Module "$PSScriptRoot/Show-Henshin.psm1"
# Chocolatey profile
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
Import-Module "$ChocolateyProfile"
}
#try { $null = gcm pshazz -ea stop; pshazz init } catch { }
$env:PYTHONIOENCODING="utf-8"
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
# TLS 1.2 support
#[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 -bor
# [System.Net.SecurityProtocolType]::Tls11 -bor
# [System.Net.SecurityProtocolType]::Tls -bor
# [System.Net.SecurityProtocolType]::Ssl3
# Don't beep!
Set-PSReadlineOption -BellStyle None
# Tab - options choice
Set-PSReadlineKeyHandler -Key tab -Function MenuComplete
# Install-Module Get-ChildItemColor
# Set dir, l, ll, and ls alias to use the new Get-ChildItemColor cmdlets
Set-Alias ls Get-ChildItemColorFormatWide -Option AllScope
Set-Alias l ls -Option AllScope
Set-Alias ll Get-ChildItemColor -Option AllScope
Set-Alias dir ll -Option AllScope
function fuck {
$history = (Get-History -Count 1).CommandLine;
if (-not [string]::IsNullOrWhiteSpace($history)) {
$fuck = $(thefuck $args $history);
if (-not [string]::IsNullOrWhiteSpace($fuck)) {
if ($fuck.StartsWith("echo")) { $fuck = $fuck.Substring(5); }
else { iex "$fuck"; }
}
}
[Console]::ResetColor()
}
# PowerShell parameter completion shim for the dotnet CLI
Register-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock {
param($commandName, $wordToComplete, $cursorPosition)
dotnet complete --position $cursorPosition "$wordToComplete" | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
function Do-Henshin {
try {
# Write-Host "! 変身 !"
Show-Henshin
Set-PoshPrompt -Theme raistlin
# $ThemeSettings.PromptSymbols.PromptIndicator = 'λ'
.\dracula-prompt-configuration.ps1
} catch { }
}
New-Alias -Name henshin -Value Do-Henshin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment