Is it possible to change word boundaries for readlinein CPython 2.7 or 3.3?
I want backward-kill-word(attached to comfortable C-w) and backward-wordhas exactly the same word boundaries as forward-wordand forward-kill-word. Currently C-werases half a line without regard to syntax, periods , etc. And stretched for M-DELfor a more reasonable removal back too much trouble. I also do not want to use IPython at the moment.
Just reconfiguring C-wto act like M-DELit would be nice (setting it to backward-kill-worddoes nothing, because the function M-DELis probably called something else.)
Update : it gets weird!
>>> import readline
>>> readline.parse_and_bind('"C-k": backward-kill-word')
(press up, press C-k a lot, witness it working)
>>> readline.parse_and_bind('"\\C-w": backward-kill-word')
(press up, press C-w, and see that its function did not change, it wasn't re-bound!)
source
share