Skip to content

Commit 1246deb

Browse files
Only delete 'word' instead of 'WORD' before cursor when control-w is pressed.
(Stopping at any punctiation character is more logical when editing Python code.)
1 parent 869e4fa commit 1246deb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ptpython/key_bindings.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
vi_insert_mode,
1111
)
1212
from prompt_toolkit.key_binding import KeyBindings
13+
from prompt_toolkit.key_binding.bindings.named_commands import get_by_name
1314
from prompt_toolkit.keys import Keys
1415

1516
from .utils import document_is_multiline_python
@@ -61,6 +62,10 @@ def _(event):
6162
if python_input.enable_system_bindings:
6263
event.app.suspend_to_background()
6364

65+
# Delete word before cursor, but use all Python symbols as separators
66+
# (WORD=False).
67+
handle("c-w")(get_by_name("backward-kill-word"))
68+
6469
@handle("f2")
6570
def _(event):
6671
"""

0 commit comments

Comments
 (0)