File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -203,9 +203,29 @@ function M.lsp_opts(server_name)
203203 return opts
204204end
205205
206+ local key_cache = {} --- @type { [string] : string }
207+
208+ --- @param mappings AstroLSPMappings ?
209+ local function normalize_mappings (mappings )
210+ if not mappings then return end
211+ for _ , mode_maps in pairs (mappings ) do
212+ for key , _ in pairs (mode_maps ) do
213+ if not key_cache [key ] then
214+ key_cache [key ] = vim .fn .keytrans (vim .api .nvim_replace_termcodes (key , true , true , true ))
215+ end
216+ local normkey = key_cache [key ]
217+ if key ~= normkey then
218+ mode_maps [normkey ], mode_maps [key ] = mode_maps [key ], nil
219+ end
220+ end
221+ end
222+ end
223+
206224--- Setup and configure AstroLSP
207225--- @param opts AstroLSPOpts options passed by the user to configure AstroLSP
208226function M .setup (opts )
227+ normalize_mappings (M .config .mappings )
228+ normalize_mappings (opts .mappings )
209229 M .config = vim .tbl_deep_extend (" force" , M .config , opts )
210230
211231 -- enable necessary capabilities for enabled LSP file operations
You can’t perform that action at this time.
0 commit comments