File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -173,13 +173,20 @@ local function get_function_names(keymap_config)
173173end
174174
175175function update_keymap_prefix (prefix , default_prefix )
176- for _ , mappings in pairs (M .values .keymap ) do
177- for key , func in pairs (mappings ) do
178- if prefix ~= ' ' and key :sub (1 , # default_prefix ) == default_prefix then
179- mappings [prefix .. key :sub (# default_prefix + 1 )] = func
180- mappings [key ] = nil
176+ if prefix == default_prefix or not prefix then
177+ return
178+ end
179+
180+ for category , mappings in pairs (M .values .keymap ) do
181+ local new_mappings = {}
182+ for key , opts in pairs (mappings ) do
183+ if vim .startswith (key , default_prefix ) then
184+ new_mappings [prefix .. key :sub (# default_prefix + 1 )] = opts
185+ else
186+ new_mappings [key ] = opts
181187 end
182188 end
189+ M .values .keymap [category ] = new_mappings
183190 end
184191end
185192
You can’t perform that action at this time.
0 commit comments