Add ViClipboardMode Option · PowerShell/PSReadLine@585d2c2 · GitHub
Skip to content

Commit 585d2c2

Browse files
committed
Add ViClipboardMode Option
This option allows the user to choose if they want the ViRegister to use the system clipboard or the default local clipboard. By setting ViClipboardMode to SystemClipboard, the user can easily copy and paste text in the PowerShell prompt using Vi shortcuts in Command mode.
1 parent e5537d8 commit 585d2c2

4 files changed

Lines changed: 65 additions & 12 deletions

File tree

‎PSReadLine/Cmdlets.cs‎

Lines changed: 19 additions & 0 deletions

‎PSReadLine/Options.cs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ private void SetOptionsInternal(SetPSReadLineOption options)
120120
}
121121
Options.ViModeChangeHandler = options.ViModeChangeHandler;
122122
}
123+
if (options._viClipboardMode.HasValue)
124+
{
125+
Options.ViClipboardMode = options.ViClipboardMode;
126+
}
123127
if (options.HistorySavePath != null)
124128
{
125129
Options.HistorySavePath = options.HistorySavePath;

‎PSReadLine/PSReadLine.format.ps1xml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ $d = [Microsoft.PowerShell.KeyHandler]::GetGroupingDescription($_.Group)
152152
<ItemSelectionCondition><ScriptBlock>$null -ne $_.ViModeChangeHandler</ScriptBlock></ItemSelectionCondition>
153153
<PropertyName>ViModeChangeHandler</PropertyName>
154154
</ListItem>
155+
<ListItem>
156+
<PropertyName>ViClipboardMode</PropertyName>
157+
</ListItem>
155158
<ListItem>
156159
<PropertyName>WordDelimiters</PropertyName>
157160
</ListItem>

‎PSReadLine/ViRegister.cs‎

Lines changed: 39 additions & 12 deletions

0 commit comments

Comments
 (0)