nflath/hungry-delete

How to override keybingdings in python?

Closed this issue · 2 comments

I have tried:

(global-set-key (kbd "DEL") 'hungry-delete-backward)
(global-hungry-delete-mode)

But when using python, describe-key give me the following:

DEL (translated from <backspace>) runs the command
python-indent-dedent-line-backspace (found in python-mode-map), which
is an interactive compiled Lisp function in ‘python.el’.

It is bound to DEL.

(python-indent-dedent-line-backspace ARG)

De-indent current line.
Argument ARG is passed to ‘backward-delete-char-untabify’ when
point is not in between the indentation.

How should I override the key map to hungry-delete-backward)?

If you want this in python-mode, I would remap the key in python-mode:

(define-key python-mode-map (kbd "DEL") 'hungry-delete-backward)

It works. Thank you!