Skip to content

Commit 243ee8c

Browse files
Compatibility with latest prompt toolkit refactorings.
1 parent 3890dce commit 243ee8c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

pyvim/key_bindings.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
from __future__ import unicode_literals
22

3-
from prompt_toolkit.filters import Condition, HasFocus, Filter, InViMode
3+
from prompt_toolkit.filters import Condition, HasFocus, Filter, ViInsertMode, ViNavigationMode
44
from prompt_toolkit.key_binding.bindings.utils import create_handle_decorator
55
from prompt_toolkit.key_binding.manager import KeyBindingManager
6-
from prompt_toolkit.key_binding.vi_state import InputMode
76
from prompt_toolkit.keys import Keys
87
from prompt_toolkit.layout.utils import find_window_for_buffer_name
98

@@ -38,8 +37,8 @@ def create_key_bindings(editor):
3837
# Filters.
3938
vi_buffer_focussed = Condition(lambda cli: cli.current_buffer_name.startswith('buffer-'))
4039

41-
in_insert_mode = InViMode(InputMode.INSERT) & vi_buffer_focussed
42-
in_navigation_mode = InViMode(InputMode.NAVIGATION) & vi_buffer_focussed
40+
in_insert_mode = ViInsertMode() & vi_buffer_focussed
41+
in_navigation_mode = ViNavigationMode() & vi_buffer_focussed
4342

4443
# Decorator.
4544
handle = create_handle_decorator(manager.registry)
@@ -87,7 +86,7 @@ def enter_command_mode(event):
8786
"""
8887
editor.enter_command_mode()
8988

90-
@handle(Keys.Tab, filter=InViMode(InputMode.INSERT) &
89+
@handle(Keys.Tab, filter=ViInsertMode() &
9190
~HasFocus(COMMAND_BUFFER) & WhitespaceBeforeCursorOnLine())
9291
def autocomplete_or_indent(event):
9392
"""

0 commit comments

Comments
 (0)