bash use readline and share many keybindings with emacs for instance:
Some other bindings differ a bit:
in my .bashrc:
# this supposed that GNU stty is installed and that the special chars are the same on your terminal as on mine # undef C-s and C-r I don't like C-s to stop my terminal, and find it more usefull for incremental search stty stop undef stty rprnt undef #undef C-w , readline automagically binds the special terminal chars to their equivalent commands stty werase undef
and in my .inputrc:
#C-w kill-region "\C-w":kill-region #M-w roughly the same as kill-ring-save "\M-w":copy-region-as-kill # C-space to set-mark "\C-Space":set-mark
Credits goes to the guys on #bash on irc.freenode for telling me about stty and special chars. See man and info pages for bash and readline for more info.
I am no terminal/readline… specialist so correction comments etc.. are welcome.
On Windows, later versions of bash (3.2.3) choke on scripts created with the NT-emacs default encoding, because of the ^M characters. Try adding this to your .emacs: