-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpsreadline.ps1.tmpl
More file actions
42 lines (36 loc) · 1.29 KB
/
psreadline.ps1.tmpl
File metadata and controls
42 lines (36 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{{- if (or (eq .chezmoi.os "windows") (eq .chezmoi.os "darwin")) -}}
<#
.SYNOPSIS
PSReadLine configuration for enhanced command line experience
.DESCRIPTION
Configures PSReadLine with improved prediction, history, and key bindings
.NOTES
Author: Patrick Lewis
Requires: PSReadLine module
#>
if (Get-Module -Name PSReadLine) {
# Configure prediction view style
Set-PSReadLineOption -PredictionViewStyle ListView
# Configure history settings
Set-PSReadLineOption -HistorySearchCursorMovesToEnd
Set-PSReadLineOption -MaximumHistoryCount 4000
# Configure editing mode and key bindings
Set-PSReadLineOption -EditMode Windows
# Set colors for better visibility
Set-PSReadLineOption -Colors @{
Command = 'Cyan'
Parameter = 'Green'
Operator = 'Magenta'
Variable = 'Yellow'
String = 'Blue'
Number = 'Red'
Type = 'DarkCyan'
Comment = 'DarkGreen'
}
# Key bindings for enhanced navigation
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
# Ctrl+D to exit PowerShell (like bash)
Set-PSReadLineKeyHandler -Key Ctrl+d -Function DeleteCharOrExit
}
{{- end }}