def load_abort_and_exit_bindings():
 registry = Registry()
 handle = registry.add_binding
 @handle(Keys.ControlC)
 def _(event):
  u' Abort when Control-C has been pressed. '
  event.cli.abort()
 @Condition
 def ctrl_d_condition(cli):
  u' Ctrl-D binding is only active when the default buffer is selected\n        and empty. '
  return ((cli.current_buffer_name == DEFAULT_BUFFER) and (not cli.current_buffer.text))
 handle(Keys.ControlD, filter=ctrl_d_condition)(get_by_name(u'end-of-file'))
 return registry

def load_abort_and_exit_bindings ( ) : registry = Registry ( ) handle = registry . add_binding @ handle ( Keys . ControlC ) def _ ( event ) : event . cli . abort ( ) @ Condition def ctrl_d_condition ( cli ) : return ( ( cli . current_buffer_name == DEFAULT_BUFFER ) and ( not cli . current_buffer . text ) ) handle ( Keys . ControlD , filter = ctrl_d_condition ) ( get_by_name ( u'end-of-file' ) ) return registry
basic bindings for abort and exit .