From a2a409d7adf64f41f8ac2d49219ef30c330f9683 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 25 May 2020 22:46:13 -0700 Subject: [PATCH] Expose 'ViBackwardChar' and 'ViForwardChar' as bindable functions (#1547) --- PSReadLine/KeyBindings.cs | 2 ++ PSReadLine/Movement.cs | 4 ++-- PSReadLine/PSReadLineResources.resx | 6 ++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/PSReadLine/KeyBindings.cs b/PSReadLine/KeyBindings.cs index b60b018..16cf72b 100644 --- a/PSReadLine/KeyBindings.cs +++ b/PSReadLine/KeyBindings.cs @@ -502,7 +502,9 @@ namespace Microsoft.PowerShell case nameof(ShellBackwardWord): case nameof(ShellForwardWord): case nameof(ShellNextWord): + case nameof(ViBackwardChar): case nameof(ViBackwardWord): + case nameof(ViForwardChar): case nameof(ViEndOfGlob): case nameof(ViEndOfPreviousGlob): case nameof(ViGotoBrace): diff --git a/PSReadLine/Movement.cs b/PSReadLine/Movement.cs index e7861b7..cb27c1e 100644 --- a/PSReadLine/Movement.cs +++ b/PSReadLine/Movement.cs @@ -87,7 +87,7 @@ namespace Microsoft.PowerShell /// /// Moves the cursor one character to the right on a single logical line. /// - private static void ViForwardChar(ConsoleKeyInfo? key = null, object arg = null) + public static void ViForwardChar(ConsoleKeyInfo? key = null, object arg = null) { if (TryGetArgAsInt(arg, out var numericArg, 1)) { @@ -105,7 +105,7 @@ namespace Microsoft.PowerShell /// /// Move the cursor one character to the left on a single logical line. /// - private static void ViBackwardChar(ConsoleKeyInfo? key = null, object arg = null) + public static void ViBackwardChar(ConsoleKeyInfo? key = null, object arg = null) { if (TryGetArgAsInt(arg, out var numericArg, 1)) { diff --git a/PSReadLine/PSReadLineResources.resx b/PSReadLine/PSReadLineResources.resx index e6f2d71..f330b44 100644 --- a/PSReadLine/PSReadLineResources.resx +++ b/PSReadLine/PSReadLineResources.resx @@ -591,6 +591,12 @@ If there are other parse errors, unresolved commands, or incorrect parameters, s Delete backward to the beginning of the previous word, as delimited by white space and common delimiters, and enter insert mode. + + Move the cursor back one character in the Vi edit mode. + + + Move the cursor forward one character in the Vi edit mode. + Write the contents of the local clipboard after the cursor.