[Idle-dev] newbie question: getting emacs keybindings in IDLE
Kurt B. Kaiser
kbk at shore.net
Fri Oct 21 23:48:11 CEST 2005
Ron MacNeil <ronmac at media.mit.edu> writes:
> I am using IDLE version 1.1.1 in python 2.4.1 and would like to add
> the simplest emacs keybindings like C-p for 'move up one line', C-f
> 'move forward a character'... C-n 'move down a line'... etc....
> Can you please point me to some approach that will do this? I've
> tried to edit the existing IDLE keybindings but didn't really get
> very far (kept banging into C-f being bound to Find even though I
> removed all references to it in config-keys.def.... etc ) I also
> have tried using XEmacs and find the lack of color a real pain.
> I've searched the web for emacs keybindings for IDLE and found some
> interesting pointers but have not got anything to work..
Simple cursor movement in IDLE is done via the tkinter/Tk library.
IDLE doesn't have virtual events that can be bound to <cursor-left>
and so forth. So there isn't any simple way to do what you are asking.
I think most emacs users these days use the arrow keys, I certainly
do. Control-f etc. were useful in the olden days when many keyboards
didn't have cursor keys. Unlike the old Wordstar sexd cursor movement
keys, they aren't particularly convenient bindings. I'm not going to
type a chord just to move a cursor, especially now that the Control
key is no longer where god intended it to be.
Note that Control-left and Control-right moves by words (in a peculiar,
but useful way). Control-up and down move by blank-line separated
The way to modify IDLE keybindings is to use the Options / Configure
IDLE / Keys dialog. You "Save as a New Custom Key Set". This creates
a config-keys.cfg file in your .idlerc directory. You shouldn't
modify config-keys.def, that's intended to be "factory issue".
More information about the IDLE-dev