Last active
August 24, 2020 09:36
-
-
Save pvoliveira/2042359781f8703b608417d655513e55 to your computer and use it in GitHub Desktop.
This file contains 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
# Ensure that Get-ChildItemColor is loaded | |
Import-Module Get-ChildItemColor | |
Import-Module DockerCompletion | |
# Set l and ls alias to use the new Get-ChildItemColor cmdlets | |
Set-Alias l Get-ChildItemColor -Option AllScope | |
Set-Alias ls Get-ChildItemColorFormatWide -Option AllScope | |
# Helper function to show Unicode characters | |
function U { | |
param | |
( | |
[int] $Code | |
) | |
if ((0 -le $Code) -and ($Code -le 0xFFFF)) { | |
return [char] $Code | |
} | |
if ((0x10000 -le $Code) -and ($Code -le 0x10FFFF)) { | |
return [char]::ConvertFromUtf32($Code) | |
} | |
throw "Invalid character code $Code" | |
} | |
# # Ensure posh-git is loaded | |
# Import-Module -Name posh-git | |
# # Ensure oh-my-posh is loaded | |
Import-Module -Name oh-my-posh | |
# # Set the default prompt theme | |
Set-Theme Paradox | |
# $ThemeSettings.Colors.SessionInfoBackgroundColor = [ConsoleColor]::DarkGray | |
# $ThemeSettings.Colors.PromptBackgroundColor = [ConsoleColor]::DarkCyan | |
# $ThemeSettings.Colors.GitLocalChangesColor = [ConsoleColor]::Yellow | |
# $ThemeSettings.Colors.AdminIconForegroundColor = [ConsoleColor]::Yellow | |
# Dracula readline configuration. Requires version 2.0, if you have 1.2 convert to `Set-PSReadlineOption -TokenType` | |
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 = "$([System.Environment]::NewLine)$([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 | |
# Misc | |
function back-dir { cd .. } | |
Set-Alias -Name .. -Value back-dir | |
function open-first-sln { | |
Get-ChildItemColor -Recurse -Filter *.sln | Select-Object -ExpandProperty Name | ForEach-Object{ Start-Process $_.FullName; break; } | |
} | |
function Open-SolutionFile { | |
param ([string]$SolutionFile) | |
Start-Process $SolutionFile | |
} | |
$openSolutionFileSB = { | |
param($commandName) | |
Get-ChildItemColor -Recurse -Depth 3 -Filter *.sln | Select-Object -ExpandProperty FullName | |
} | |
Register-ArgumentCompleter -CommandName Open-SolutionFile -ParameterName SolutionFile -ScriptBlock $openSolutionFileSB | |
Set-Alias -Name sln -Value Open-SolutionFile | |
# Autocomplete | |
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete | |
$env:LC_ALL='C.UTF-8' | |
function pwdnix-func { (Get-Location).Path -replace '\\', '/' } | |
Set-Alias -Name pwdnix -Value pwdnix-func | |
Import-Module posh-sshell | |
Start-SshAgent -Quiet |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment