@@ -74,7 +74,6 @@ def loadini(struct, configfile):
7474 'transpose_chars' : 'C-t' ,
7575 'clear_line' : 'C-u' ,
7676 'clear_screen' : 'C-l' ,
77- 'kill_line' : 'C-k' ,
7877 'clear_word' : 'C-w' ,
7978 'cut_to_buffer' : 'C-k' ,
8079 'delete' : 'C-d' ,
@@ -104,6 +103,10 @@ def loadini(struct, configfile):
104103 'list_above' : False ,
105104 'right_arrow_completion' : True ,
106105 }}
106+
107+ default_keys_to_commands = dict ((value , key ) for (key , value )
108+ in defaults ['keyboard' ].iteritems ())
109+
107110 fill_config_with_default_values (config , defaults )
108111 if not config .read (config_path ):
109112 # No config file. If the user has it in the old place then complain
@@ -113,17 +116,17 @@ def loadini(struct, configfile):
113116 "%s\n " % default_config_path ())
114117 sys .exit (1 )
115118
116- def get_key_no_doublebind ( attr , already_used = {}):
117- """Clears any other configured keybindings using this key"""
118- key = config . get ( 'keyboard' , attr )
119- if key in already_used :
120- default = defaults [ 'keyboard' ][ already_used [ key ] ]
121- if default in already_used :
122- setattr ( struct , '%s_key' % already_used [ key ], '' )
123- else :
124- setattr (struct , '%s_key' % already_used [ key ], default )
125- already_used [ key ] = attr
126- return key
119+
120+ def get_key_no_doublebind ( command ):
121+ default_commands_to_keys = defaults [ 'keyboard' ]
122+ requested_key = config . get ( 'keyboard' , command )
123+ default_command = default_keys_to_commands [ requested_key ]
124+
125+ if default_commands_to_keys [ default_command ] == \
126+ config . get ( 'keyboard' , default_command ) :
127+ setattr (struct , '%s_key' % default_command , '' )
128+
129+ return requested_key
127130
128131 struct .config_path = config_path
129132
@@ -168,7 +171,6 @@ def get_key_no_doublebind(attr, already_used={}):
168171 struct .transpose_chars_key = get_key_no_doublebind ('transpose_chars' )
169172 struct .clear_line_key = get_key_no_doublebind ('clear_line' )
170173 struct .clear_screen_key = get_key_no_doublebind ('clear_screen' )
171- struct .kill_line_key = get_key_no_doublebind ('kill_line' )
172174 struct .exit_key = get_key_no_doublebind ('exit' )
173175 struct .last_output_key = get_key_no_doublebind ('last_output' )
174176 struct .edit_config_key = get_key_no_doublebind ('edit_config' )
0 commit comments