Skip to content

Commit 7e53c87

Browse files
authored
Update key bindings in sample and doc now that 'Shift' is inferred (#1248)
1 parent 7984b6e commit 7e53c87

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

PSReadLine/PlatformWindows.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ internal static bool IsUsingRasterFont()
127127
var handle = _outputHandle.Value.DangerousGetHandle();
128128
var fontInfo = new CONSOLE_FONT_INFO_EX { cbSize = Marshal.SizeOf(typeof(CONSOLE_FONT_INFO_EX)) };
129129
bool result = GetCurrentConsoleFontEx(handle, false, ref fontInfo);
130-
// From https://docs.microsoft.com/en-us/windows/desktop/api/wingdi/ns-wingdi-tagtextmetrica
130+
// From https://docs.microsoft.com/windows/win32/api/wingdi/ns-wingdi-textmetrica
131131
// tmPitchAndFamily - A monospace bitmap font has all of these low-order bits clear;
132132
return result && (fontInfo.FontFamily & FontFamily.LOWORDER_BITS) == 0;
133133
}

PSReadLine/SamplePSReadLineProfile.ps1

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Set-PSReadLineKeyHandler -Key F7 `
7979

8080
# This is an example of a macro that you might use to execute a command.
8181
# This will add the command to history.
82-
Set-PSReadLineKeyHandler -Key Ctrl+B `
82+
Set-PSReadLineKeyHandler -Key Ctrl+b `
8383
-BriefDescription BuildCurrentDirectory `
8484
-LongDescription "Build the current directory" `
8585
-ScriptBlock {
@@ -90,27 +90,27 @@ Set-PSReadLineKeyHandler -Key Ctrl+B `
9090

9191
# In Emacs mode - Tab acts like in bash, but the Windows style completion
9292
# is still useful sometimes, so bind some keys so we can do both
93-
Set-PSReadLineKeyHandler -Key Ctrl+Q -Function TabCompleteNext
94-
Set-PSReadLineKeyHandler -Key Ctrl+Shift+Q -Function TabCompletePrevious
93+
Set-PSReadLineKeyHandler -Key Ctrl+q -Function TabCompleteNext
94+
Set-PSReadLineKeyHandler -Key Ctrl+Q -Function TabCompletePrevious
9595

9696
# Clipboard interaction is bound by default in Windows mode, but not Emacs mode.
97-
Set-PSReadLineKeyHandler -Key Shift+Ctrl+C -Function Copy
98-
Set-PSReadLineKeyHandler -Key Ctrl+V -Function Paste
97+
Set-PSReadLineKeyHandler -Key Ctrl+C -Function Copy
98+
Set-PSReadLineKeyHandler -Key Ctrl+v -Function Paste
9999

100100
# CaptureScreen is good for blog posts or email showing a transaction
101101
# of what you did when asking for help or demonstrating a technique.
102-
Set-PSReadLineKeyHandler -Chord 'Ctrl+D,Ctrl+C' -Function CaptureScreen
102+
Set-PSReadLineKeyHandler -Chord 'Ctrl+d,Ctrl+c' -Function CaptureScreen
103103

104104
# The built-in word movement uses character delimiters, but token based word
105105
# movement is also very useful - these are the bindings you'd use if you
106106
# prefer the token based movements bound to the normal emacs word movement
107107
# key bindings.
108-
Set-PSReadLineKeyHandler -Key Alt+D -Function ShellKillWord
108+
Set-PSReadLineKeyHandler -Key Alt+d -Function ShellKillWord
109109
Set-PSReadLineKeyHandler -Key Alt+Backspace -Function ShellBackwardKillWord
110-
Set-PSReadLineKeyHandler -Key Alt+B -Function ShellBackwardWord
111-
Set-PSReadLineKeyHandler -Key Alt+F -Function ShellForwardWord
112-
Set-PSReadLineKeyHandler -Key Shift+Alt+B -Function SelectShellBackwardWord
113-
Set-PSReadLineKeyHandler -Key Shift+Alt+F -Function SelectShellForwardWord
110+
Set-PSReadLineKeyHandler -Key Alt+b -Function ShellBackwardWord
111+
Set-PSReadLineKeyHandler -Key Alt+f -Function ShellForwardWord
112+
Set-PSReadLineKeyHandler -Key Alt+B -Function SelectShellBackwardWord
113+
Set-PSReadLineKeyHandler -Key Alt+F -Function SelectShellForwardWord
114114

115115
#region Smart Insert/Delete
116116

@@ -310,7 +310,7 @@ Set-PSReadLineKeyHandler -Key Alt+w `
310310
}
311311

312312
# Insert text from the clipboard as a here string
313-
Set-PSReadLineKeyHandler -Key Ctrl+Shift+v `
313+
Set-PSReadLineKeyHandler -Key Ctrl+V `
314314
-BriefDescription PasteAsHereString `
315315
-LongDescription "Paste the clipboard text as a here string" `
316316
-ScriptBlock {
@@ -509,7 +509,7 @@ Set-PSReadLineKeyHandler -Key F1 `
509509
#
510510
$global:PSReadLineMarks = @{}
511511

512-
Set-PSReadLineKeyHandler -Key Ctrl+Shift+j `
512+
Set-PSReadLineKeyHandler -Key Ctrl+J `
513513
-BriefDescription MarkDirectory `
514514
-LongDescription "Mark the current directory" `
515515
-ScriptBlock {

docs/Set-PSReadLineKeyHandler.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ This command binds the up arrow key to the function HistorySearchBackward which
4444
### -------------- Example 2 --------------
4545

4646
```
47-
PS C:\> Set-PSReadLineKeyHandler -Chord Shift+Ctrl+B -ScriptBlock {
47+
PS C:\> Set-PSReadLineKeyHandler -Chord Ctrl+B -ScriptBlock {
4848
>> [Microsoft.PowerShell.PSConsoleReadLine]::RevertLine()
4949
>> [Microsoft.PowerShell.PSConsoleReadLine]::Insert('msbuild')
5050
>> [Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine()
5151
}
5252
```
5353

54-
This example binds the key Ctrl+Shift+B to a script block that clears the line, inserts build, then accepts the line.
54+
This example binds the key Ctrl+Shift+b to a script block that clears the line, inserts build, then accepts the line.
5555
This example shows how a single key can be used to execute a command.
5656

5757
## PARAMETERS

0 commit comments

Comments
 (0)