Skip to content

Commit fe15a65

Browse files
Config example fixes.
1 parent efd4bf6 commit fe15a65

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

examples/ptpython_config/config.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"""
66
from __future__ import unicode_literals
77
from prompt_toolkit.filters import ViInsertMode
8-
from prompt_toolkit.key_binding.input_processor import KeyPress
8+
from prompt_toolkit.key_binding.key_processor import KeyPress
99
from prompt_toolkit.keys import Keys
1010
from pygments.token import Token
1111

@@ -40,7 +40,7 @@ def configure(repl):
4040
repl.completion_menu_scroll_offset = 0
4141

4242
# Show line numbers (when the input contains multiple lines.)
43-
repl.show_line_numbers = True
43+
repl.show_line_numbers = False
4444

4545
# Show status bar.
4646
repl.show_status_bar = True
@@ -117,29 +117,35 @@ def configure(repl):
117117
"""
118118

119119
# Add custom key binding for PDB.
120+
"""
120121
@repl.add_key_binding(Keys.ControlB)
121122
def _(event):
122123
' Pressing Control-B will insert "pdb.set_trace()" '
123124
event.cli.current_buffer.insert_text('\nimport pdb; pdb.set_trace()\n')
125+
"""
124126

125127
# Typing ControlE twice should also execute the current command.
126128
# (Alternative for Meta-Enter.)
129+
"""
127130
@repl.add_key_binding(Keys.ControlE, Keys.ControlE)
128131
def _(event):
129132
b = event.current_buffer
130133
if b.accept_action.is_returnable:
131134
b.accept_action.validate_and_handle(event.cli, b)
135+
"""
132136

133137

134138
# Typing 'jj' in Vi Insert mode, should send escape. (Go back to navigation
135139
# mode.)
140+
"""
136141
@repl.add_key_binding('j', 'j', filter=ViInsertMode())
137142
def _(event):
138143
" Map 'jj' to Escape. "
139144
event.cli.input_processor.feed(KeyPress(Keys.Escape))
140-
141145
"""
146+
142147
# Custom key binding for some simple autocorrection while typing.
148+
"""
143149
corrections = {
144150
'impotr': 'import',
145151
'pritn': 'print',

0 commit comments

Comments
 (0)