2022-09-11 17:22:45 +02:00
|
|
|
using namespace System.Management.Automation
|
2022-02-26 10:33:50 +01:00
|
|
|
|
2021-12-05 16:12:47 +01:00
|
|
|
Import-Module PSReadLine
|
|
|
|
|
2022-09-17 09:43:53 +02:00
|
|
|
# Setting up PATH
|
|
|
|
$env:Path = "$HOME/Bin/system/;" + "$env:Path"
|
2022-09-23 16:10:20 +02:00
|
|
|
$env:Path = "$HOME/Bin/custom/;" + "$env:Path"
|
2022-09-17 09:43:53 +02:00
|
|
|
|
2021-12-05 16:12:47 +01:00
|
|
|
$versionMinimum = [Version]'7.1.999'
|
|
|
|
|
|
|
|
if (($Host.Name -eq 'ConsoleHost') -and ($PSVersionTable.PSVersion -ge $versionMinimum))
|
|
|
|
{
|
|
|
|
Set-PSReadLineOption -PredictionSource HistoryAndPlugin
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Set-PSReadLineOption -PredictionSource History
|
|
|
|
}
|
|
|
|
|
|
|
|
Set-PSReadLineOption -HistorySearchCursorMovesToEnd
|
|
|
|
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
|
|
|
|
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
|
|
|
|
Set-PSReadLineOption -PredictionViewStyle ListView
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2023-01-20 14:21:50 +01:00
|
|
|
$OnViModeChange = [scriptblock]{
|
|
|
|
if ($args[0] -eq 'Command') {
|
|
|
|
# Set the cursor to a blinking block.
|
|
|
|
Write-Host -NoNewLine "`e[1 q"
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
# Set the cursor to a blinking line.
|
|
|
|
Write-Host -NoNewLine "`e[5 q"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Set-PsReadLineOption -EditMode Vi # -ViModeIndicator Cursor
|
|
|
|
Set-PSReadLineOption -ViModeIndicator Script -ViModeChangeHandler $OnViModeChange
|
|
|
|
|
|
|
|
# Get fzf on drugs
|
|
|
|
Import-Module PSFzf
|
|
|
|
|
|
|
|
# replace 'Ctrl+t' and 'Ctrl+r' with your preferred bindings:
|
|
|
|
Set-PsFzfOption -PSReadlineChordProvider 'Ctrl+t' -PSReadlineChordReverseHistory 'Ctrl+r'
|
|
|
|
Set-PsFzfOption -EnableAliasFuzzyScoop -EnableAliasFuzzyKillProcess
|
|
|
|
|
2021-12-05 16:12:47 +01:00
|
|
|
# Chocolatey profile
|
|
|
|
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
|
|
|
|
if (Test-Path($ChocolateyProfile)) {
|
|
|
|
Import-Module "$ChocolateyProfile"
|
|
|
|
}
|
|
|
|
|
2022-09-17 09:43:53 +02:00
|
|
|
function dl {
|
2022-02-26 10:33:50 +01:00
|
|
|
Set-Location ~\Downloads
|
2021-12-05 16:12:47 +01:00
|
|
|
aria2c -j 16 -s 16 -x 16 -k 5M --file-allocation=none $args[0]
|
|
|
|
}
|
|
|
|
|
2023-01-20 14:21:50 +01:00
|
|
|
function ls_pretty {
|
|
|
|
lsd -1 $args
|
|
|
|
}
|
|
|
|
|
|
|
|
function profile {
|
|
|
|
nvim C:\Users\Crony\Documents\Repos\win-scipts\profile.ps1
|
|
|
|
}
|
|
|
|
|
2022-09-17 09:43:53 +02:00
|
|
|
New-Alias vi nvim-qt.exe
|
2023-01-20 14:21:50 +01:00
|
|
|
# Remove-Alias ls
|
|
|
|
# New-Alias ls ls_pretty
|
2022-09-17 09:43:53 +02:00
|
|
|
|
|
|
|
Invoke-Expression (&starship init powershell)
|