mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 00:33:00 +00:00
chezmoi: powershell
This commit is contained in:
parent
81da252906
commit
298b2290a8
13 changed files with 308 additions and 278 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 1.8 MiB |
|
|
@ -1,41 +1,41 @@
|
||||||
# $DOTFILES/tools\powershell\Aliases.ps1
|
# $DOTFILES/tools\powershell\Aliases.ps1
|
||||||
# Date: 2024-12-01
|
# Date: 2024-12-01
|
||||||
# Author: js0ny
|
# Author: js0ny
|
||||||
# Aliases for PowerShell
|
# Aliases for PowerShell
|
||||||
|
|
||||||
# Unix Shell Equivalents #
|
# Unix Shell Equivalents #
|
||||||
Set-Alias "touch" "New-Item"
|
Set-Alias "touch" "New-Item"
|
||||||
${function:l} = { Get-ChildItem -Force }
|
${function:l} = { Get-ChildItem -Force }
|
||||||
${function:tree} = { lsd --tree $args }
|
${function:tree} = { lsd --tree $args }
|
||||||
Set-Alias "which" "Get-Command"
|
Set-Alias "which" "Get-Command"
|
||||||
|
|
||||||
# Editors #
|
# Editors #
|
||||||
Set-Alias "v" "nvim"
|
Set-Alias "v" "nvim"
|
||||||
Set-Alias "c" "code"
|
Set-Alias "c" "code"
|
||||||
Get-Command neovide -ErrorAction SilentlyContinue > $null && Set-Alias "gvi" "neovide"
|
Get-Command neovide -ErrorAction SilentlyContinue > $null && Set-Alias "gvi" "neovide"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# File Creation #
|
# File Creation #
|
||||||
function mkcd { param ( [string] $dirname) New-Item -ItemType Directory -Name $dirname && Set-Location $dirname }
|
function mkcd { param ( [string] $dirname) New-Item -ItemType Directory -Name $dirname && Set-Location $dirname }
|
||||||
function tc { param ( [string] $filename) New-Item $filename && code $filename }
|
function tc { param ( [string] $filename) New-Item $filename && code $filename }
|
||||||
function tv { param ( [string] $filename) New-Item $filename && nvim $filename }
|
function tv { param ( [string] $filename) New-Item $filename && nvim $filename }
|
||||||
function cdls { param( [string] $dirname) Set-Location $dirname && Get-ChildItem }
|
function cdls { param( [string] $dirname) Set-Location $dirname && Get-ChildItem }
|
||||||
function zls { param( [string] $dirname) z $dirname && Get-ChildItem }
|
function zls { param( [string] $dirname) z $dirname && Get-ChildItem }
|
||||||
function zl { param( [string] $dirname) z $dirname && lsd }
|
function zl { param( [string] $dirname) z $dirname && lsd }
|
||||||
function mt { param( [string] $dirname) New-Item -ItemType File -Name $dirname -Force }
|
function mt { param( [string] $dirname) New-Item -ItemType File -Name $dirname -Force }
|
||||||
|
|
||||||
|
|
||||||
### Dev ###
|
### Dev ###
|
||||||
|
|
||||||
# Python & Conda #
|
# Python & Conda #
|
||||||
Set-Alias "py" "python"
|
Set-Alias "py" "python"
|
||||||
Set-Alias "ipy" "ipython"
|
Set-Alias "ipy" "ipython"
|
||||||
|
|
||||||
if ($Env:WEZTERM) {
|
if ($Env:WEZTERM) {
|
||||||
# Environment variable injected by wezterm/wezterm.lua
|
# Environment variable injected by wezterm/wezterm.lua
|
||||||
${function:icat} = { wezterm imgcat $args }
|
${function:icat} = { wezterm imgcat $args }
|
||||||
}
|
}
|
||||||
elseif ($Env:KITTY) {
|
elseif ($Env:KITTY) {
|
||||||
${function:icat} = { kitty +kitten icat $args }
|
${function:icat} = { kitty +kitten icat $args }
|
||||||
}
|
}
|
||||||
|
|
@ -1,31 +1,31 @@
|
||||||
# aka PSReadLine
|
# aka PSReadLine
|
||||||
|
|
||||||
# read key: [System.Console]::ReadKey()
|
# read key: [System.Console]::ReadKey()
|
||||||
# get current bindings: Get-PSReadLineKeyHandler
|
# get current bindings: Get-PSReadLineKeyHandler
|
||||||
|
|
||||||
# PSReadLineOptions
|
# PSReadLineOptions
|
||||||
Set-PSReadLineOption -EditMode Vi # Vi Keybindings
|
Set-PSReadLineOption -EditMode Vi # Vi Keybindings
|
||||||
Set-PSReadLineOption -PredictionViewStyle InlineView
|
Set-PSReadLineOption -PredictionViewStyle InlineView
|
||||||
Set-PSReadLineOption -PredictionSource HistoryAndPlugin
|
Set-PSReadLineOption -PredictionSource HistoryAndPlugin
|
||||||
# Set-PSReadLineOption -ContinuationPrompt "`e[36m CR > " # Use Starship instead
|
# Set-PSReadLineOption -ContinuationPrompt "`e[36m CR > " # Use Starship instead
|
||||||
# PSReadLineKeyHandlers
|
# PSReadLineKeyHandlers
|
||||||
Set-PSReadLineKeyHandler -Chord "Control+Oem4" -Function ViCommandMode -ViMode Insert # ^[ to Escape
|
Set-PSReadLineKeyHandler -Chord "Control+Oem4" -Function ViCommandMode -ViMode Insert # ^[ to Escape
|
||||||
Set-PSReadLineKeyHandler -Chord "Ctrl+a" -Function BeginningOfLine
|
Set-PSReadLineKeyHandler -Chord "Ctrl+a" -Function BeginningOfLine
|
||||||
Set-PSReadLineKeyHandler -Chord "Ctrl+e" -Function EndOfLine
|
Set-PSReadLineKeyHandler -Chord "Ctrl+e" -Function EndOfLine
|
||||||
Set-PSReadLineKeyHandler -Chord "Ctrl+p" -Function PreviousHistory
|
Set-PSReadLineKeyHandler -Chord "Ctrl+p" -Function PreviousHistory
|
||||||
Set-PSReadLineKeyHandler -Chord "Ctrl+f" -Function AcceptNextSuggestionWord
|
Set-PSReadLineKeyHandler -Chord "Ctrl+f" -Function AcceptNextSuggestionWord
|
||||||
Set-PSReadLineKeyHandler -Chord "Alt+f" -Function AcceptSuggestion
|
Set-PSReadLineKeyHandler -Chord "Alt+f" -Function AcceptSuggestion
|
||||||
Set-PSReadLineKeyHandler -Chord "Ctrl+n" -Function NextHistory
|
Set-PSReadLineKeyHandler -Chord "Ctrl+n" -Function NextHistory
|
||||||
Set-PSReadLineKeyHandler -Chord "Ctrl+w" -Function BackwardKillWord
|
Set-PSReadLineKeyHandler -Chord "Ctrl+w" -Function BackwardKillWord
|
||||||
Set-PSReadLineKeyHandler -Chord "Ctrl+Backspace" -Function BackwardKillWord
|
Set-PSReadLineKeyHandler -Chord "Ctrl+Backspace" -Function BackwardKillWord
|
||||||
Set-PSReadLineKeyHandler -Chord "Ctrl+Shift+Backspace" -Function BackwardKillLine
|
Set-PSReadLineKeyHandler -Chord "Ctrl+Shift+Backspace" -Function BackwardKillLine
|
||||||
Set-PSReadLineKeyHandler -Chord "Alt+Backspace" -Function BackwardKillLine
|
Set-PSReadLineKeyHandler -Chord "Alt+Backspace" -Function BackwardKillLine
|
||||||
Set-PSReadLineKeyHandler -Chord "Ctrl+Delete" -Function KillWord
|
Set-PSReadLineKeyHandler -Chord "Ctrl+Delete" -Function KillWord
|
||||||
Set-PSReadLineKeyHandler -Chord "Ctrl+Shift+Delete" -Function KillLine
|
Set-PSReadLineKeyHandler -Chord "Ctrl+Shift+Delete" -Function KillLine
|
||||||
Set-PSReadLineKeyHandler -Chord "Alt+Delete" -Function KillLine
|
Set-PSReadLineKeyHandler -Chord "Alt+Delete" -Function KillLine
|
||||||
Set-PSReadLineKeyHandler -Chord "Ctrl+c" -Function CopyOrCancelLine -ViMode Insert
|
Set-PSReadLineKeyHandler -Chord "Ctrl+c" -Function CopyOrCancelLine -ViMode Insert
|
||||||
Set-PSReadLineKeyHandler -Chord "Ctrl+c" -Function CopyOrCancelLine -ViMode Command
|
Set-PSReadLineKeyHandler -Chord "Ctrl+c" -Function CopyOrCancelLine -ViMode Command
|
||||||
## Use <Tab> to Invoke MenuComplete
|
## Use <Tab> to Invoke MenuComplete
|
||||||
Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete
|
Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete
|
||||||
|
|
||||||
. $(Join-Path $DOTFILES "tools" "powershell" "Keymap" "Colemak.ps1")
|
. $(Join-Path $DOTFILES "tools" "powershell" "Keymap" "Colemak.ps1")
|
||||||
23
dot_config/powershell/Microsoft.PowerShell_profile.ps1
Normal file
23
dot_config/powershell/Microsoft.PowerShell_profile.ps1
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
# $XDG_CONFIG_HOME/powershell/Microsoft.PowerShell_profile.ps1
|
||||||
|
# ln -sf $DOTFILES/mac/Microsoft.PowerShell_profile.ps1 $XDG_CONFIG_HOME/powershell/Microsoft.PowerShell_profile.ps1
|
||||||
|
### Variables ###
|
||||||
|
|
||||||
|
$DOTFILES = "$HOME/.dotfiles"
|
||||||
|
|
||||||
|
### Load Configs ###
|
||||||
|
|
||||||
|
Get-ChildItem -Path $(Join-Path $DOTFILES "tools" "powershell") -Filter *.ps1 | ForEach-Object {. $_}
|
||||||
|
|
||||||
|
## Aliases ###
|
||||||
|
|
||||||
|
# PowerShell Equivalents #
|
||||||
|
|
||||||
|
# Set-Alias "curl" "Invoke-WebRequest"
|
||||||
|
# Set-Alias "man" "Get-Help"
|
||||||
|
Set-Alias "kill" "Stop-Process"
|
||||||
|
Set-Alias "open" "Invoke-Item" # Use ii instead of open
|
||||||
|
|
||||||
|
# Dev #
|
||||||
|
|
||||||
|
${function:zshcfg} = { nvim ~/.zshrc }
|
||||||
|
${function:bashcfg} = { nvim ~/.bashrc }
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
# Import-Module -Name Terminal-Icons
|
# Import-Module -Name Terminal-Icons
|
||||||
Import-Module -Name CompletionPredictor
|
Import-Module -Name CompletionPredictor
|
||||||
if ($IsWindows) {
|
if ($IsWindows) {
|
||||||
# Chocolatey
|
# Chocolatey
|
||||||
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
|
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
|
||||||
if (Test-Path($ChocolateyProfile)) { Import-Module "$ChocolateyProfile" }
|
if (Test-Path($ChocolateyProfile)) { Import-Module "$ChocolateyProfile" }
|
||||||
# WinGet
|
# WinGet
|
||||||
Import-Module -Name Microsoft.WinGet.CommandNotFound #f45873b3-b655-43a6-b217-97c00aa0db58
|
Import-Module -Name Microsoft.WinGet.CommandNotFound #f45873b3-b655-43a6-b217-97c00aa0db58
|
||||||
}
|
}
|
||||||
|
|
||||||
Import-Module -Name PSFzf
|
Import-Module -Name PSFzf
|
||||||
|
|
||||||
Set-PSReadLineKeyHandler -Chord "Ctrl-r" -ScriptBlock { Invoke-FuzzyHistory }
|
Set-PSReadLineKeyHandler -Chord "Ctrl-r" -ScriptBlock { Invoke-FuzzyHistory }
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
# ${function:~} = { Set-Location -Path ~ } cd is better
|
# ${function:~} = { Set-Location -Path ~ } cd is better
|
||||||
${function:...} = { Set-Location -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) }
|
${function:...} = { Set-Location -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) }
|
||||||
${function:....} = { Set-Location -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) -ChildPath ..) }
|
${function:....} = { Set-Location -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) -ChildPath ..) }
|
||||||
${function:.....} = { Set-Location -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) -ChildPath ..) -ChildPath ..) }
|
${function:.....} = { Set-Location -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) -ChildPath ..) -ChildPath ..) }
|
||||||
${function:......} = { Set-Location -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) -ChildPath ..) -ChildPath ..) -ChildPath ..) }
|
${function:......} = { Set-Location -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) -ChildPath ..) -ChildPath ..) -ChildPath ..) }
|
||||||
|
|
||||||
# Absolute navigation
|
# Absolute navigation
|
||||||
${function:docs} = { Set-Location -Path (Join-Path -Path $HOME -ChildPath "Documents") }
|
${function:docs} = { Set-Location -Path (Join-Path -Path $HOME -ChildPath "Documents") }
|
||||||
${function:down} = { Set-Location -Path (Join-Path -Path $HOME -ChildPath "Downloads") }
|
${function:down} = { Set-Location -Path (Join-Path -Path $HOME -ChildPath "Downloads") }
|
||||||
${function:dt} = { Set-Location -Path (Join-Path -Path $HOME -ChildPath "Desktop") }
|
${function:dt} = { Set-Location -Path (Join-Path -Path $HOME -ChildPath "Desktop") }
|
||||||
${function:one} = { Set-Location -Path (Join-Path -Path $HOME -ChildPath "OneDrive") }
|
${function:one} = { Set-Location -Path (Join-Path -Path $HOME -ChildPath "OneDrive") }
|
||||||
|
|
@ -1,144 +1,144 @@
|
||||||
# $DOTFILES/tools\powershell\Prompt.ps1
|
# $DOTFILES/tools\powershell\Prompt.ps1
|
||||||
# Date: 2024-12-01
|
# Date: 2024-12-01
|
||||||
# Author: js0ny
|
# Author: js0ny
|
||||||
# Use starship to set prompt
|
# Use starship to set prompt
|
||||||
|
|
||||||
# Invoke-Expression (&starship init powershell)
|
# Invoke-Expression (&starship init powershell)
|
||||||
|
|
||||||
|
|
||||||
function formatFG {
|
function formatFG {
|
||||||
param(
|
param(
|
||||||
[string]$RGB
|
[string]$RGB
|
||||||
)
|
)
|
||||||
if ($RGB -eq "-1") {
|
if ($RGB -eq "-1") {
|
||||||
return "`e[39m"
|
return "`e[39m"
|
||||||
}
|
}
|
||||||
$R = $RGB.Substring(0, 2)
|
$R = $RGB.Substring(0, 2)
|
||||||
$G = $RGB.Substring(2, 2)
|
$G = $RGB.Substring(2, 2)
|
||||||
$B = $RGB.Substring(4, 2)
|
$B = $RGB.Substring(4, 2)
|
||||||
# Convert hex to RGB
|
# Convert hex to RGB
|
||||||
$R = [int]::Parse($R, [System.Globalization.NumberStyles]::HexNumber)
|
$R = [int]::Parse($R, [System.Globalization.NumberStyles]::HexNumber)
|
||||||
$G = [int]::Parse($G, [System.Globalization.NumberStyles]::HexNumber)
|
$G = [int]::Parse($G, [System.Globalization.NumberStyles]::HexNumber)
|
||||||
$B = [int]::Parse($B, [System.Globalization.NumberStyles]::HexNumber)
|
$B = [int]::Parse($B, [System.Globalization.NumberStyles]::HexNumber)
|
||||||
return "`e[38;2;$R;$G;${B}m"
|
return "`e[38;2;$R;$G;${B}m"
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatBG {
|
function formatBG {
|
||||||
param(
|
param(
|
||||||
[string]$RGB
|
[string]$RGB
|
||||||
)
|
)
|
||||||
if ($RGB -eq "-1") {
|
if ($RGB -eq "-1") {
|
||||||
return "`e[49m"
|
return "`e[49m"
|
||||||
}
|
}
|
||||||
$R = $RGB.Substring(0, 2)
|
$R = $RGB.Substring(0, 2)
|
||||||
$G = $RGB.Substring(2, 2)
|
$G = $RGB.Substring(2, 2)
|
||||||
$B = $RGB.Substring(4, 2)
|
$B = $RGB.Substring(4, 2)
|
||||||
# Convert hex to RGB
|
# Convert hex to RGB
|
||||||
$R = [int]::Parse($R, [System.Globalization.NumberStyles]::HexNumber)
|
$R = [int]::Parse($R, [System.Globalization.NumberStyles]::HexNumber)
|
||||||
$G = [int]::Parse($G, [System.Globalization.NumberStyles]::HexNumber)
|
$G = [int]::Parse($G, [System.Globalization.NumberStyles]::HexNumber)
|
||||||
$B = [int]::Parse($B, [System.Globalization.NumberStyles]::HexNumber)
|
$B = [int]::Parse($B, [System.Globalization.NumberStyles]::HexNumber)
|
||||||
return "`e[48;2;$R;$G;${B}m"
|
return "`e[48;2;$R;$G;${B}m"
|
||||||
}
|
}
|
||||||
function formatPowerlineText {
|
function formatPowerlineText {
|
||||||
param(
|
param(
|
||||||
[string]$FG,
|
[string]$FG,
|
||||||
[string]$BG,
|
[string]$BG,
|
||||||
[string]$PLBG,
|
[string]$PLBG,
|
||||||
[string]$Text
|
[string]$Text
|
||||||
)
|
)
|
||||||
$ResumeSequece = "`e[0m"
|
$ResumeSequece = "`e[0m"
|
||||||
$TextFG = formatFG -RGB $FG
|
$TextFG = formatFG -RGB $FG
|
||||||
$TextBG = formatBG -RGB $BG
|
$TextBG = formatBG -RGB $BG
|
||||||
$PLFG = formatFG -RGB $BG
|
$PLFG = formatFG -RGB $BG
|
||||||
$PLBG = formatBG -RGB $PLBG
|
$PLBG = formatBG -RGB $PLBG
|
||||||
return "$TextFG$TextBG $Text $PLFG$PLBG$ResumeSequece"
|
return "$TextFG$TextBG $Text $PLFG$PLBG$ResumeSequece"
|
||||||
}
|
}
|
||||||
|
|
||||||
function prompt {
|
function prompt {
|
||||||
if ($pwd.Path -eq $HOME) {
|
if ($pwd.Path -eq $HOME) {
|
||||||
$cwd = "~"
|
$cwd = "~"
|
||||||
} else {
|
} else {
|
||||||
$cwd = $pwd.ProviderPath
|
$cwd = $pwd.ProviderPath
|
||||||
}
|
}
|
||||||
$time = Get-Date -Format "HH:mm"
|
$time = Get-Date -Format "HH:mm"
|
||||||
$ResumeSequece = "`e[0m"
|
$ResumeSequece = "`e[0m"
|
||||||
$FG0 = "FFFFFF"
|
$FG0 = "FFFFFF"
|
||||||
$BG0 = "9A348E"
|
$BG0 = "9A348E"
|
||||||
$BG1 = "DA627D"
|
$BG1 = "DA627D"
|
||||||
$BG2 = "FCA17D"
|
$BG2 = "FCA17D"
|
||||||
$FG1 = "035E82"
|
$FG1 = "035E82"
|
||||||
$time = formatPowerlineText $FG0 $BG0 $BG1 $time
|
$time = formatPowerlineText $FG0 $BG0 $BG1 $time
|
||||||
$cwd = formatPowerlineText $FG0 $BG1 $BG2 $cwd
|
$cwd = formatPowerlineText $FG0 $BG1 $BG2 $cwd
|
||||||
$ps = formatPowerlineText $FG1 $BG2 "-1" "PS"
|
$ps = formatPowerlineText $FG1 $BG2 "-1" "PS"
|
||||||
|
|
||||||
"$time$cwd$ps$ResumeSequece "
|
"$time$cwd$ps$ResumeSequece "
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function Invoke-Starship {
|
function Invoke-Starship {
|
||||||
Invoke-Expression (&starship init powershell)
|
Invoke-Expression (&starship init powershell)
|
||||||
}
|
}
|
||||||
|
|
||||||
Import-Module Catppuccin
|
Import-Module Catppuccin
|
||||||
|
|
||||||
$Flavor = $Catppuccin['Mocha']
|
$Flavor = $Catppuccin['Mocha']
|
||||||
|
|
||||||
# The following colors are used by PowerShell's formatting
|
# The following colors are used by PowerShell's formatting
|
||||||
# Again PS 7.2+ only
|
# Again PS 7.2+ only
|
||||||
$PSStyle.Formatting.Debug = $Flavor.Sky.Foreground()
|
$PSStyle.Formatting.Debug = $Flavor.Sky.Foreground()
|
||||||
$PSStyle.Formatting.Error = $Flavor.Red.Foreground()
|
$PSStyle.Formatting.Error = $Flavor.Red.Foreground()
|
||||||
$PSStyle.Formatting.ErrorAccent = $Flavor.Blue.Foreground()
|
$PSStyle.Formatting.ErrorAccent = $Flavor.Blue.Foreground()
|
||||||
$PSStyle.Formatting.FormatAccent = $Flavor.Teal.Foreground()
|
$PSStyle.Formatting.FormatAccent = $Flavor.Teal.Foreground()
|
||||||
$PSStyle.Formatting.TableHeader = $Flavor.Rosewater.Foreground()
|
$PSStyle.Formatting.TableHeader = $Flavor.Rosewater.Foreground()
|
||||||
$PSStyle.Formatting.Verbose = $Flavor.Yellow.Foreground()
|
$PSStyle.Formatting.Verbose = $Flavor.Yellow.Foreground()
|
||||||
$PSStyle.Formatting.Warning = $Flavor.Peach.Foreground()
|
$PSStyle.Formatting.Warning = $Flavor.Peach.Foreground()
|
||||||
|
|
||||||
$Colors = @{
|
$Colors = @{
|
||||||
# Largely based on the Code Editor style guide
|
# Largely based on the Code Editor style guide
|
||||||
# Emphasis, ListPrediction and ListPredictionSelected are inspired by the Catppuccin fzf theme
|
# Emphasis, ListPrediction and ListPredictionSelected are inspired by the Catppuccin fzf theme
|
||||||
|
|
||||||
# Powershell colours
|
# Powershell colours
|
||||||
Emphasis = $Flavor.Red.Foreground()
|
Emphasis = $Flavor.Red.Foreground()
|
||||||
Selection = $Flavor.Surface0.Background()
|
Selection = $Flavor.Surface0.Background()
|
||||||
|
|
||||||
# PSReadLine prediction colours
|
# PSReadLine prediction colours
|
||||||
InlinePrediction = $Flavor.Overlay0.Foreground()
|
InlinePrediction = $Flavor.Overlay0.Foreground()
|
||||||
ListPrediction = $Flavor.Mauve.Foreground()
|
ListPrediction = $Flavor.Mauve.Foreground()
|
||||||
ListPredictionSelected = $Flavor.Surface0.Background()
|
ListPredictionSelected = $Flavor.Surface0.Background()
|
||||||
|
|
||||||
# Syntax highlighting
|
# Syntax highlighting
|
||||||
Command = $Flavor.Blue.Foreground()
|
Command = $Flavor.Blue.Foreground()
|
||||||
Comment = $Flavor.Overlay0.Foreground()
|
Comment = $Flavor.Overlay0.Foreground()
|
||||||
Default = $Flavor.Text.Foreground()
|
Default = $Flavor.Text.Foreground()
|
||||||
Error = $Flavor.Red.Foreground()
|
Error = $Flavor.Red.Foreground()
|
||||||
Keyword = $Flavor.Mauve.Foreground()
|
Keyword = $Flavor.Mauve.Foreground()
|
||||||
Member = $Flavor.Rosewater.Foreground()
|
Member = $Flavor.Rosewater.Foreground()
|
||||||
Number = $Flavor.Peach.Foreground()
|
Number = $Flavor.Peach.Foreground()
|
||||||
Operator = $Flavor.Sky.Foreground()
|
Operator = $Flavor.Sky.Foreground()
|
||||||
Parameter = $Flavor.Pink.Foreground()
|
Parameter = $Flavor.Pink.Foreground()
|
||||||
String = $Flavor.Green.Foreground()
|
String = $Flavor.Green.Foreground()
|
||||||
Type = $Flavor.Yellow.Foreground()
|
Type = $Flavor.Yellow.Foreground()
|
||||||
Variable = $Flavor.Lavender.Foreground()
|
Variable = $Flavor.Lavender.Foreground()
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set the colours
|
# Set the colours
|
||||||
Set-PSReadLineOption -Colors $Colors
|
Set-PSReadLineOption -Colors $Colors
|
||||||
|
|
||||||
# Smarter cd
|
# Smarter cd
|
||||||
# Init zoxide apter starship to avoid conflicts
|
# Init zoxide apter starship to avoid conflicts
|
||||||
# https://github.com/ajeetdsouza/zoxide/issues/723
|
# https://github.com/ajeetdsouza/zoxide/issues/723
|
||||||
if (Get-Command zoxide -ErrorAction SilentlyContinue) {
|
if (Get-Command zoxide -ErrorAction SilentlyContinue) {
|
||||||
Invoke-Expression (& { (zoxide init powershell | Out-String) })
|
Invoke-Expression (& { (zoxide init powershell | Out-String) })
|
||||||
${function:...} = { z -Path (Join-Path -Path .. -ChildPath ..) }
|
${function:...} = { z -Path (Join-Path -Path .. -ChildPath ..) }
|
||||||
${function:....} = { z -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) }
|
${function:....} = { z -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) }
|
||||||
${function:.....} = { z -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) -ChildPath ..) }
|
${function:.....} = { z -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) -ChildPath ..) }
|
||||||
${function:......} = { z -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) -ChildPath ..) -ChildPath ..) }
|
${function:......} = { z -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) -ChildPath ..) -ChildPath ..) }
|
||||||
${function:z-} = { z - }
|
${function:z-} = { z - }
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
${function:...} = { Set-Location -Path (Join-Path -Path .. -ChildPath ..) }
|
${function:...} = { Set-Location -Path (Join-Path -Path .. -ChildPath ..) }
|
||||||
${function:....} = { Set-Location -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) }
|
${function:....} = { Set-Location -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) }
|
||||||
${function:.....} = { Set-Location -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) -ChildPath ..) }
|
${function:.....} = { Set-Location -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) -ChildPath ..) }
|
||||||
${function:......} = { Set-Location -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) -ChildPath ..) -ChildPath ..) }
|
${function:......} = { Set-Location -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path (Join-Path -Path .. -ChildPath ..) -ChildPath ..) -ChildPath ..) -ChildPath ..) }
|
||||||
${function:z-} = { Set-Location - }
|
${function:z-} = { Set-Location - }
|
||||||
}
|
}
|
||||||
|
|
@ -1,39 +1,39 @@
|
||||||
# PowerShell Profile
|
# PowerShell Profile
|
||||||
|
|
||||||
This is the cross-platform PowerShell profile for PowerShell Core
|
This is the cross-platform PowerShell profile for PowerShell Core
|
||||||
|
|
||||||
```text
|
```text
|
||||||
.
|
.
|
||||||
├── Aliases.ps1
|
├── Aliases.ps1
|
||||||
├── Keymap.ps1 # keymaps, optimize for Vi-Mode and Colemak
|
├── Keymap.ps1 # keymaps, optimize for Vi-Mode and Colemak
|
||||||
├── Modules.ps1
|
├── Modules.ps1
|
||||||
├── Navigation.ps1
|
├── Navigation.ps1
|
||||||
├── Prompt.ps1
|
├── Prompt.ps1
|
||||||
├── readme.md
|
├── readme.md
|
||||||
└── Scripts.ps1
|
└── Scripts.ps1
|
||||||
|
|
||||||
1 directory, 7 files
|
1 directory, 7 files
|
||||||
```
|
```
|
||||||
|
|
||||||
| Keymap | Action | Mode |
|
| Keymap | Action | Mode |
|
||||||
| ------ | -------------------- | ------ |
|
| ------ | -------------------- | ------ |
|
||||||
| `^a` | To Beginning of Line | All |
|
| `^a` | To Beginning of Line | All |
|
||||||
| `^e` | To End of Line | All |
|
| `^e` | To End of Line | All |
|
||||||
| `^[` | To Normal Mode | Insert |
|
| `^[` | To Normal Mode | Insert |
|
||||||
|
|
||||||
## `Get-Command` vs `which.exe` under Windows
|
## `Get-Command` vs `which.exe` under Windows
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
PS > hyperfine "pwsh.exe -NoProfile -Command 'Get-Command which'" "pwsh.exe -NoProfile -Command 'which which'" --warmup 10
|
PS > hyperfine "pwsh.exe -NoProfile -Command 'Get-Command which'" "pwsh.exe -NoProfile -Command 'which which'" --warmup 10
|
||||||
Benchmark 1: pwsh.exe -NoProfile -Command 'Get-Command which'
|
Benchmark 1: pwsh.exe -NoProfile -Command 'Get-Command which'
|
||||||
Time (mean ± σ): 152.1 ms ± 1.3 ms [User: 112.2 ms, System: 89.3 ms]
|
Time (mean ± σ): 152.1 ms ± 1.3 ms [User: 112.2 ms, System: 89.3 ms]
|
||||||
Range (min … max): 150.0 ms … 155.3 ms 18 runs
|
Range (min … max): 150.0 ms … 155.3 ms 18 runs
|
||||||
|
|
||||||
Benchmark 2: pwsh.exe -NoProfile -Command 'which which'
|
Benchmark 2: pwsh.exe -NoProfile -Command 'which which'
|
||||||
Time (mean ± σ): 153.7 ms ± 6.4 ms [User: 126.7 ms, System: 101.9 ms]
|
Time (mean ± σ): 153.7 ms ± 6.4 ms [User: 126.7 ms, System: 101.9 ms]
|
||||||
Range (min … max): 147.8 ms … 169.5 ms 19 runs
|
Range (min … max): 147.8 ms … 169.5 ms 19 runs
|
||||||
|
|
||||||
Summary
|
Summary
|
||||||
pwsh.exe -NoProfile -Command 'Get-Command which' ran
|
pwsh.exe -NoProfile -Command 'Get-Command which' ran
|
||||||
1.01 ± 0.04 times faster than pwsh.exe -NoProfile -Command 'which which'
|
1.01 ± 0.04 times faster than pwsh.exe -NoProfile -Command 'which which'
|
||||||
```
|
```
|
||||||
1
dot_config/powershell/xaa
Normal file
1
dot_config/powershell/xaa
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
/home/js0ny/.local/share/powershell/Modules:/usr/local/share/powershell/Modules:/opt/microsoft/powershell/7/Modules
|
||||||
6
scripts/run_once_powershell.ps1
Normal file
6
scripts/run_once_powershell.ps1
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env pwsh
|
||||||
|
|
||||||
|
Install-Package PSFzf -Force
|
||||||
|
Install-Package CompletionPredictor -Force
|
||||||
|
|
||||||
|
git clone --depth 1 https://github.com/catppuccin/powershell.git (Join-Path $Env:PSModulePath.Split(':')[0] Catppuccin)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue