|
1 | 1 | from __future__ import unicode_literals |
2 | 2 |
|
3 | | -from prompt_toolkit.filters import Condition, HasFocus, Filter, InViMode |
| 3 | +from prompt_toolkit.filters import Condition, HasFocus, Filter, ViInsertMode, ViNavigationMode |
4 | 4 | from prompt_toolkit.key_binding.bindings.utils import create_handle_decorator |
5 | 5 | from prompt_toolkit.key_binding.manager import KeyBindingManager |
6 | | -from prompt_toolkit.key_binding.vi_state import InputMode |
7 | 6 | from prompt_toolkit.keys import Keys |
8 | 7 | from prompt_toolkit.layout.utils import find_window_for_buffer_name |
9 | 8 |
|
@@ -38,8 +37,8 @@ def create_key_bindings(editor): |
38 | 37 | # Filters. |
39 | 38 | vi_buffer_focussed = Condition(lambda cli: cli.current_buffer_name.startswith('buffer-')) |
40 | 39 |
|
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 |
43 | 42 |
|
44 | 43 | # Decorator. |
45 | 44 | handle = create_handle_decorator(manager.registry) |
@@ -87,7 +86,7 @@ def enter_command_mode(event): |
87 | 86 | """ |
88 | 87 | editor.enter_command_mode() |
89 | 88 |
|
90 | | - @handle(Keys.Tab, filter=InViMode(InputMode.INSERT) & |
| 89 | + @handle(Keys.Tab, filter=ViInsertMode() & |
91 | 90 | ~HasFocus(COMMAND_BUFFER) & WhitespaceBeforeCursorOnLine()) |
92 | 91 | def autocomplete_or_indent(event): |
93 | 92 | """ |
|
0 commit comments