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