Skip to content

Commit 210816b

Browse files
thuibrjonathanslenders
authored andcommitted
Fix the F9 key binding in the example pyvimrc
This fixes the "editor_buffer.filename is None" issue as well as an issue with running the command in a subprocess.
1 parent 44937c5 commit 210816b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

examples/config/pyvimrc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
Pyvim configuration. Save to file to: ~/.pyvimrc
44
"""
5+
from prompt_toolkit.application import run_in_terminal
56
from prompt_toolkit.filters import ViInsertMode
67
from prompt_toolkit.key_binding.key_processor import KeyPress
78
from prompt_toolkit.keys import Keys
@@ -64,7 +65,7 @@ def configure(editor):
6465
editor_buffer = editor.current_editor_buffer
6566

6667
if editor_buffer is not None:
67-
if editor_buffer.filename is None:
68+
if editor_buffer.location is None:
6869
editor.show_message("File doesn't have a filename. Please save first.")
6970
return
7071
else:
@@ -74,7 +75,7 @@ def configure(editor):
7475
# `CommandLineInterface.run_in_terminal` to go to the background and
7576
# not destroy the window layout.
7677
def execute():
77-
call(['python', editor_buffer.filename])
78+
call(['python3', editor_buffer.location])
7879
six.moves.input('Press enter to continue...')
7980

80-
editor.cli.run_in_terminal(execute)
81+
run_in_terminal(execute)

0 commit comments

Comments
 (0)