From 66408cb4eb97ea0c8845317133c41b9088f39859 Mon Sep 17 00:00:00 2001 From: Matt Rixman Date: Sun, 8 May 2022 22:54:56 -0600 Subject: [PATCH] added a configurable default mode so we don't have to start in INSERT --- src/prompt_toolkit/key_binding/vi_state.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/prompt_toolkit/key_binding/vi_state.py b/src/prompt_toolkit/key_binding/vi_state.py index 10593a82e..49de6fe2a 100644 --- a/src/prompt_toolkit/key_binding/vi_state.py +++ b/src/prompt_toolkit/key_binding/vi_state.py @@ -55,6 +55,9 @@ def __init__(self) -> None: #: The Vi mode we're currently in to. self.__input_mode = InputMode.INSERT + #: The Vi mode that gets applied when reset() is called + self.default_input_mode = InputMode.INSERT + #: Waiting for digraph. self.waiting_for_digraph = False self.digraph_symbol1: Optional[str] = None # (None or a symbol.) @@ -96,7 +99,7 @@ def reset(self) -> None: Reset state, go back to the given mode. INSERT by default. """ # Go back to insert mode. - self.input_mode = InputMode.INSERT + self.input_mode = self.default_input_mode self.waiting_for_digraph = False self.operator_func = None