mpga/mods/readline.ps1

28 lines
954 B
PowerShell
Raw Normal View History

2020-01-21 14:03:41 +00:00
# Set better CTRL bindings
Set-PSReadlineOption -EditMode Emacs
Set-PSReadlineKeyHandler "Ctrl+Delete" KillWord
Set-PSReadlineKeyHandler "Ctrl+Backspace" BackwardKillWord
Set-PSReadlineKeyHandler "Ctrl+LeftArrow" BackwardWord
Set-PSReadlineKeyHandler "Ctrl+RightArrow" NextWord
# Set the autocomplete handler to a menu one, similar to how ZSH does it
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
# Work around an RS5/PSReadline-2.0.0+beta2 bug (Spacebar is not marked Vital)
Set-PSReadlineKeyHandler "Shift+SpaceBar" -ScriptBlock {
[Microsoft.Powershell.PSConsoleReadLine]::Insert(' ')
}
# Syntax highlighting!
If ($PSEdition -eq "Core") {
Set-PSReadlineOption -Colors @{
Type = "`e[38;5;85m";
String = "`e[38;5;130m";
Number = "`e[38;5;220m";
Variable = "`e[38;5;191m";
Command = "`e[38;5;117m";
Operator = "`e[38;5;213m";
Parameter = "`e[38;5;239m";
}
}